Skip to contentSkip to conversation

glibc and LDFLAGS

PATCH Superseded Rasmus Villemoes 4 participants 8 messages Jan 18, 2020 – Feb 3, 2020

lore
Share & tools
lore
#0 lore raw

I've added a custom setting to TARGET_LDFLAGS, but then I noticed that the glibc build ignored that. The glibc do_compile did

LDFLAGS = ""

for a very long time, with the explanation that "# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging". Is that actually still relevant with per-recipe staging?

If that is indeed moot, can we do

CPPFLAGS="" oe_runconf
}

+LDFLAGS += "-fuse-ld=bfd"
do_compile () {
- # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if
another glibc is in staging
- LDFLAGS="-fuse-ld=bfd"
base_do_compile
echo "Adjust ldd script"
if [ -n "${RTLDLIST}" ]

?

And if not, at least move the LDFLAGS definition out to recipe level so "bitbake -e" will show the value actually in effect? (And that would also allow a .bbappend to tweak glibc's LDFLAGS with my custom setting, though it's annoying to have to maintain that, so the best is if glibc can just be built with the global LDFLAGS setting).

Rasmus

#1 lore raw
Quoted 9 lines · Rasmus Villemoes

I've added a custom setting to TARGET_LDFLAGS, but then I noticed that
the glibc build ignored that. The glibc do_compile did

LDFLAGS = ""

for a very long time, with the explanation that "# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging". Is that actually still relevant with per-recipe staging?

It is obsolete now, correct.

Quoted 6 lines

If that is indeed moot, can we do

CPPFLAGS="" oe_runconf
}

+LDFLAGS += "-fuse-ld=bfd"

Its worth a try...

Cheers,

Richard

#2 lore raw

PATCH 1/1 glibc: don't ignore global LDFLAGS settings

Two things: The -Wl,-rpath-link comment is stale (due to per-recipe staging), so we no longer need to set our own LDFLAGS to avoid -Wl,-rpath-link being in there. Second, overriding LDFLAGS should be done at the recipe level so "bitbake -e" can show what is going on. Otherwise debugging why one's global LDFLAGS tweaks are being ignored is needlessly painful.

So pull out the LDFLAGS setting from do_compile, and change it to an append instead of assignment.

For the benefit of future git blame: the -fuse-ld=bfd setting was added by ac64c3b96b (glibc: always use bfd linker).

---
 meta/recipes-core/glibc/glibc_2.30.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/glibc/glibc_2.30.bb +1 -2
index 7913bc2812..c6dd78ca8b 100644
@@ -93,9 +93,8 @@ do_configure () {
         CPPFLAGS="" oe_runconf
 }
 
