Skip to contentSkip to conversation

Makefile: efi: preserve .dynstr section for LLVM objcopy compatibility

PATCH In review Colton Lewis 2 participants 3 messages Jul 16 – Jul 21

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: efi: preserve .dynstr section for LLVM objcopy compatibility

When building EFI binaries with llvm-objcopy, keeping sections with '-j .dynamic -j .dynsym' without '-j .dynstr' fails with:

llvm-objcopy: error: 'arm/spinlock-test.so': section '.dynstr' cannot be removed because it is referenced by the section '.dynamic'

Include '.dynstr' in the list of preserved sections across arm/Makefile.common, riscv/Makefile, and x86/Makefile.common so that EFI binaries can be built cleanly using llvm-objcopy.

Assisted-by Gemini:gemini-next
---
 arm/Makefile.common | 2 +-
 riscv/Makefile      | 2 +-
 x86/Makefile.common | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arm/Makefile.common +1 -1
index a5d97bcf..550ec0a1 100644
@@ -88,7 +88,7 @@ ifeq ($(CONFIG_EFI),y)
 	$(OBJCOPY) --strip-debug $^
 	$(OBJCOPY) [email protected] $^
 	$(OBJCOPY) \
-		-j .text -j .sdata -j .data -j .dynamic -j .dynsym \
+		-j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .dynstr \
 		-j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
 		-j .reloc \
 		-O binary $^ $@
riscv/Makefile +1 -1
index 64720c38..348a30a7 100644
@@ -123,7 +123,7 @@ cflatobjs += lib/efi.o
 	$(OBJCOPY) --strip-debug $^
 	$(OBJCOPY) [email protected] $^
 	$(OBJCOPY) \
-		-j .text -j .sdata -j .data -j .rodata -j .dynamic -j .dynsym \
+		-j .text -j .sdata -j .data -j .rodata -j .dynamic -j .dynsym -j .dynstr \
 		-j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
 		-j .reloc \
 		-O binary $^ $@
x86/Makefile.common +1 -1
index a251dd71..054e2391 100644
@@ -58,7 +58,7 @@ ifeq ($(CONFIG_EFI),y)
 	$(OBJCOPY) --strip-debug $^
 	$(OBJCOPY) [email protected] $^
 	$(OBJCOPY) \
-		-j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
+		-j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .dynstr -j .rel \
 		-j .rela -j .reloc -S --target=$(FORMAT) $< $@
 	@chmod a-x $@
 else
Signature · 1 line
2.55.0.229.g6434b31f56-goog
#1 lore raw
Quoted 10 lines · Colton Lewis

When building EFI binaries with llvm-objcopy, keeping sections with '-j .dynamic -j .dynsym' without '-j .dynstr' fails with:

llvm-objcopy: error: 'arm/spinlock-test.so': section '.dynstr' cannot be removed because it is referenced by the section '.dynamic'

Include '.dynstr' in the list of preserved sections across arm/Makefile.common, riscv/Makefile, and x86/Makefile.common so that EFI binaries can be built cleanly using llvm-objcopy.

Quoted 8 lines
Assisted-by Gemini:gemini-next
---
 arm/Makefile.common | 2 +-
 riscv/Makefile      | 2 +-
 x86/Makefile.common | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Pushed.

Thanks,
drew

#2 lore raw

Thanks Andrew!

Quoted 24 lines · Andrew Jones
Quoted 10 lines · Colton Lewis

When building EFI binaries with llvm-objcopy, keeping sections with '-j .dynamic -j .dynsym' without '-j .dynstr' fails with:

llvm-objcopy: error: 'arm/spinlock-test.so': section '.dynstr' cannot be removed because it is referenced by the section '.dynamic'

Include '.dynstr' in the list of preserved sections across arm/Makefile.common, riscv/Makefile, and x86/Makefile.common so that EFI binaries can be built cleanly using llvm-objcopy.

Quoted 7 lines
Assisted-by Gemini:gemini-next
---
  arm/Makefile.common | 2 +-
  riscv/Makefile      | 2 +-
  x86/Makefile.common | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)

Pushed.

Thanks,
drew