diff --git a/Makefile b/Makefile index 17707c4..ad23485 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,8 @@ CXXOPTFLAGS=$(COPTFLAGS) -fno-exceptions \ -fno-rtti -fno-enforce-eh-specs -fnothrow-opt -fno-use-cxa-get-exception-ptr \ -fno-implicit-templates -fno-threadsafe-statics -fno-use-cxa-atexit -CFLAGS=-Wall -Wextra -Wpedantic -std=gnu11 -nostartfiles -fno-PIC $(COPTFLAGS) #-DUSE_DL_FINI -CXXFLAGS=-Wall -Wextra -Wpedantic -std=c++11 $(CXXOPTFLAGS) -nostartfiles -fno-PIC +CFLAGS=-g -Wall -Wextra -Wpedantic -std=gnu11 -nostartfiles -fno-PIC $(COPTFLAGS) #-DUSE_DL_FINI +CXXFLAGS=-g -Wall -Wextra -Wpedantic -std=c++11 $(CXXOPTFLAGS) -nostartfiles -fno-PIC CFLAGS += -m$(BITS) $(shell pkg-config --cflags sdl2) CXXFLAGS += -m$(BITS) $(shell pkg-config --cflags sdl2) @@ -41,7 +41,7 @@ LIBS = $(filter-out -pthread,$(shell pkg-config --libs sdl2)) -lX11 -lm -lc #-lG PWD ?= . SMOLFLAGS = --smolrt "$(PWD)/rt" --smolld "$(PWD)/ld" \ - --verbose #--keeptmp + --verbose -g #--keeptmp # -fuse-dnload-loader -fskip-zero-value -fuse-nx -fskip-entries -fuse-dt-debug # -fuse-dl-fini -fno-start-arg -funsafe-dynamic diff --git a/smold.py b/smold.py index f53c896..cf8fbd4 100755 --- a/smold.py +++ b/smold.py @@ -37,6 +37,9 @@ def main(): parser.add_argument('-d', '--det', default=False, action='store_true', \ help="Make the order of imports deterministic (default: just use " + \ "whatever binutils throws at us)") + parser.add_argument('-g', '--debug', default=False, action='store_true', \ + help="Pass `-g' to the C compiler, assembler and linker. Only useful "+\ + "when `--debugout' is specified.") parser.add_argument('-fuse-interp', default=True, action='store_true', \ help="[Default ON] Include a program interpreter header (PT_INTERP). If not " +\ @@ -143,6 +146,11 @@ def main(): if args.hash16 and args.crc32c: # shouldn't happen anymore error("Cannot combine --hash16 and --crc32c!") + if args.debug: + args.cflags.append('-g') + args.ldflags.append('-g') + args.asflags.append('-g') + if args.hash16 or args.crc32c: args.fuse_dnload_loader = True