[llvm] Add support to YAML for program headers with content. (PR #192364)

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 11:06:45 PDT 2026


clayborg wrote:

> Are you aware of the concept of "Fill" sections in yaml2obj? These were implemented to provide this kind of functionality, i.e. data in the ELF that is not covered by Section or other entries, including segments (or even parts of segments). They work as entries in the Section list, with a type field of "Fill" instead of "SHT_whatever", but no section header table entry is generated for them. They can still be specified by FirstSec/LastSec, allowing you to either have a single Fill with the whole content of the segment specified (thus creating a segment with content but no sections) or interspersed with regular sections (allowing you to specify data in between sections within a segment).

Interesting. Is there a way to manually generate these right now? Are there any example YAML files in test that show this?

> I don't think Fills have been hooked up to obj2yaml, so you'd need to implement that somehow (and for completeness, I'd like that to work independently of program headers, so that they can be used to cover data in the ELF that is not covered by segments or sections).

What would a user want to do? Fill sections are not discoverable, though they allow you to do what you stated: add multiple contents in a program header along with valid sections. 
> 
> That all being said, I can see the appeal for a Content field in a program header entry. I'm just a little concerned about having two methods to do the same thing, risking conflict.

I think this way is much more discoverable and makes more sense. I would have no idea that you can create a Fill section. Are there docs somewhere the detail this or is it a hidden feature. The current method will error out if someone tries to mix section content with program header content, so both can work together and it should error out if users create program header content and any section content. That being said, if there is a way to create the core files that I want from YAML without having to modify obj2yaml and yaml2obj I can just go that route and make it work.

Let me know if you think this method is worth it.


https://github.com/llvm/llvm-project/pull/192364


More information about the llvm-commits mailing list