[klibc] [PATCH 1/1] workaround for overlapping sections in binary

Ben Hutchings ben at decadent.org.uk
Tue Apr 27 15:17:07 PDT 2021


On Wed, 2021-02-03 at 10:05 +0300, Petr Ovtchenkov wrote:
> Problem: binary (typesize.bin) created from object file (typesize.o)
> with 'objcopy -O binary ... '. But typesize.o has relocatable objects that all
> copied with offset 0. This will lead to overlapping sections in binary.
> By fortunate syscalls.pl check magic bytes and ring the bell.
> 
> This is naive workaround: skip .note.gnu.property section that overlap
> .rodata section.
> 
> This not a bug of objcopy,  
> https://sourceware.org/bugzilla/show_bug.cgi?id=27314
[...]

Since all the sections overlap each other, we could have the same
trouble again with another note or debug section.

We only actually want the read-only data section, so why don't we
tell objcopy that by adding "--only-section .rodata" instead?

Ben.

-- 
Ben Hutchings
For every action, there is an equal and opposite criticism. - Harrison
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zytor.com/archives/klibc/attachments/20210428/a5de9bdb/attachment.sig>


More information about the klibc mailing list