-Ur option documentation

Florian Weimer fweimer@redhat.com
Fri May 5 20:58:35 GMT 2023


The manual says this:

'-Ur'
     For anything other than C++ programs, this option is equivalent to
     '-r': it generates relocatable output--i.e., an output file that
     can in turn serve as input to 'ld'.  When linking C++ programs,
     '-Ur' _does_ resolve references to constructors, unlike '-r'.  It
     does not work to use '-Ur' on files that were themselves linked
     with '-Ur'; once the constructor table has been built, it cannot be
     added to.  Use '-Ur' only for the last partial link, and '-r' for
     the others.

For ELF, this refers to the legacy init function, right?  So it's not
really about C++ in that case.  And the restriction is gone if the
target uses ELF SHT_INIT_ARRAY sections.

Thanks,
Florian



More information about the Binutils mailing list