[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] stdbuf: enforce -fPIC compilation for stdbuf.so, required by
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] stdbuf: enforce -fPIC compilation for stdbuf.so, required by gcc-5.0 |
Date: |
Thu, 26 Mar 2015 08:19:37 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 26/03/15 07:41, Bernhard Voelker wrote:
> Linking 'stdbuf.so' failed with gcc-5.0 on x86_64 when -fpie
> compilation was enabled which includes -fno-PIC.
>
> ld: src/src_libstdbuf_so-libstdbuf.o: relocation R_X86_64_PC32 \
> against undefined symbol `stderr@@GLIBC_2.2.5' can not be \
> used when making a shared object; recompile with -fPIC
>
> * src/local.mk (src_libstdbuf_so_CFLAGS): Explicitly choose the options
> "-fno-pie -fPIC" for the compilation of "stdbuf.c".
> ---
> src/local.mk | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/local.mk b/src/local.mk
> index 19152f0..60ba3c7 100644
> --- a/src/local.mk
> +++ b/src/local.mk
> @@ -406,8 +406,10 @@ src_libstdbuf_so_LDADD = $(LIBINTL)
> # Note libstdbuf is only compiled if GCC is available
> # (as per the check in configure.ac), so these flags should be available.
> # libtool is probably required to relax this dependency.
> +# As a given -fpie option may implicitly include -fno-PIC
> +# (e.g. on gcc-5.0), explicitly choose PIC compilation.
> src_libstdbuf_so_LDFLAGS = -shared
> -src_libstdbuf_so_CFLAGS = -fPIC $(AM_CFLAGS)
> +src_libstdbuf_so_CFLAGS = $(AM_CFLAGS) -fno-pie -fPIC
>
> BUILT_SOURCES += src/coreutils.h
> if SINGLE_BINARY
Looks good thanks.
BTW, is the -fno-pie not implicit in -fPIC ?
cheers,
Pádraig