[PATCH] BZ #5784: Build libpthread.a with ld -r

Alexandre Oliva aoliva@redhat.com
Wed Sep 5 22:57:00 GMT 2012


On Sep  5, 2012, "Joseph S. Myers" <joseph@codesourcery.com> wrote:

> On Wed, 5 Sep 2012, H.J. Lu wrote:
>> +$(objpfx)libpthread.a: $(patsubst %,$(objpfx)%.o,\
>> +			 $(filter-out $(libpthread-shared-only-routines),\
>> +				      $(all-libpthread-routines)))
>> +	cd $(objpfx) && \
>> +	$(CC) -r -nostdlib -o $(@:$(objpfx)%=%) $(patsubst $(objpfx)%,%,$^)

> This looks rather like it builds libpthread.a as an object file ... it 
> would seem safer for it to be an archive containing a single object file, 
> rather than directly being an object file itself.

+1

Plus, I recall from a time long, long ago, that using -r on large
libraries caused trouble on some platforms that had tight offset limits
for GOT accesses.  MIPS was one example, and I worked on multi-GOT to
alleviate the problem, but merging multiple object files into one
renders multi-GOT inoperant.  I'm pretty sure I ran into some such
issues on other platforms (alpha comes to mind) as a libtool maintainer,
too.  So...  Are we sure this change won't run us afoul of such
platform-specific ABI limits?

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer



More information about the Libc-alpha mailing list