+LDFLAGS += "-fuse-ld=bfd"
 do_compile () {
-	# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
-	LDFLAGS="-fuse-ld=bfd"
 	base_do_compile
 	echo "Adjust ldd script"
 	if [ -n "${RTLDLIST}" ]
Signature · 1 line
2.23.0
#3 lore raw

PATCH v2 1/1 glibc: don't ignore global LDFLAGS settings

Two things: The -Wl,-rpath-link comment is stale (due to per-recipe staging), so we no longer need to set our own LDFLAGS to avoid -Wl,-rpath-link being in there. Second, overriding LDFLAGS should be done at the recipe level so "bitbake -e" can show what is going on. Otherwise debugging why one's global LDFLAGS tweaks are being ignored is needlessly painful.

So pull out the LDFLAGS setting from do_compile, and change it to an append instead of assignment.

For the benefit of future git blame: the -fuse-ld=bfd setting was added by ac64c3b96b (glibc: always use bfd linker).

---
v2: Rebase to real upstream master. Note to self: "git pull" before rebasing to master.

 meta/recipes-core/glibc/glibc_2.31.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/glibc/glibc_2.31.bb +1 -2
index b8c570db52..cfba4de49b 100644
@@ -93,9 +93,8 @@ do_configure () {
         CPPFLAGS="" oe_runconf
 }
 
+LDFLAGS += "-fuse-ld=bfd"
 do_compile () {
-	# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
-	LDFLAGS="-fuse-ld=bfd"
 	base_do_compile
 	echo "Adjust ldd script"
 	if [ -n "${RTLDLIST}" ]
Signature · 1 line
2.23.0
#4 lore raw

Re: [PATCH v2] glibc: don't ignore global LDFLAGS settings

this patch is ok but I have reservations since += now means global ldflags will be applied
so it would need some testing to ensure it works well.

Quoted 39 lines · Rasmus Villemoes

Two things: The -Wl,-rpath-link comment is stale (due to per-recipe staging), so we no longer need to set our own LDFLAGS to avoid -Wl,-rpath-link being in there. Second, overriding LDFLAGS should be done at the recipe level so "bitbake -e" can show what is going on. Otherwise debugging why one's global LDFLAGS tweaks are being ignored is needlessly painful.

So pull out the LDFLAGS setting from do_compile, and change it to an append instead of assignment.

For the benefit of future git blame: the -fuse-ld=bfd setting was added by ac64c3b96b (glibc: always use bfd linker).

---
v2: Rebase to real upstream master. Note to self: "git pull" before rebasing to master.

 meta/recipes-core/glibc/glibc_2.31.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/glibc/glibc_2.31.bb +1 -3
index b8c570db52..cfba4de49b 100644
@@ -93,9 +93,8 @@ do_configure () {
         CPPFLAGS="" oe_runconf
 }
 
+LDFLAGS += "-fuse-ld=bfd"
 do_compile () {
-       # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
-       LDFLAGS="-fuse-ld=bfd"
        base_do_compile
        echo "Adjust ldd script"
        if [ -n "${RTLDLIST}" ]
--

2.23.0

#5 lore raw

Re: [PATCH v2] glibc: don't ignore global LDFLAGS settings

Quoted 2 lines · Khem Raj

this patch is ok but I have reservations since += now means global ldflags will be applied

Indeed, that's half the point of the patch.

Quoted 1 line

so it would need some testing to ensure it works well.

Yes, but I don't think there's any way to figure out if it breaks something other than trying it. If it does, I can certainly make it just LDFLAGS = "..." outside do_compile, and then I'll have to .bbappend or _pn-glibc_append my custom LDFLAGS, which is ok for a single rather special recipe, but would be a hassle to maintain if this was a common thing.

Rasmus

#6 lore raw

Re: [PATCH v2] glibc: don't ignore global LDFLAGS settings

In reply to Khem Raj

ping

Quoted 45 lines · Khem Raj

this patch is ok but I have reservations since += now means global ldflags will be applied
so it would need some testing to ensure it works well.

Quoted 39 lines · Rasmus Villemoes

Two things: The -Wl,-rpath-link comment is stale (due to per-recipe staging), so we no longer need to set our own LDFLAGS to avoid -Wl,-rpath-link being in there. Second, overriding LDFLAGS should be done at the recipe level so "bitbake -e" can show what is going on. Otherwise debugging why one's global LDFLAGS tweaks are being ignored is needlessly painful.

So pull out the LDFLAGS setting from do_compile, and change it to an append instead of assignment.

For the benefit of future git blame: the -fuse-ld=bfd setting was added by ac64c3b96b (glibc: always use bfd linker).

---
v2: Rebase to real upstream master. Note to self: "git pull" before rebasing to master.

 meta/recipes-core/glibc/glibc_2.31.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/glibc/glibc_2.31.bb +1 -3
index b8c570db52..cfba4de49b 100644
@@ -93,9 +93,8 @@ do_configure () {
         CPPFLAGS="" oe_runconf
 }
 
+LDFLAGS += "-fuse-ld=bfd"
 do_compile () {
-       # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
-       LDFLAGS="-fuse-ld=bfd"
        base_do_compile
        echo "Adjust ldd script"
        if [ -n "${RTLDLIST}" ]
--

2.23.0

Signature · 8 lines
Rasmus Villemoes
Software Developer
Prevas A/S
Hedeager 3
DK-8200 Aarhus N
+45 51210274
[email protected]
www.prevas.dk
#7 lore raw

✗ patchtest: failure for glibc: don't ignore global LDFLAGS settings

In reply to Richard Purdie

== Series Details ==

Series: glibc: don't ignore global LDFLAGS settings
Revision: 1
URL : https://patchwork.openembedded.org/series/22148/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 1098fdf360)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe