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.
This commit is contained in:
Augustin Cavalier 2018-11-21 22:02:06 -05:00
parent 2e15a0f6b9
commit a87c7773e8
2 changed files with 13 additions and 6 deletions

View File

@ -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 ;

View File

@ -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)
}