[PATCH] ld: ensure build-id is placed near ELF headers

Nick Clifton nickc@redhat.com
Wed Sep 11 14:11:50 GMT 2024


Hi Andrew,

> Here are the results using lld 17.0.6:

> In every case the NOTE segment is placed towards the start of the ELF,
> which is good. 

Phew!


> Basically suggesting that the bfd linker should place r/o data before
> the code.  My concern is that if this was made optional, especially if
> this wasn't the default in --rosegment mode, then this would leave some
> loss of functionality in place, which I'd really like to avoid if
> possible.

Understood.

>>> The patch below is an RFC rather than a full patch, I've not update the
>>> commit message to describe the changes to the alignment code yet, but I
>>> wanted to share this so we could discuss it.

Bash shell syntax issues aside I like the patch.

My testing has shown no problems with it and it does still allow --rosegment
to make a difference to the size of binaries when -z separate-code is used,
so I am willing to accept it.

I am however above to fly off to the GNU Tools Cauldron conference however,
so if you could submit a updated version with the syntax changes suggested
then I will review and apply it when I get back.

Cheers
   Nick



More information about the Binutils mailing list