mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
2f2708a769
The new gcc12 release does not support stabs any more. This was a good reason to add support for dwarf. The stabs code still works and is used if configure option --dwarf is not used. Tested on x86_64, i386, arm, arm64, riscv64 with dwarf-5. Some debuggers may not support dwarf-5. Try using older dwarf versions i that case. The tccmacho.c code probably need some support for dwarf. arm-gen.c, arm64-gen.c, i386-gen.c, riscv64-gen.c, x86_64-gen. - fix get_sym_ref symbol size arm-link.c, arm64-link.c, i386-link.c, riscv64-link.c, x86_64-link.c - add R_DATA_32U libtcc.c: - parse -gdwarf option tcc.c: - add dwarf option tcc.h: - add dwarf option and sections tccelf.c: - init dwarf sections - avoid adding sh_addr for dwarf sections - remove dwarf relocs for output dll - add dwarf sections for tccrun tccgen.c: - add dwarf defines + global data - add dwarf_* functions - mix dwarf code with stabs code - a trick is used to emit function name in .debug_line section so only this section has to be parsed instead of .debug_info and .debug_abbrev. - fix init debug_modes tccrun.c: - add dwarf sections in rt_context - init them in tcc_run - add new dwarf code rt_printline_dwarf to find file/function dwarf.h: - New file tcc-doc.texi: - document dwarf configure: - add dwarf option lib/Makefile - change -gstabs into -gdwarf lib/bt-exe.c, tests/tests2/Makefile, tests/tests2/126_bound_global: - Add __bound_init call - Add new testcase to test it
95 lines
2.6 KiB
Makefile
95 lines
2.6 KiB
Makefile
#
|
|
# Tiny C Compiler Makefile for libtcc1.a
|
|
#
|
|
|
|
TOP = ..
|
|
include $(TOP)/Makefile
|
|
VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib
|
|
T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
|
|
X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
|
|
|
|
XTCC ?= $(TOP)/$(X)tcc$(EXESUF)
|
|
XCC = $(XTCC)
|
|
XAR = $(XTCC) -ar
|
|
XFLAGS-unx = -B$(TOPSRC)
|
|
XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
|
XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP)
|
|
XCFG = $(or $(findstring -win,$T),-unx)
|
|
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
|
|
|
# in order to use gcc, type: make <target>-libtcc1-usegcc=yes
|
|
arm-libtcc1-usegcc ?= no
|
|
|
|
# This makes bounds checking 40%..60% faster.
|
|
#x86_64-libtcc1-usegcc=yes
|
|
#i386-libtcc1-usegcc=yes
|
|
|
|
ifeq "$($(T)-libtcc1-usegcc)" "yes"
|
|
XCC = $(CC)
|
|
XAR = $(AR)
|
|
XFLAGS = $(CFLAGS) -fPIC -gdwarf -fno-omit-frame-pointer -Wno-unused-function -Wno-unused-variable
|
|
endif
|
|
|
|
ifneq ($(CONFIG_backtrace),no)
|
|
# only for native compiler
|
|
ifneq ($(CONFIG_bcheck),no)
|
|
$(X)BCHECK_O = bcheck.o
|
|
endif
|
|
$(X)BT_O = bt-exe.o bt-log.o
|
|
$(X)B_O = $(BCHECK_O) bt-exe.o bt-log.o bt-dll.o
|
|
endif
|
|
$(X)BT_O += tcov.o
|
|
|
|
DSO_O = dsohandle.o
|
|
|
|
I386_O = libtcc1.o alloca.o alloca-bt.o $(BT_O) stdatomic.o
|
|
X86_64_O = libtcc1.o alloca.o alloca-bt.o $(BT_O) stdatomic.o
|
|
ARM_O = libtcc1.o armeabi.o alloca.o armflush.o fetch_and_add.o $(BT_O)
|
|
ARM64_O = lib-arm64.o fetch_and_add.o $(BT_O)
|
|
RISCV64_O = lib-arm64.o fetch_and_add.o $(BT_O)
|
|
WIN_O = crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o
|
|
|
|
OBJ-i386 = $(I386_O) $(BCHECK_O) $(DSO_O)
|
|
OBJ-x86_64 = $(X86_64_O) va_list.o $(BCHECK_O) $(DSO_O)
|
|
OBJ-x86_64-osx = $(X86_64_O) va_list.o $(BCHECK_O)
|
|
OBJ-i386-win32 = $(I386_O) chkstk.o $(B_O) $(WIN_O)
|
|
OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(B_O) $(WIN_O)
|
|
OBJ-arm64 = $(ARM64_O) $(BCHECK_O) $(DSO_O)
|
|
OBJ-arm64-osx = $(ARM64_O) va_list.o
|
|
OBJ-arm = $(ARM_O) $(BCHECK_O) $(DSO_O)
|
|
OBJ-arm-fpa = $(ARM_O) $(DSO_O)
|
|
OBJ-arm-fpa-ld = $(ARM_O) $(DSO_O)
|
|
OBJ-arm-vfp = $(ARM_O) $(DSO_O)
|
|
OBJ-arm-eabi = $(ARM_O) $(DSO_O)
|
|
OBJ-arm-eabihf = $(ARM_O) $(DSO_O)
|
|
OBJ-arm-wince = $(ARM_O) $(WIN_O)
|
|
OBJ-riscv64 = $(RISCV64_O) $(BCHECK_O) $(DSO_O)
|
|
|
|
OBJ-extra = $(filter $(B_O),$(OBJ-$T))
|
|
OBJ-libtcc1 = $(addprefix $(X),$(filter-out $(OBJ-extra),$(OBJ-$T)))
|
|
|
|
ALL = $(addprefix $(TOP)/,$(X)libtcc1.a $(OBJ-extra))
|
|
|
|
all: $(ALL)
|
|
|
|
$(TOP)/$(X)libtcc1.a : $(OBJ-libtcc1)
|
|
$S$(XAR) rcs $@ $^
|
|
|
|
$(X)%.o : %.c
|
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
|
|
|
$(X)%.o : %.S
|
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
|
|
|
$(TOP)/%.o : %.c
|
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
|
|
|
$(TOP)/bcheck.o : XFLAGS += -g $(if $(CONFIG_musl),-DTCC_MUSL)
|
|
$(TOP)/bt-exe.o : $(TOP)/tccrun.c
|
|
|
|
$(X)crt1w.o : crt1.c
|
|
$(X)wincrt1w.o : wincrt1.c
|
|
|
|
clean :
|
|
rm -f *.a *.o $(ALL)
|