Reputation: 13436
I'm curious about how does a linker link segments with same type but different flags from different object files. E.g. we now have two ELF object files foo.o
and bar.o
, both of which have a .text
segment (code segment). However, .text
segment in foo.o
is write-able while that in bar.o
is not. In this case, how will the linker link these two segments? How will the linker set the flag of the .text
segment in the linked file?
Thanks and Best regards!
Upvotes: 0
Views: 254
Reputation: 213897
How will the linker set the flag of the .text segment in the linked file?
There is no .text
segment in the linked file: the .text
section is put into one of the LOAD
segments.
The linker can choose what to do.
.text
sections with different flags, and put them into multiple LOAD
segments..text
sections from foo.o
and bar.o
into a single .text
section, and make it writableUpvotes: 1