llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.02k stars 11.96k forks source link

[lld][ELF] Support the `I` attribute for memory regions #108153

Open petrhosek opened 2 months ago

petrhosek commented 2 months ago

The I attribute (and its alias L) is used for initialized sections and is regularly used in embedded projects, but lld doesn't currently support this attribute which complicates porting.

llvmbot commented 2 months ago

@llvm/issue-subscribers-lld-elf

Author: Petr Hosek (petrhosek)

The `I` attribute (and its alias `L`) is used for initialized sections and is regularly used in embedded projects, but lld doesn't currently support this attribute which complicates porting.
smithp35 commented 2 months ago

The GNU documentation isn't particularly helpful here: https://sourceware.org/binutils/docs/ld/MEMORY.html

‘I’
Initialized section

‘L’
Same as ‘I’

I think that this is refering to SEC_LOAD in BFD. https://ftp.gnu.org/old-gnu/Manuals/bfd-2.9.1/html_node/bfd_13.html

        /* Tells the OS to load the section from the file when loading.
           This is clear for a .bss section. */
#define SEC_LOAD       0x002

My interpretation of that is I or L means SHT_PROGBITS but not SHT_NOBITS.