mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-02 08:20:06 +08:00
fix: enforce bcheck.o linking when -b option is used
fixes a crash for the empry program (tcc -b empty.c) empty.c: int main() { return 0; }
This commit is contained in:
parent
cde79a805e
commit
a105837aae
6
Makefile
6
Makefile
@ -140,6 +140,7 @@ PROGS_CROSS=$($(X64_CROSS)_LINK) $($(WIN32_CROSS)_LINK) $($(WIN64_CROSS)_LINK) $
|
||||
LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a lib/x86_64/libtcc1.a \
|
||||
lib/arm64/libtcc1.a
|
||||
LIBTCC1=libtcc1.a
|
||||
BCHECK=yes
|
||||
else ifeq ($(ARCH),x86-64)
|
||||
NATIVE_FILES=$(X86_64_FILES)
|
||||
PROGS_CROSS=$($(I386_CROSS)_LINK) $($(WIN32_CROSS)_LINK) $($(WIN64_CROSS)_LINK) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
||||
@ -283,6 +284,10 @@ install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
||||
ifneq ($(LIBTCC1),)
|
||||
mkdir -p "$(tccdir)/$(ARCH)"
|
||||
$(INSTALL) -m644 $(LIBTCC1) "$(tccdir)/$(ARCH)"
|
||||
endif
|
||||
ifneq ($(BCHECK),)
|
||||
-mkdir -p "$(tccdir)/$(ARCH)"
|
||||
$(INSTALL) -m644 lib/$(ARCH)/bcheck.o "$(tccdir)/$(ARCH)"
|
||||
endif
|
||||
$(INSTALL) -m644 $(addprefix $(top_srcdir)/include/,$(TCC_INCLUDES)) $(top_srcdir)/tcclib.h "$(tccdir)/include"
|
||||
mkdir -p "$(libdir)"
|
||||
@ -303,6 +308,7 @@ ifdef CONFIG_CROSS
|
||||
mkdir -p "$(tccdir)/arm64"
|
||||
$(INSTALL) -m644 lib/arm64/libtcc1.a "$(tccdir)/arm64"
|
||||
$(INSTALL) -m644 lib/i386/libtcc1.a "$(tccdir)/i386"
|
||||
$(INSTALL) -m644 lib/i386/bcheck.o "$(tccdir)/i386"
|
||||
$(INSTALL) -m644 lib/x86_64/libtcc1.a "$(tccdir)/x86-64"
|
||||
$(INSTALL) -m644 $(top_srcdir)/win32/lib/*.def "$(tccdir)/win32/lib"
|
||||
$(INSTALL) -m644 lib/i386-win/libtcc1.a "$(tccdir)/win32/lib/32"
|
||||
|
5
tccelf.c
5
tccelf.c
@ -1564,7 +1564,10 @@ ST_FUNC void tcc_add_bcheck(TCCState *s1)
|
||||
pinit = section_ptr_add(init_section, 5);
|
||||
pinit[0] = 0xe8;
|
||||
put32(pinit + 1, -4);
|
||||
sym_index = find_elf_sym(symtab_section, "__bound_init");
|
||||
tcc_add_support(s1, "bcheck.o");
|
||||
sym_index = find_elf_sym(symtab_section, "__bound_init");
|
||||
if (!sym_index)
|
||||
tcc_error("__bound_init not defined");
|
||||
put_elf_reloc(symtab_section, init_section,
|
||||
init_section->data_offset - 4, R_386_PC32, sym_index);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user