mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-04 08:20:12 +08:00
macos: set LC_MAIN entrypoint correctly
to the file offset of 'main' not simply to the start of TEXT.
This commit is contained in:
parent
84c3fecf5e
commit
1ca209dad0
@ -558,7 +558,7 @@ static void collect_sections(TCCState *s1, struct macho *mo)
|
||||
|
||||
mo->ep.cmd = LC_MAIN;
|
||||
mo->ep.cmdsize = sizeof(mo->ep);
|
||||
mo->ep.entryoff = 4096; // XXX
|
||||
mo->ep.entryoff = 4096;
|
||||
mo->ep.stacksize = 0;
|
||||
add_lc(mo, &mo->ep);
|
||||
|
||||
@ -810,6 +810,7 @@ ST_FUNC int macho_output_file(TCCState *s1, const char *filename)
|
||||
Section *s;
|
||||
collect_sections(s1, &mo);
|
||||
relocate_syms(s1, s1->symtab, 0);
|
||||
mo.ep.entryoff = get_elf_sym_addr(s1, "main", 1) - mo.seg[1]->vmaddr;
|
||||
if (s1->nb_errors)
|
||||
goto do_ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user