This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix test-suite failure with -Wl,--as-needed
- From: Matt Turner <mattst88 at gmail dot com>
- To: Allan McRae <allan at archlinux dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 7 Oct 2012 21:37:19 -0700
- Subject: Re: [PATCH] Fix test-suite failure with -Wl,--as-needed
- References: <1349668307-26132-1-git-send-email-allan@archlinux.org>
On Sun, Oct 7, 2012 at 8:51 PM, Allan McRae <allan@archlinux.org> wrote:
> When building the test-suite with --as-needed in your LDFLAGS, the
> test test-cond24 fails linking:
>
> /build/nptl/tst-cond24.o: In function `thread_fun_timed':
> tst-cond24.c:(.text+0x30c): undefined reference to `clock_gettime'
> collect2: error: ld returned 1 exit status
>
>
> nptl/ChangeLog:
>
> 2012-10-08 Allan McRae <allan@archlinux.org>
>
> *Makefile (LDFLAGS-tst-cond24): Use $(no-as-needed).
>
> ---
> nptl/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/nptl/Makefile b/nptl/Makefile
> index 67c2627..a89619d 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -275,7 +275,7 @@ gen-as-const-headers = pthread-errnos.sym
>
> LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
>
> -LDFLAGS-tst-cond24 = -lrt
> +LDFLAGS-tst-cond24 = $(no-as-needed) -lrt
>
> include ../Makeconfig
>
> --
> 1.7.12.2
>
For my own curiosity, why is that needed? clock_gettime is provided by
librt, which we're clearly linking against.