git: 313b30b6ab1f - releng/13.3 - lld: work around elftoolchain bug which causes bloated RISCV binaries
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Feb 2024 18:10:51 UTC
The branch releng/13.3 has been updated by karels:
URL: https://cgit.FreeBSD.org/src/commit/?id=313b30b6ab1f0c9549d29129f2fb6b1e31ef5f0f
commit 313b30b6ab1f0c9549d29129f2fb6b1e31ef5f0f
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-02-14 19:41:09 +0000
Commit: Mike Karels <karels@FreeBSD.org>
CommitDate: 2024-02-15 18:09:56 +0000
lld: work around elftoolchain bug which causes bloated RISCV binaries
The elftoolchain strip(1) command appears to have trouble with the new
.riscv.attributes sections being added by lld 17 to RISCV binaries. This
causes huge 'holes' in the files, making them larger than necessary.
Since nothing in the base system uses the new section yet, patch lld to
leave it out for now.
Direct commit to stable/13, since this intended to go into the 13.3
release, while the elftoolchain bug is being investigated.
Reported by: karels
Submitted by: jrtc27
Approved by: re (cperciva)
(cherry picked from commit 42ceb92e6a544fa0956eb660b3c16e38189acf20)
---
contrib/llvm-project/lld/ELF/Writer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/contrib/llvm-project/lld/ELF/Writer.cpp b/contrib/llvm-project/lld/ELF/Writer.cpp
index 368c9aabceae..850a6bb49721 100644
--- a/contrib/llvm-project/lld/ELF/Writer.cpp
+++ b/contrib/llvm-project/lld/ELF/Writer.cpp
@@ -2044,9 +2044,13 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
addPhdrForSection(part, SHT_MIPS_OPTIONS, PT_MIPS_OPTIONS, PF_R);
addPhdrForSection(part, SHT_MIPS_ABIFLAGS, PT_MIPS_ABIFLAGS, PF_R);
}
+#if 0
+ // XXX: This stops elftoolchain strip adjusting .riscv.attributes,
+ // leaving large holes in binaries.
if (config->emachine == EM_RISCV)
addPhdrForSection(part, SHT_RISCV_ATTRIBUTES, PT_RISCV_ATTRIBUTES,
PF_R);
+#endif
}
Out::programHeaders->size = sizeof(Elf_Phdr) * mainPart->phdrs.size();