Skip to content

Commit 00cf900

Browse files
authored
fix: disable stripping of debug symbols in debug mode (#4)
1 parent e5ec75c commit 00cf900

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

yosys/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ if(${CMAKE_GENERATOR} STREQUAL "Ninja")
1414
set(CURRENT_CPPFLAGS "-w")
1515
endif()
1616

17+
set(ENABLE_DEBUG $<STREQUAL:$<UPPER_CASE:${CMAKE_BUILD_TYPE}>,DEBUG>)
18+
1719
# how to build the result of the library
1820
add_custom_command(OUTPUT yosys-bin
1921
COMMAND ${MAKE_PROGRAM} ENABLE_ABC=0
22+
ENABLE_DEBUG=${ENABLE_DEBUG}
2023
# -C ${CMAKE_CURRENT_BINARY_DIR}
2124
# -f ${CMAKE_CURRENT_SOURCE_DIR}/Makefile #(out-of-tree) build directory
2225
PREFIX=${CMAKE_BINARY_DIR}
2326
-j${CUSTOM_BUILD_PARALLEL_LEVEL}
2427
> /dev/null
2528

2629
COMMAND ${MAKE_PROGRAM} install ENABLE_ABC=0
30+
ENABLE_DEBUG=${ENABLE_DEBUG}
2731
# -C ${CMAKE_CURRENT_BINARY_DIR}
2832
# -f ${CMAKE_CURRENT_SOURCE_DIR}/Makefile #(out-of-tree) build directory
2933
PREFIX=${CMAKE_BINARY_DIR}

yosys/Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ YOSYS_VER := 0.32
147147
# tarballs generated with git-archive(1) using .gitattributes. The git repo
148148
# will have this file in its unexpanded form tough, in which case we fall
149149
# back to calling git directly.
150-
TARBALL_GIT_REV := $(shell cat $(YOSYS_SRC)/.gitcommit)
151-
ifeq ($(TARBALL_GIT_REV),$$Format:%h$$)
152-
GIT_REV := $(shell GIT_DIR=$(YOSYS_SRC)/.git git rev-parse --short=9 HEAD || echo UNKNOWN)
153-
else
154-
GIT_REV := $(TARBALL_GIT_REV)
155-
endif
156-
150+
# TARBALL_GIT_REV := $(shell cat $(YOSYS_SRC)/.gitcommit)
151+
# ifeq ($(TARBALL_GIT_REV),$$Format:%h$$)
152+
# GIT_REV := $(shell GIT_DIR=$(YOSYS_SRC)/.git git rev-parse --short=9 HEAD || echo UNKNOWN)
153+
# else
154+
# GIT_REV := $(TARBALL_GIT_REV)
155+
# endif
156+
GIT_REV := UNKNOWN
157157
OBJS = kernel/version_$(GIT_REV).o
158158

159159
bumpversion:
@@ -919,6 +919,8 @@ clean-unit-test:
919919
install: $(TARGETS) $(EXTRA_TARGETS)
920920
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR)
921921
$(INSTALL_SUDO) cp $(filter-out libyosys.so,$(TARGETS)) $(DESTDIR)$(BINDIR)
922+
# only strip if not debugging
923+
ifneq ($(ENABLE_DEBUG),1)
922924
ifneq ($(filter $(PROGRAM_PREFIX)yosys,$(TARGETS)),)
923925
$(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys
924926
endif
@@ -927,6 +929,7 @@ ifneq ($(filter $(PROGRAM_PREFIX)yosys-abc,$(TARGETS)),)
927929
endif
928930
ifneq ($(filter $(PROGRAM_PREFIX)yosys-filterlib,$(TARGETS)),)
929931
$(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys-filterlib
932+
endif
930933
endif
931934
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(DATDIR)
932935
$(INSTALL_SUDO) cp -r share/. $(DESTDIR)$(DATDIR)/.

0 commit comments

Comments
 (0)