New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lld/ELF: Report errors for certain unknown section types #84812
Comments
@llvm/issue-subscribers-lld-elf Author: Fangrui Song (MaskRay)
From https://maskray.me/blog/2024-03-09-a-compact-relocation-format-for-elf#linker-notes
GNU ld allows certain unknown section types:
but reports errors and stops linking for others (unless
I have a prototype for a new relocation format (RELLEB). Linking a.o and b.o with unpatched lld and gold create an output file with unrelocated |
Unknown section sections may require special linking rules, and rejecting such sections for older linkers may be desired. For example, if we introduce a new section type to replace a control structure (e.g. relocations), it would be nice for older linkers to reject the new section type. GNU ld allows certain unknown section types: * [SHT_LOUSER,SHT_HIUSER] and non-SHF_ALLOC * [SHT_LOOS,SHT_HIOS] and non-SHF_OS_NONCONFORMING but reports errors and stops linking for others (unless --no-warn-mismatch is specified). Port its behavior. For convenience, we additionally allow all [SHT_LOPROC,SHT_HIPROC] types so that we don't have to hard code all known types for each processor. Close #84812
Unknown section sections may require special linking rules, and rejecting such sections for older linkers may be desired. For example, if we introduce a new section type to replace a control structure (e.g. relocations), it would be nice for older linkers to reject the new section type. GNU ld allows certain unknown section types: * [SHT_LOUSER,SHT_HIUSER] and non-SHF_ALLOC * [SHT_LOOS,SHT_HIOS] and non-SHF_OS_NONCONFORMING but reports errors and stops linking for others (unless --no-warn-mismatch is specified). Port its behavior. For convenience, we additionally allow all [SHT_LOPROC,SHT_HIPROC] types so that we don't have to hard code all known types for each processor. Close llvm#84812
From https://maskray.me/blog/2024-03-09-a-compact-relocation-format-for-elf#linker-notes
GNU ld allows certain unknown section types:
[SHT_LOUSER,SHT_HIUSER]
and non-SHF_ALLOC
[SHT_LOOS,SHT_HIOS]
and non-SHF_OS_NONCONFORMING
but reports errors and stops linking for others (unless
--no-warn-mismatch
is specified).When linking a relocatable file using
SHT_RELLEB
, you might encounter errors like the following:I have a prototype for a new relocation format (RELLEB). Linking a.o and b.o with unpatched lld and gold create an output file with unrelocated
.text
and will crash at run-time.The text was updated successfully, but these errors were encountered: