Adding a custom section to ELF file

Hi all,

how can I add my own section to the ELF file to write some target-specific parameters?
Is there any sample in the LLVM examples?

Cheers,

ES

ES, what are you interested in doing with your ELF extensions? Are these extensions to existing, supported section types? EG, adding “.EStext” as a text section. Take a look at ~/llvm/lib/MC/MCParser/ELFAsmParser.cpp. This is where you add the logic to the parsers. If what you’re adding is a relatively standard section, you can copy what is there and change the section parser text.

cheers
john

John D. Leidel

Hi all,

how can I add my own section to the ELF file to write some target-specific
parameters?
Is there any sample in the LLVM examples?

AMDGPU backend does this. grep the code for 'SwitchSection' and take a
look at AMDGPUHSATargetObjectFile.cpp

-Tom