mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-29 06:10:09 +08:00
macos: section syms, strtab, runtime
uncovered by the backtrace/boundcheck tests: * handle STT_SECTION symbols * call tcc_add_runtime (to get the bcheck.o/bt-exe.o files added) * add .stab strtab into segments (we should probably add all stab syms to the output LC_SYMTAB eventually, but right now TCC uses 32 bit stabs, while mach-o uses 32/64bit stabs
This commit is contained in:
parent
91cb41330d
commit
0b3c8360a0
2
tccelf.c
2
tccelf.c
@ -1459,9 +1459,11 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
|
||||
}
|
||||
#endif
|
||||
tcc_add_support(s1, TCC_LIBTCC1);
|
||||
#ifndef TCC_TARGET_MACHO
|
||||
/* add crt end if not memory output */
|
||||
if (s1->output_type != TCC_OUTPUT_MEMORY)
|
||||
tcc_add_crt(s1, "crtn.o");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -419,6 +419,7 @@ static void convert_symbol(TCCState *s1, struct macho *mo, struct nlist_64 *pn)
|
||||
case STT_NOTYPE:
|
||||
case STT_OBJECT:
|
||||
case STT_FUNC:
|
||||
case STT_SECTION:
|
||||
n.n_type = 0xe; /* default type is N_SECT */
|
||||
break;
|
||||
case STT_FILE:
|
||||
@ -609,7 +610,7 @@ static void collect_sections(TCCState *s1, struct macho *mo)
|
||||
case SHT_FINI_ARRAY: sk = sk_fini; break;
|
||||
case SHT_NOBITS: sk = sk_bss; break;
|
||||
case SHT_SYMTAB: sk = sk_discard; break;
|
||||
case SHT_STRTAB: sk = sk_discard; break;
|
||||
case SHT_STRTAB: sk = s == stabstr_section ? sk_ro_data : sk_discard; break;
|
||||
case SHT_RELX: sk = sk_discard; break;
|
||||
case SHT_LINKEDIT: sk = sk_linkedit; break;
|
||||
case SHT_PROGBITS:
|
||||
@ -809,6 +810,7 @@ ST_FUNC int macho_output_file(TCCState *s1, const char *filename)
|
||||
if (s1->verbose)
|
||||
printf("<- %s\n", filename);
|
||||
|
||||
tcc_add_runtime(s1);
|
||||
resolve_common_syms(s1);
|
||||
create_symtab(s1, &mo);
|
||||
check_relocs(s1, &mo);
|
||||
|
Loading…
Reference in New Issue
Block a user