* Can I relink a executable to collapse multiple sections into one
@ 2021-05-15 7:35 陈云星
2021-05-17 16:36 ` Nick Clifton
2021-05-18 6:29 ` Alan Modra
0 siblings, 2 replies; 4+ messages in thread
From: 陈云星 @ 2021-05-15 7:35 UTC (permalink / raw)
To: binutils
After Linker linked the executable contains following sections:
27 .data.rel.ro.local 002a2660 000000000ad74f40 000000000ad74f40 0a974f40 2**6
CONTENTS, ALLOC, LOAD, DATA
28 memory_context_static_id 00000008 000000000b0175a0 000000000b0175a0 0ac175a0 2**3
CONTENTS, ALLOC, LOAD, DATA
29 memory_context_static_idz 00000008 000000000b0175a8 000000000b0175a8 0ac175a8 2**3
CONTENTS, ALLOC, LOAD, DATA
30 memory_context_static_id5 00000010 000000000b0175b0 000000000b0175b0 0ac175b0 2**3
CONTENTS, ALLOC, LOAD, DATA
31 memory_context_static_id8 000000d8 000000000b0175c0 000000000b0175c0 0ac175c0 2**3
CONTENTS, ALLOC, LOAD, DATA
32 memory_context_static_id2 00000020 000000000b017698 000000000b017698 0ac17698 2**3
CONTENTS, ALLOC, LOAD, DATA
33 CO_HOOK_BEGIN 00000020 000000000b0176c0 000000000b0176c0 0ac176c0 2**5
CONTENTS, ALLOC, LOAD, DATA
34 CO_HOOK_END 00000020 000000000b0176e0 000000000b0176e0 0ac176e0 2**5
CONTENTS, ALLOC, LOAD, DATA
35 memory_context_static_id0 00000008 000000000b017700 000000000b017700 0ac17700 2**3
CONTENTS, ALLOC, LOAD, DATA
36 memory_context_static_id11 00000060 000000000b017708 000000000b017708 0ac17708 2**3
CONTENTS, ALLOC, LOAD, DATA
37 memory_context_static_id17 00000008 000000000b017768 000000000b017768 0ac17768 2**3
CONTENTS, ALLOC, LOAD, DATA
38 memory_context_static_id9 00000010 000000000b017770 000000000b017770 0ac17770 2**3
CONTENTS, ALLOC, LOAD, DATA
39 memory_context_static_id12 00000008 000000000b017780 000000000b017780 0ac17780 2**3
CONTENTS, ALLOC, LOAD, DATA
40 memory_context_static_id14 00000008 000000000b017788 000000000b017788 0ac17788 2**3
CONTENTS, ALLOC, LOAD, DATA
41 CO_BUFFER_BEGIN 00000004 000000000b017790 000000000b017790 0ac17790 2**2
CONTENTS, ALLOC, LOAD, DATA
42 CO_BUFFER_END 00000004 000000000b017794 000000000b017794 0ac17794 2**2
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 ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can I relink a executable to collapse multiple sections into one
2021-05-15 7:35 Can I relink a executable to collapse multiple sections into one 陈云星
@ 2021-05-17 16:36 ` Nick Clifton
2021-05-17 16:49 ` 陈云星
2021-05-18 6:29 ` Alan Modra
1 sibling, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2021-05-17 16:36 UTC (permalink / raw)
To: 陈云星, binutils
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can I relink a executable to collapse multiple sections into one
2021-05-17 16:36 ` Nick Clifton
@ 2021-05-17 16:49 ` 陈云星
0 siblings, 0 replies; 4+ messages in thread
From: 陈云星 @ 2021-05-17 16:49 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
because we want use another linker to do some work the current linker not supported;
i use gold linker to reorder functiom sections which bfd linker not supported,and than use lld or bfd to collect several special section into one section this step can not be done with gold linker, because of its not support custom ld script;
发自我的iPhone
> 在 2021年5月18日,上午12:36,Nick Clifton <nickc@redhat.com> 写道:
>
> 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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Can I relink a executable to collapse multiple sections into one
2021-05-15 7:35 Can I relink a executable to collapse multiple sections into one 陈云星
2021-05-17 16:36 ` Nick Clifton
@ 2021-05-18 6:29 ` Alan Modra
1 sibling, 0 replies; 4+ messages in thread
From: Alan Modra @ 2021-05-18 6:29 UTC (permalink / raw)
To: 陈云星; +Cc: binutils
On Sat, May 15, 2021 at 03:35:29PM +0800, 陈云星 via Binutils wrote:
> Is there some method let the linker to relink this executable file to do such job ?
No, not unless you have the relocatable objects and libraries
available that created this executable.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-18 6:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 7:35 Can I relink a executable to collapse multiple sections into one 陈云星
2021-05-17 16:36 ` Nick Clifton
2021-05-17 16:49 ` 陈云星
2021-05-18 6:29 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).