This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: call gcc no -fpic/-fpie only -pie?

>> But the ld manual said if specify -pie should specify -fpic etc.
> Where does it say this ?  I tried looking for it, but did not find it
> anywhere.

It's actually the GCC manual that says this. For -shared, you should
use -fpic, and for -pie, you should use -fpie.

>> static relocation type only has R_386_32/R_386_PC32, they should be
>> changed to dynamic relocation type R_386_COPY/R_386_GLOB_DAT etc by
>> ld. If so why not manual said that( if specify -pie should specify
>> -fpic etc) ? If not , what the details that cannot be changed to
>> dynamic link?

I'm not really sure I understand what the question is.

If you're wondering why your program worked even though you didn't
also specify -fpie, it's probably because the 32-bit x86 ABI allows
dynamic text relocations. The reason for the recommendation is to make
sure that the text segment can be fully sharable, and text relocations
will result in a per-process copy of each page that has a relocation
applied. Try adding the -Wl,--warn-shared-textrel option. (It could
also be that your test program is simple enough that no dynamic text
relocations were needed.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]