From e086022b77b931caa4490047cbc0db5c875f4522 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 25 Jun 2021 23:48:41 -0700 Subject: [PATCH] build: use DWARFv4 explicitly for IDA compatibility with debug elfs --- Makefile | 1 + fusee/fusee-mtc/Makefile | 5 +++-- fusee/fusee-primary/Makefile | 5 +++-- fusee/fusee-primary/fusee-primary-main/Makefile | 5 +++-- fusee/fusee-secondary/Makefile | 5 +++-- libraries/config/common.mk | 2 +- libraries/config/templates/exosphere.mk | 2 +- libraries/config/templates/mesosphere.mk | 2 +- sept/sept-primary/Makefile | 5 +++-- sept/sept-secondary/Makefile | 5 +++-- sept/sept-secondary/key_derivation/Makefile | 5 +++-- thermosphere/Makefile | 5 +++-- troposphere/daybreak/Makefile | 6 +++--- troposphere/reboot_to_payload/Makefile | 6 +++--- 14 files changed, 34 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 2d248175a..3921f75d7 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ libraries: clean: $(MAKE) -C fusee clean + $(MAKE) -C emummc clean rm -rf out dist-no-debug: all diff --git a/fusee/fusee-mtc/Makefile b/fusee/fusee-mtc/Makefile index f96fca1f8..d7977ff45 100644 --- a/fusee/fusee-mtc/Makefile +++ b/fusee/fusee-mtc/Makefile @@ -39,6 +39,7 @@ DEFINES := -D__BPMP__ -DFUSEE_MTC_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" - CFLAGS := \ -g \ + -gdwarf-4 \ -O2 \ -fomit-frame-pointer \ -ffunction-sections \ @@ -56,8 +57,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/fusee/fusee-primary/Makefile b/fusee/fusee-primary/Makefile index 8395aa47a..8e203df39 100644 --- a/fusee/fusee-primary/Makefile +++ b/fusee/fusee-primary/Makefile @@ -46,6 +46,7 @@ DEFINES := -D__BPMP__ -DFUSEE_STAGE1_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\ CFLAGS := \ -g \ + -gdwarf-4 \ -O2 \ -fomit-frame-pointer \ -ffunction-sections \ @@ -63,8 +64,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/fusee/fusee-primary/fusee-primary-main/Makefile b/fusee/fusee-primary/fusee-primary-main/Makefile index 333578442..7ca99474b 100644 --- a/fusee/fusee-primary/fusee-primary-main/Makefile +++ b/fusee/fusee-primary/fusee-primary-main/Makefile @@ -39,6 +39,7 @@ DEFINES := -D__BPMP__ -DFUSEE_STAGE1_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\ CFLAGS := \ -g \ + -gdwarf-4 \ -O2 \ -fomit-frame-pointer \ -ffunction-sections \ @@ -56,8 +57,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/fusee/fusee-secondary/Makefile b/fusee/fusee-secondary/Makefile index a4366726a..818644d4a 100644 --- a/fusee/fusee-secondary/Makefile +++ b/fusee/fusee-secondary/Makefile @@ -48,6 +48,7 @@ DEFINES := -D__BPMP__ -DFUSEE_STAGE2_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\ CFLAGS := \ -g \ + -gdwarf-4 \ -O2 \ -fomit-frame-pointer \ -ffunction-sections \ @@ -65,8 +66,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) $(INCLUDE) $(DEFINES) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) $(INCLUDE) $(DEFINES) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/libraries/config/common.mk b/libraries/config/common.mk index 2146502c4..9e6448df9 100644 --- a/libraries/config/common.mk +++ b/libraries/config/common.mk @@ -18,7 +18,7 @@ endif ATMOSPHERE_BUILD_SETTINGS ?= export ATMOSPHERE_DEFINES := -DATMOSPHERE -export ATMOSPHERE_SETTINGS := -fPIE -g $(ATMOSPHERE_BUILD_SETTINGS) +export ATMOSPHERE_SETTINGS := -fPIE -g -gdwarf-4 $(ATMOSPHERE_BUILD_SETTINGS) export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \ -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector \ -Wno-format-truncation -Wno-format-zero-length -Wno-stringop-truncation diff --git a/libraries/config/templates/exosphere.mk b/libraries/config/templates/exosphere.mk index d597c390c..91d3ce84d 100644 --- a/libraries/config/templates/exosphere.mk +++ b/libraries/config/templates/exosphere.mk @@ -26,7 +26,7 @@ CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) endif -export LDFLAGS = -specs=$(TOPDIR)/$(notdir $(TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -fno-rtti -fno-use-cxa-atexit -nostdlib -nostartfiles -g $(SETTINGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now +export LDFLAGS = -specs=$(TOPDIR)/$(notdir $(TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -fno-rtti -fno-use-cxa-atexit -nostdlib -nostartfiles -g -gdwarf-4 $(SETTINGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \ -Wl,--wrap,__cxa_throw \ diff --git a/libraries/config/templates/mesosphere.mk b/libraries/config/templates/mesosphere.mk index 142dfc852..c55a23dbf 100644 --- a/libraries/config/templates/mesosphere.mk +++ b/libraries/config/templates/mesosphere.mk @@ -12,7 +12,7 @@ export CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE) export CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit export ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE) -export LDFLAGS = -specs=$(TOPDIR)/$(notdir $(TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -nostdlib -nostartfiles -g $(SETTINGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now +export LDFLAGS = -specs=$(TOPDIR)/$(notdir $(TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -nostdlib -nostartfiles -g -gdwarf-4 $(SETTINGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \ -Wl,--wrap,__cxa_throw \ diff --git a/sept/sept-primary/Makefile b/sept/sept-primary/Makefile index f074d1d9c..2cdf8394e 100644 --- a/sept/sept-primary/Makefile +++ b/sept/sept-primary/Makefile @@ -39,6 +39,7 @@ DEFINES := -D__BPMP__ -DSEPT_STAGE1_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" CFLAGS := \ -g \ + -gdwarf-4 \ -Os \ -fomit-frame-pointer \ -ffunction-sections \ @@ -56,8 +57,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/sept/sept-secondary/Makefile b/sept/sept-secondary/Makefile index 0785ad708..49ee8a605 100644 --- a/sept/sept-secondary/Makefile +++ b/sept/sept-secondary/Makefile @@ -39,6 +39,7 @@ DEFINES := -D__BPMP__ -DSEPT_STAGE2_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" CFLAGS := \ -g \ + -gdwarf-4 \ -O2 \ -fomit-frame-pointer \ -ffunction-sections \ @@ -56,8 +57,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/sept/sept-secondary/key_derivation/Makefile b/sept/sept-secondary/key_derivation/Makefile index 15aeea814..89915e5c4 100644 --- a/sept/sept-secondary/key_derivation/Makefile +++ b/sept/sept-secondary/key_derivation/Makefile @@ -29,6 +29,7 @@ ARCH := -march=armv8-a -mtune=cortex-a57 -mgeneral-regs-only #<- important CFLAGS := \ -g \ + -gdwarf-4 \ -Os \ -ffunction-sections \ -fdata-sections \ @@ -46,8 +47,8 @@ CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/thermosphere/Makefile b/thermosphere/Makefile index 7f2634bbe..8ee2abe28 100644 --- a/thermosphere/Makefile +++ b/thermosphere/Makefile @@ -37,6 +37,7 @@ DEFINES := -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AM CFLAGS := \ -g \ + -gdwarf-4 \ -O2 \ -ffunction-sections \ -fdata-sections \ @@ -52,8 +53,8 @@ CFLAGS += $(INCLUDE) -D__CCPLEX__ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(TOPDIR)/linker.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(TOPDIR)/linker.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := diff --git a/troposphere/daybreak/Makefile b/troposphere/daybreak/Makefile index 8753aca8f..0e7a3fa9f 100644 --- a/troposphere/daybreak/Makefile +++ b/troposphere/daybreak/Makefile @@ -56,15 +56,15 @@ APP_VERSION := 1.0.0 #--------------------------------------------------------------------------------- ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -CFLAGS := -g -Wall -O2 -ffunction-sections \ +CFLAGS := -g -gdwarf-4 -Wall -O2 -ffunction-sections \ $(ARCH) $(DEFINES) CFLAGS += $(INCLUDE) -D__SWITCH__ CXXFLAGS := $(CFLAGS) -std=gnu++17 -fno-exceptions -fno-rtti -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := -lnanovg -ldeko3d -lnx diff --git a/troposphere/reboot_to_payload/Makefile b/troposphere/reboot_to_payload/Makefile index 410dae264..e6e3e1c1e 100644 --- a/troposphere/reboot_to_payload/Makefile +++ b/troposphere/reboot_to_payload/Makefile @@ -46,15 +46,15 @@ APP_VERSION := 1.0.0 #--------------------------------------------------------------------------------- ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -CFLAGS := -g -Wall -O2 -ffunction-sections \ +CFLAGS := -g -gdwarf-4 -Wall -O2 -ffunction-sections \ $(ARCH) $(DEFINES) CFLAGS += $(INCLUDE) -D__SWITCH__ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +ASFLAGS := -g -gdwarf-4 $(ARCH) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g -gdwarf-4 $(ARCH) -Wl,-Map,$(notdir $*.map) LIBS := -lnx