Quote:
Originally Posted by arvind.ayyangar
Hi all,
I am trying to add an additional code segment to an existing binary using the objcopy utility (--add-section). However, even after changing the flags of the section (code,alloc,etc), it does not add an entry to the program header and so the section is not loaded when the binary is executed.
While setting the section flags, i get a bfd warning..
BFD: stdiJ3Fi: warning: allocated section `.text.new' not in segment
How can I add a new text segment to an existing ELF binary ?
|
You said itself - you wanted to add SEGMENT , so --add-section is not suited.
ELF file as two "views" - one is sections and them used by linker in the link time and another - segments, them used by run-time loader (ld-linux) in the run-time.
I think program like elfsh (or something like) that can help you.
But what are you trying to accomplish ?
Sure adding additional segment is tool, but not a whole purpose ?