This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems adding new section


I am encountering the following problem while trying to add a new-section at some specified virtual address to a elf32-i386 file using libbfd:
We would like the SEC_ALLOC and SEC_LOAD flags to be set in particular, which would mean that the section should be loaded in memory at runtime and the section should be read from the file. The problem is that for loadable sections libbfd needs to map sections to segments and if you try to add a new section at some vma then it gives an error that the section is not mapped to any segment. What all needs to be set for adding a section to a file with the above requirements. We also want to make sure that we do not overwrite any section or program headers of the input file.
I have tried to use objcopy for this purpose as objcopy --add-section new_Section=file --set-section-flags=alloc,load obj1 obj2.
The above gives an error saying new_Section not in a segment.What else needs to be done?


Avijit


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]