Add --disable-new-dtags option when setting rpath
Some newer Linux systems enable the "new dtags" linker option by
default. With this option --rpath sets DT_RUNPATH instead of DT_RPATH.
Unfortunately, DT_RUNPATH is not applied transitively when searching
for indirect dependencies, breaking the Lucy test executable. See
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1253638
https://sourceware.org/bugzilla/show_bug.cgi?id=13945
diff --git a/src/Charmonizer/Core/CFlags.c b/src/Charmonizer/Core/CFlags.c
index ab57fcc..c42b6bf 100644
--- a/src/Charmonizer/Core/CFlags.c
+++ b/src/Charmonizer/Core/CFlags.c
@@ -363,7 +363,15 @@
if (chaz_CC_binary_format() != CHAZ_CC_BINFMT_ELF) { return; }
if (flags->style == CHAZ_CFLAGS_STYLE_GNU) {
- string = chaz_Util_join("", "-Wl,-rpath,", path, NULL);
+ /* If "new dtags" are enabled by default, DT_RUNPATH is set instead of
+ * DT_RPATH. Unfortunately, DT_RUNPATH is not applied transitively
+ * when searching for indirect dependencies. See
+ *
+ * https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1253638
+ * https://sourceware.org/bugzilla/show_bug.cgi?id=13945
+ */
+ string = chaz_Util_join("", "-Wl,--disable-new-dtags -Wl,-rpath,",
+ path, NULL);
}
else if (flags->style == CHAZ_CFLAGS_STYLE_SUN_C) {
string = chaz_Util_join(" ", "-R", path, NULL);