Fix dll support macho for x86_64

Macho uses bind/rebase instead of dynsym so disable them for relocate_sections.
This commit is contained in:
herman ten brugge 2022-12-17 07:43:01 +01:00
parent 8d3930bdb6
commit d66a62fa6b

View file

@ -2177,6 +2177,8 @@ ST_FUNC int macho_output_file(TCCState *s1, const char *filename)
check_relocs(s1, &mo); check_relocs(s1, &mo);
ret = check_symbols(s1, &mo); ret = check_symbols(s1, &mo);
if (!ret) { if (!ret) {
int save_output = s1->output_type;
collect_sections(s1, &mo, filename); collect_sections(s1, &mo, filename);
relocate_syms(s1, s1->symtab, 0); relocate_syms(s1, s1->symtab, 0);
if (s1->output_type == TCC_OUTPUT_EXE) if (s1->output_type == TCC_OUTPUT_EXE)
@ -2184,7 +2186,10 @@ ST_FUNC int macho_output_file(TCCState *s1, const char *filename)
- get_segment(&mo, 1)->vmaddr; - get_segment(&mo, 1)->vmaddr;
if (s1->nb_errors) if (s1->nb_errors)
goto do_ret; goto do_ret;
// Macho uses bind/rebase instead of dynsym
s1->output_type = TCC_OUTPUT_EXE;
relocate_sections(s1); relocate_sections(s1);
s1->output_type = save_output;
#ifdef CONFIG_NEW_MACHO #ifdef CONFIG_NEW_MACHO
bind_rebase_import(s1, &mo); bind_rebase_import(s1, &mo);
#endif #endif