What types of relocations needed to be saved in the option "-emit-relocs" in ld linker?

Alan Modra amodra@gmail.com
Fri Nov 5 06:31:36 GMT 2021


On Wed, Nov 03, 2021 at 07:02:34PM +0800, 罗海玲 via Binutils wrote:
> Hi all,
>     I’m new of ld linker. And I have a simple problem about ld linker. 
> What types of relocations needed to be saved in the option "-emit-relocs” 
> in ld linker? Do all types of relocations need to be saved?

--emit-relocs is mostly handled by the generic code.  See
elflink.c:elf_link_input_bfd after the call to relocate_section, which
will copy all relocs from input to output.  Some will be zeroed out.
Where a backend edits code in some way it may be necessary to edit
relocations too, in order for the output relocations to match up with
the code.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list