From a87c7773e8bbb2e3e6f833531699b8ac8b2db7e0 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 21 Nov 2018 22:02:06 -0500 Subject: [PATCH] EFI: Make the loader build under Clang. Clang doesn't support -maccumulate-outgoing-args, -nostartfiles is not needed in LDFLAGS (and lld doesn't know about it anyway), and Clang uses .dynstr so we need to copy it also. --- build/jam/ArchitectureRules | 10 +++++++--- src/system/boot/Jamfile | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index c426850f27..37d7baeff6 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -442,8 +442,12 @@ rule KernelArchitectureSetup architecture HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ; # Just slip these in here as well for EFI (if used) - HAIKU_BOOT_EFI_CCFLAGS += -mno-red-zone -maccumulate-outgoing-args ; - HAIKU_BOOT_EFI_C++FLAGS += -mno-red-zone -maccumulate-outgoing-args ; + HAIKU_BOOT_EFI_CCFLAGS += -mno-red-zone ; + HAIKU_BOOT_EFI_C++FLAGS += -mno-red-zone ; + if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 { + HAIKU_BOOT_EFI_CCFLAGS += -maccumulate-outgoing-args ; + HAIKU_BOOT_EFI_C++FLAGS += -maccumulate-outgoing-args ; + } if x86 in $(HAIKU_ARCHS[2-]) || x86_gcc2 in $(HAIKU_ARCHS[2-]) { Echo "Enable kernel ia32 compatibility" ; @@ -463,7 +467,7 @@ rule KernelArchitectureSetup architecture HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fpic -fno-stack-protector -fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main ; HAIKU_BOOT_$(bootTarget:U)_LDFLAGS = -Bstatic -Bsymbolic - -nostdlib -znocombreloc -nostartfiles -no-undefined ; + -nostdlib -znocombreloc -no-undefined ; case bios_ia32 : # bios_ia32 is non-PIC HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -march=pentium ; diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index 7a6164963c..a02a02533b 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -67,10 +67,13 @@ rule BuildEFILoader { MakeLocateDebug $(efiLoader) ; } -actions BuildEFILoader { +actions BuildEFILoader +{ rm -f $(1) - $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ - -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $(2) $(1) + $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -j .text -j .sdata -j .data \ + -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc -j .dynstr \ + --input-target=efi-app-x86_64 --output-target=efi-app-x86_64 \ + $(2) $(1) }