History

ignore symbol main for .dylib; skip libtcc1 for tccrun mode;

wanjochan committed 6 years ago

Commit 55f89631 parent 853a4983 files · +11 −4Browse files

Unified · Split

3 files
  1. Makefile +1 −1
  2. tccelf.c +4 −1
  3. tccmacho.c +6 −2
Makefile+1−1
@@ -252,7 +252,7 @@ libtcc.dylib: $(LIBTCC_OBJ) · 251 unmodified lines
252252
253253 # OSX libtcc.dylib (without rpath/ prefix)
254254 libtcc.osx: $(LIBTCC_OBJ)
255− $S$(CC) -shared -install_name libtcc.dylib -o libtcc.dylib $^ $(LDFLAGS)
255+ $S$(CC) -shared -o libtcc.dylib $^ $(LDFLAGS)
256256
257257 # windows dynamic libtcc library
258258 libtcc.dll : $(LIBTCC_OBJ)
tccelf.c+4−1
@@ -1457,7 +1457,10 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) · 1456 unmodified lines
14571457 tcc_add_btstub(s1);
14581458 }
14591459 #endif
1460− tcc_add_support(s1, TCC_LIBTCC1);
1460+ /* libtcc1 is not needed when tccrun mode */
1461+ if (s1->output_type != TCC_OUTPUT_MEMORY){
1462+ tcc_add_support(s1, TCC_LIBTCC1);
1463+ }
14611464 #ifndef TCC_TARGET_MACHO
14621465 /* add crt end if not memory output */
14631466 if (s1->output_type != TCC_OUTPUT_MEMORY)
tccmacho.c+6−2
@@ -813,8 +813,12 @@ ST_FUNC int macho_output_file(TCCState *s1, const char *filename) · 812 unmodified lines
813813 Section *s;
814814 collect_sections(s1, &mo);
815815 relocate_syms(s1, s1->symtab, 0);
816− mo.ep->entryoff = get_sym_addr(s1, "main", 1, 1)
817− - get_segment(&mo, 1)->vmaddr;
816+ if (s1->output_type == TCC_OUTPUT_DLL) {
817+ /* TODO: more handling for .dylib ? */
818+ } else {
819+ mo.ep->entryoff = get_sym_addr(s1, "main", 1, 1)
820+ - get_segment(&mo, 1)->vmaddr;
821+ }
818822 if (s1->nb_errors)
819823 goto do_ret;
820824

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t