gold bug combining .bss sections...

Ian Lance Taylor iant@google.com
Wed Apr 16 23:01:00 GMT 2008


David Miller <davem@davemloft.net> writes:

>> >> > If, for example, we have a normal .bss in the final link with only a
>> >> > necessary alignment of 4, and we also have a dynbss .bss with a copy
>> >> > reloc needing an alignment of 8, gold outputs the final combined .bss
>> >> > section with only an alignment of 4.
>> >> 
>> >> I just committed this patch which I think should fix this problem.
>> >
>> > Unfortunately it does not.  (I remembered to remove the
>> > .bss alignment hack in my sparc copy reloc function before
>> > testing).
>> 
>> Hmmmm, well, it does seem to fix it in the limited sense that the
>> alignment of the .bss section in two_file_shared_2_test is 8, whereas
>> you indicated that it was previously 4.  That is, I suspect that now
>> something else is failing.
>> 
>> Since I don't have easy access to a SPARC system, how does the new
>> binary fail?
>
> t17data is not 8 byte aligned, so we take a SIGBUS.
>
> t17data is a copy reloc which needs to be 8 byte aligned
> but it isn't.
>
> Perhaps when the various .bss section data are combined, things that
> were aligned end up not being so.


Looking into this I was reminded of the ugly duplication of the copy
reloc handling, so I rewrote the copy reloc support.

I reworked the way we determine the alignment of copied symbols.  Let
me know if this still fails on SPARC.

I committed the patch below.

Ian


2008-04-16  Ian Lance Taylor  <iant@google.com>

	* copy-relocs.cc: New file.
	* copy-relocs.h: New file.
	* reloc.cc: Remove Copy_relocs code.
	* reloc.h: Likewise.
	* reloc-types.h (struct Reloc_types) [both versions]: Add
	get_reloc_addend_noerror.
	* output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
	variants of add_global which take an addend which must be zero.
	* i386.cc: Include "copy-relocs.h".
	(class Target_i386): Change type of copy_relocs_ to variable,
	update initializer.
	(Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
	Change all callers.
	(Target_i386::do_finalize_sections): Change handling of
	copy_relocs_.
	* sparc.cc: Include "copy-relocs.h".
	(class Target_sparc): Change type of copy_relocs_ to variable,
	update initializer.
	(Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
	Change all callers.
	(Target_sparc::do_finalize_sections): Change handling of
	copy_relocs_.
	* x86_64.cc: Include "copy-relocs.h".
	(class Target_x86_64): Change type of copy_relocs_ to variable,
	update initializer.
	(Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
	class.  Change all callers.
	(Target_x86_64::do_finalize_sections): Change handling of
	copy_relocs_.
	* Makefile.am (CCFILES): Add copy-relocs.cc.
	(HFILES): Add copy-relocs.h.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 48395 bytes
Desc: Rewrite COPY reloc support
URL: <https://sourceware.org/pipermail/binutils/attachments/20080416/ba4dab77/attachment.bin>


More information about the Binutils mailing list