automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rfe: Direct -fPIE support


From: Jan Engelhardt
Subject: Re: rfe: Direct -fPIE support
Date: Tue, 9 Dec 2008 17:41:36 +0100 (CET)
User-agent: Alpine 1.10 (LNX 962 2008-03-14)

Hi Ralf,

On Tuesday 2008-12-09 07:15, Ralf Wildenhues wrote:
>* Jan Engelhardt wrote on Tue, Dec 09, 2008 at 12:11:52AM CET:
>> 
>> is there a chance automake and/or libtool would support -fPIE for 
>> executables, much like libtool unconditionally turns on -fPIC for shared 
>> libraries?
>
>Just using
>  ./configure CFLAGS=-fPIE
>
>should work fine, or put it in target_CFLAGS if you only want some
>targets to be PIE.  Be sure to use recent Libtool, so that libraries
>get the right flags.

libtool version is 1.5.26. I fear just adding CFLAGS=-fPIE is not
going to cut it:

  CC       pam_mount_la-pam_mount.lo
[...]
  CCLD     pam_mount.la
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: 
.libs/pam_mount_la-pam_mount.o: relocation R_X86_64_PC32 against symbol 
`pam_sm_authenticate' can not be used when making a shared object; recompile 
with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: 
final link failed: Bad value
collect2: ld returned 1 exit status

Calling it with make V=2 shows that the following command lines
are used by make:

 gcc -DHAVE_CONFIG_H -I. -I..  (...) -fPIE -MT
 pam_mount_la-pam_mount.lo -MD -MP -MF
 .deps/pam_mount_la-pam_mount.Tpo -c pam_mount.c -fPIC -DPIC -o
 .libs/pam_mount_la-pam_mount.o

And when collect2 throws an error this means that -fPIC did
not override -fPIE. So libtool needs to munge the -fPIE
(and -fpie and -fpic, BTW) when adding -fPIC itself.


thanks,
Jan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]