ArchitectureRules: Bootloader rules cleanup.

* Move -fPIC to ccBaseFlags, as we don't want it in ASFLAGS.
 * Remove -fPIC from BOOT_CCFLAGS, as we never want it in there.
 * Move EFI flags to the actual EFI setup location.
This commit is contained in:
Augustin Cavalier
2018-11-23 00:06:23 -05:00
parent 44fc903a8f
commit 58b7901304
+28 -11
View File
@@ -53,7 +53,7 @@ rule ArchitectureSetup architecture
}
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
# TODO: These should be included in Clang's compiler specs.
archFlags += -fPIC ;
ccBaseFlags += -fPIC ;
HAIKU_LINKFLAGS_$(architecture) += -shared ;
}
ccBaseFlags += $(archFlags) ;
@@ -395,6 +395,25 @@ rule KernelArchitectureSetup architecture
HAIKU_BOOT_LINKFLAGS = ;
HAIKU_BOOT_LDFLAGS = -Bstatic ;
# Remove -fPIC and other unwanted options from the BOOT flags (they are sometimes
# added to force PIC in general.)
local fixedBootCCFlags ;
local fixedBootC++Flags ;
for flag in $(HAIKU_BOOT_CCFLAGS) {
if $(flag) = "-fpic" || $(flag) = "-fPIC" {
continue ;
}
fixedBootCCFlags += $(flag) ;
}
for flag in $(HAIKU_BOOT_C++FLAGS) {
if $(flag) = "-fpic" || $(flag) = "-fPIC" {
continue ;
}
fixedBootC++Flags += $(flag) ;
}
HAIKU_BOOT_CCFLAGS = $(fixedBootCCFlags) ;
HAIKU_BOOT_C++FLAGS = $(fixedBootC++Flags) ;
# Any special kernel base addresses
if $(HAIKU_BOOT_LOADER_BASE) {
HAIKU_BOOT_LDFLAGS +=
@@ -439,14 +458,6 @@ rule KernelArchitectureSetup architecture
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
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 ;
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" ;
HAIKU_KERNEL_DEFINES += _COMPAT_MODE ;
@@ -461,9 +472,15 @@ rule KernelArchitectureSetup architecture
case efi :
# efi bootloader is PIC
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fpic -fno-stack-protector
-fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main ;
-fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main
-mno-red-zone ;
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fpic -fno-stack-protector
-fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main ;
-fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main
-mno-red-zone ;
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -maccumulate-outgoing-args ;
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -maccumulate-outgoing-args ;
}
HAIKU_BOOT_$(bootTarget:U)_LDFLAGS = -Bstatic -Bsymbolic
-nostdlib -znocombreloc -no-undefined ;
case bios_ia32 :