diff --git a/far/makefile_gcc b/far/makefile_gcc index b8d2a3f42a..8555e53d46 100644 --- a/far/makefile_gcc +++ b/far/makefile_gcc @@ -247,10 +247,10 @@ $(EXEFULLNAME): $(BOOTSTRAPDIR)copyright.inc $(BOOTSTRAPDIR)farversion.inc $(OBJ ifdef USE_OBJDUMP_MAPS @echo Generating map file objdump --syms --demangle $(EXEFULLNAME) > $(MAP) +endif ifndef DEBUG strip $(EXEFULLNAME) endif -endif ifdef ENABLE_TESTS @echo Running unit tests $@ /service:test diff --git a/far/makefile_gcc_common b/far/makefile_gcc_common index f139f47cb6..98b2ba8fc8 100644 --- a/far/makefile_gcc_common +++ b/far/makefile_gcc_common @@ -180,7 +180,7 @@ CFLAGS += \ endif # USE_LTO LNKFLAGS += \ - -Xlinker --gc-sections + -Xlinker --gc-sections \ endif # DEBUG # Configuration-specific flags end @@ -199,11 +199,16 @@ endif # Platform-specific flags end # Compiler-specific flags +PDB_FLAGS = \ + -g \ + -gcodeview \ + LLD_FLAGS = \ -fuse-ld=lld \ -Xlinker --allow-multiple-definition \ -Xlinker -Map \ -Xlinker $(MAP) \ + -Xlinker --pdb= \ ifdef CLANG ifeq ($(DIRBIT), 32) @@ -216,7 +221,9 @@ CLANG_FLAGS = \ -target $(CLANG_TARGET) \ -Wno-unknown-warning-option \ -fms-extensions \ + -fno-emulated-tls \ -Weverything \ + $(PDB_FLAGS) CFLAGS += $(CLANG_FLAGS) @@ -224,25 +231,28 @@ LNKFLAGS += \ $(CLANG_FLAGS) \ $(LLD_FLAGS) \ -ifndef DEBUG -LNKFLAGS += \ - -Xlinker --strip-all \ - -endif - else +ifndef USE_LLD # LD map files are unusable for tracing, # so we keep the symbols, objdump them and strip manually. # LLD, on the contrary, generates good maps and doesn't need this trickery. USE_OBJDUMP_MAPS=1 endif +endif # Compiler-specific flags end -ifdef USE_LLD +ifndef USE_OBJDUMP_MAPS +ifdef DEBUG LNKFLAGS += \ - $(LLD_FLAGS) \ + -Xlinker --strip-all \ endif +endif + +ifdef USE_LLD +CFLAGS += $(PDB_FLAGS) +LNKFLAGS += $(LLD_FLAGS) +endif ifeq ($(findstring ----,---$(strip $(MAKEFLAGS))-),) MK_FLAGS := -$(strip $(MAKEFLAGS))