Can I relink a executable to collapse multiple sections into one
Nick Clifton
nickc@redhat.com
Mon May 17 16:36:45 GMT 2021
Hi 陈云星
> After Linker linked the executable contains following sections:
> What I want to do was collapse “memory_context_static_*” into one section “memory_context_static”;
>
> Is there some method let the linker to relink this executable file to do such job ?
It would be better to have this happen during the initial link, if at all possible.
To do this simply create a linker script fragment like this:
SECTIONS {
.memory_context_static_id : { *(.memory_context_static_id .memory_context_static_id*) }
}
and then include it on the linker command line.
Relinking an already fully linked binary is going to be difficult, and I would not
recommend it if you can avoid it.
Cheers
Nick
More information about the Binutils
mailing list