D53557-hurd-self-exe-realpath
authorLLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>
Tue, 9 Jul 2019 19:04:39 +0000 (20:04 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Tue, 9 Jul 2019 19:04:39 +0000 (20:04 +0100)
commita49bb6d24fc2b435733fa63b78e4a0c70a976a9e
tree58734c0d1a68aaf2759b365b8c2c951a9f619138
parent169d68d299f044667f63b74b9190a36a05424b3f
D53557-hurd-self-exe-realpath

r345104 | rnk | 2018-10-24 01:35:43 +0200 (mer. 24 oct. 2018) | 25 lignes

[hurd] Make getMainExecutable get the real binary path

On GNU/Hurd, llvm-config is returning bogus value, such as:

$ llvm-config-6.0 --includedir
/usr/include

while it should be:
$ llvm-config-6.0 --includedir
/usr/lib/llvm-6.0/include

This is because getMainExecutable does not get the actual installation
path. On GNU/Hurd, /proc/self/exe is indeed a symlink to the path that
was used to start the program, and not the eventual binary file. Llvm's
getMainExecutable thus needs to run realpath over it to get the actual
place where llvm was installed (/usr/lib/llvm-6.0/bin/llvm-config), and
not /usr/bin/llvm-config-6.0. This will not change the result on Linux,
where /proc/self/exe already points to the eventual file.

Patch by Samuel Thibault!

While making changes here, I reformatted this block a bit to reduce
indentation and match 2 space indent style.

Differential Revision: https://reviews.llvm.org/D53557

Gbp-Pq: Topic hurd
Gbp-Pq: Name D53557-hurd-self-exe-realpath.diff
lib/Support/Unix/Path.inc