https://sourceware.org/bugzilla/show_bug.cgi?id=33720

--- Comment #7 from Thomas Debesse <dev at illwieckz dot net> ---
Thanks, such patch also works.

When using such patch, this warning is now displayed:

/usr/bin/ld.bfd: warning: .note.gnu.build-id section discarded, --build-id
ignored

Despite it looks harmless to us, this warning having been implemented in ld at
first is suggesting the patch is not implementing a nominal behavior and is a
workaround.

So we now know three ways to workaround the bug:

- set :text in the .rodata output section
- use the --orphan-handling=discard linker flag
- discard the .note.gnu.build-id with /DISCARD/

You said “to fix your linker script”, do you mean by that to adjust the linker
script to comply with the observed linker behaviour, or are you saying ld has
no bug and that is the linker script we use that have a bug?

slipher told me that before, suggesting it can be an ld bug:

> That does seem like an ld bug based on the manual.
> > If you place a section in one or more segments using ‘:phdr’,
> > then the linker will place all subsequent allocatable sections
> > which do not specify ‘:phdr’ in the same segments.
> -- https://sourceware.org/binutils/docs/ld/PHDRS.html

And also:

> The broken binary has a faulty PT_LOAD command that overwrites
> the text section with zeroes. Definitely seems like a bug with ld.

I emphasize the usage of “seems like”, it _looks to be_ an ld bug to us.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to