Skip to contentSkip to conversation

bitbake.conf: add --enable-new-dtags to linker

PATCH In review Alexander Kanavin 2 participants 2 messages Dec 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake.conf: add --enable-new-dtags to linker

Various versions of ld have different defaults for this (even between e.g. Ubuntu 16.04 and 18.04). This has the consequence of putting either RPATH or RUNPATH into the binary, depending on the linker, which have different priorities vs LD_LIBRARY_PATH env var. Also, I think, the original executable binary is looked up for the tags when resolving a dependency of a shared library when using RPATH, but not RUNPATH.

Let's make this deterministic.

---
 meta/conf/bitbake.conf | 1 +
 1 file changed, 1 insertion(+)
meta/conf/bitbake.conf +1 -0
index 64800623545..732e4f93328 100644
@@ -573,6 +573,7 @@ export TARGET_CXXFLAGS = "${TARGET_CFLAGS}"
 
 export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \
                         -L${STAGING_BASE_LIBDIR_NATIVE} \
+                        -Wl,--enable-new-dtags \
                         -Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} \
                         -Wl,-rpath-link,${STAGING_BASE_LIBDIR_NATIVE} \
                         -Wl,-rpath,${STAGING_LIBDIR_NATIVE} \
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Alexander Kanavin

Various versions of ld have different defaults for this (even between e.g. Ubuntu 16.04 and 18.04). This has the consequence of putting either RPATH or RUNPATH into the binary, depending on the linker, which have different priorities vs LD_LIBRARY_PATH env var. Also, I think, the original executable binary is looked up for the tags when resolving a dependency of a shared library when using RPATH, but not RUNPATH.

Quoted 2 lines

Let's make this deterministic.

this change is fine in general. What we have to understand is that --enable-new-dtags actually sets DT_RUNPATH instead of DT_RPATH. DT_RPATH has higher precedence than LD_LIBRARY_PATH; DT_RUNPATH has lower precedence.

with this change we will let LD_LIBRARY_PATH override our settings. So look for case where we might have assumed that we are setting DT_RPATH so no environment can affect us

Quoted 25 lines
---
 meta/conf/bitbake.conf | 1 +
 1 file changed, 1 insertion(+)
meta/conf/bitbake.conf +1 -1
index 64800623545..732e4f93328 100644
@@ -573,6 +573,7 @@ export TARGET_CXXFLAGS = "${TARGET_CFLAGS}"
 
 export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \
                         -L${STAGING_BASE_LIBDIR_NATIVE} \
+                        -Wl,--enable-new-dtags \
                         -Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} \
                         -Wl,-rpath-link,${STAGING_BASE_LIBDIR_NATIVE} \
                         -Wl,-rpath,${STAGING_LIBDIR_NATIVE} \
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core