This is the mail archive of the binutils@sourceware.org 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]

Re: Linker plugin API.


I moved the new statement and bfd section after section ".note.ABI-tag".
Now I have correct vma and offset, but I can't setup a content.
If I use the bfd_set_section_contents API function, then I get an 
incorrect output file.
If I set the contents pointer (in bfd_section) to my buffer, then the 
output section will be filled with zero. And the output file can be 
executed correctly.
How to setup a content? What am I missing?

On 05/21/2018 11:40 AM, Oleg Ogurtsov wrote:
> I maked the new output statement and bfd section in ldlang.c inside 
> lang_place_orphans().
> The section is created with flags (ALLOC, LOAD, !RELOC, READ ONLY, 
> HAS_CONTENTS, !NEVER_LOAD, !IS_COMMON, !MERGE, !SEC_GROUP, 
> !LINKER_HAS_INPUT), but has wrong VMA and offset in output file.
> What am I missing?
> 
> On 04/23/2018 07:13 PM, Cary Coutant wrote:
>>> Is it possible to add/change/delete ELF Note sections from the linker
>>> plugin?
>>> I have object files with PT_NOTE sections and  non-standard fields. The
>>> linker add fields from all object files to the output file.
>>> I want to process fields and get one result field for output file. Is it
>>> possible from plugin?
>>> Where it is better to make such processing?
>>> I would be grateful for the help.
>>
>> The plugin API currently doesn't have any way to do something like
>> this. It's theoretically possible, but it would take some pretty deep
>> hooks in the linker to add plugin support for section merging and
>> rewriting like this.
>>
>> If you need it done at link time, I would suggest using a new
>> vendor-specific section type instead of SHT_NOTE, and you can add
>> built-in support to the linker for that section type. I'd prefer to
>> discourage the overuse of SHT_NOTE sections for information that is
>> more than mere notes.
>>
>> -cary

Best regards,
Oleg Ogurtsov.


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