Skip to content

Commit

Permalink
Enable pdb for clang
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Nov 26, 2023
1 parent f372a4d commit 5ffec8a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion far/makefile_gcc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 19 additions & 9 deletions far/makefile_gcc_common
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ CFLAGS += \
endif # USE_LTO

LNKFLAGS += \
-Xlinker --gc-sections
-Xlinker --gc-sections \

endif # DEBUG
# Configuration-specific flags end
Expand All @@ -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)
Expand All @@ -216,33 +221,38 @@ CLANG_FLAGS = \
-target $(CLANG_TARGET) \
-Wno-unknown-warning-option \
-fms-extensions \
-fno-emulated-tls \
-Weverything \
$(PDB_FLAGS)

CFLAGS += $(CLANG_FLAGS)

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))
Expand Down

0 comments on commit 5ffec8a

Please sign in to comment.