diff options
| author | Peter Smith <peter.smith@arm.com> | 2025-02-05 19:04:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 14:04:21 -0500 |
| commit | ba476d0b83dc8a4bbf066dc02a0f73ded27114f0 (patch) | |
| tree | 835e94073bb520d42422f893057e66c019bf1d37 /lld/ELF/InputFiles.cpp | |
| parent | 46c484524454b20ab1c08bf289f140025739dc5f (diff) | |
[LLD][ELF][AArch64] Discard .ARM.attributes sections (#125838)
LLVM has started to emit AArch64 build attributes sections called
.ARM.attributes. LLD does not yet have support for these so they are
accumulating in the ELF output. As the first part of that support
discard all the .ARM.attributes sections. This can be built upon by the
full implementation in LLD.
The build attributes specification only defines build attributes for
relocatable objects. The intention for LLD is that files of type ET_EXEC
and ET_SHARED will not have a build attributes in the output. A
relocatable link with -r will need a merged build attributes, but until
the merge is implemented it is better to discard.
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 16943c484d96..d43de8ce6dfe 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -639,6 +639,13 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) { } break; case EM_AARCH64: + // FIXME: BuildAttributes have been implemented in llvm, but not yet in + // lld. Remove the section so that it does not accumulate in the output + // file. When support is implemented we expect not to output a build + // attributes section in files of type ET_EXEC or ET_SHARED, but ld -r + // ouptut will need a single merged attributes section. + if (sec.sh_type == SHT_AARCH64_ATTRIBUTES) + sections[i] = &InputSection::discarded; // Producing a static binary with MTE globals is not currently supported, // remove all SHT_AARCH64_MEMTAG_GLOBALS_STATIC sections as they're unused // medatada, and we don't want them to end up in the output file for |
