-Ur option documentation

Simon Richter Simon.Richter@hogyros.de
Mon May 8 11:48:05 GMT 2023


Hi,

On 5/8/23 19:47, Florian Weimer via Binutils wrote:

>>> '-Ur'

>>> For ELF, this refers to the legacy init function, right?
>> No, it refers to the a.out N_SETx symbols.

> So this doesn't matter to ELF at all?  Would it be possible to update
> the documentation accordingly?

I remember that we used -Ur excessively when linking programs and 
libraries for uClinux.

With -Ur, a different linker script is used that looks a lot like the 
script used for a final link, i.e. it builds init and fini arrays and 
ctor and dtor blocks, creates the usual generated symbols (_stext, 
_etext, _sdata, _edata, _sbss, _ebss, ...) and merges everything into a 
single section.

The linker then resolves internal relocations, and normally only 
relocations against the start address of the output section remain, 
which are output into the resulting relocatable object, which can be 
easily converted to a binary plus a table of offsets where the absolute 
address must be added.

Nasty hack, but it works.

    Simon


More information about the Binutils mailing list