ignore symbol main for .dylib; skip libtcc1 for tccrun mode;
This commit is contained in:
		
							parent
							
								
									853a498f2c
								
							
						
					
					
						commit
						55f8963dfa
					
				
					 3 changed files with 11 additions and 4 deletions
				
			
		
							
								
								
									
										2
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -252,7 +252,7 @@ libtcc.dylib: $(LIBTCC_OBJ)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# OSX libtcc.dylib (without rpath/ prefix)
 | 
					# OSX libtcc.dylib (without rpath/ prefix)
 | 
				
			||||||
libtcc.osx: $(LIBTCC_OBJ)
 | 
					libtcc.osx: $(LIBTCC_OBJ)
 | 
				
			||||||
	$S$(CC) -shared -install_name libtcc.dylib -o libtcc.dylib $^ $(LDFLAGS) 
 | 
						$S$(CC) -shared -o libtcc.dylib $^ $(LDFLAGS) 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# windows dynamic libtcc library
 | 
					# windows dynamic libtcc library
 | 
				
			||||||
libtcc.dll : $(LIBTCC_OBJ)
 | 
					libtcc.dll : $(LIBTCC_OBJ)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								tccelf.c
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								tccelf.c
									
										
									
									
									
								
							| 
						 | 
					@ -1457,7 +1457,10 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
 | 
				
			||||||
                tcc_add_btstub(s1);
 | 
					                tcc_add_btstub(s1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        tcc_add_support(s1, TCC_LIBTCC1);
 | 
					        /* libtcc1 is not needed when tccrun mode */
 | 
				
			||||||
 | 
					        if (s1->output_type != TCC_OUTPUT_MEMORY){
 | 
				
			||||||
 | 
					            tcc_add_support(s1, TCC_LIBTCC1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
#ifndef TCC_TARGET_MACHO
 | 
					#ifndef TCC_TARGET_MACHO
 | 
				
			||||||
        /* add crt end if not memory output */
 | 
					        /* add crt end if not memory output */
 | 
				
			||||||
        if (s1->output_type != TCC_OUTPUT_MEMORY)
 | 
					        if (s1->output_type != TCC_OUTPUT_MEMORY)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -813,8 +813,12 @@ ST_FUNC int macho_output_file(TCCState *s1, const char *filename)
 | 
				
			||||||
        Section *s;
 | 
					        Section *s;
 | 
				
			||||||
        collect_sections(s1, &mo);
 | 
					        collect_sections(s1, &mo);
 | 
				
			||||||
        relocate_syms(s1, s1->symtab, 0);
 | 
					        relocate_syms(s1, s1->symtab, 0);
 | 
				
			||||||
        mo.ep->entryoff = get_sym_addr(s1, "main", 1, 1)
 | 
									if (s1->output_type == TCC_OUTPUT_DLL) {
 | 
				
			||||||
                            - get_segment(&mo, 1)->vmaddr;
 | 
										/* TODO: more handling for .dylib ? */
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										mo.ep->entryoff = get_sym_addr(s1, "main", 1, 1)
 | 
				
			||||||
 | 
											- get_segment(&mo, 1)->vmaddr;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
        if (s1->nb_errors)
 | 
					        if (s1->nb_errors)
 | 
				
			||||||
          goto do_ret;
 | 
					          goto do_ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue