stdlib/Makefile: Link tst-tls-atexit without --as-needed.

Message ID 52089593.3050108@linaro.org
State Superseded
Headers show

Commit Message

Will Newton Aug. 12, 2013, 7:58 a.m.
Fix a build failure with toolchains that pass --as-needed by default.

ChangeLog:

2013-08-09  Will Newton  <will.newton@linaro.org>

	* stdlib/Makefile: Link tst-tls-atexit without --as-needed.
---
 stdlib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Roland McGrath Aug. 20, 2013, 9:30 p.m. | #1
What's the failure?  
The program directly uses both libpthread and libdl functions.
Andreas Schwab Aug. 20, 2013, 10:55 p.m. | #2
The bug is probably that this is using LDFLAGS which comes too early to
see the references.  Internal library references should be added to the
dependency list of the target.

Andreas.
Roland McGrath Aug. 20, 2013, 10:59 p.m. | #3
> The bug is probably that this is using LDFLAGS which comes too early to
> see the references.  Internal library references should be added to the
> dependency list of the target.

Good point.
Will Newton Aug. 21, 2013, 6:39 a.m. | #4
On 20 August 2013 23:55, Andreas Schwab <schwab@linux-m68k.org> wrote:

Hi Andreas,

> The bug is probably that this is using LDFLAGS which comes too early to
> see the references.  Internal library references should be added to the
> dependency list of the target.

Yes, this is the cause of the problem I am seeing. Is there a better
way to fix it than the patch I proposed? I am not familiar enough with
the build infrastructure yet to know what the best way is.

Thanks,

Patch

diff --git a/stdlib/Makefile b/stdlib/Makefile
index 17d80e0..969dd51 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -161,6 +161,6 @@  $(objpfx)tst-strtod6: $(link-libm)

 tst-tls-atexit-lib.so-no-z-defs = yes

-LDFLAGS-tst-tls-atexit = $(common-objpfx)nptl/libpthread.so \
+LDFLAGS-tst-tls-atexit = $(no-as-needed) $(common-objpfx)nptl/libpthread.so \
 			 $(common-objpfx)dlfcn/libdl.so
 $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so