macos: Don't try to load dylibs or linker scripts
we ignore dylibs for now (can't inspect them yet for meta-info). Also don't try to load GNU linker scripts, it's simply an unknown file type (e.g. when mentioning Mach-O object files).
This commit is contained in:
parent
9d2ce50d2f
commit
b882cad67e
1 changed files with 8 additions and 1 deletions
9
libtcc.c
9
libtcc.c
|
@ -1096,8 +1096,12 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef TCC_TARGET_MACHO
|
||||||
ret = tcc_load_dll(s1, fd, filename,
|
ret = tcc_load_dll(s1, fd, filename,
|
||||||
(flags & AFF_REFERENCED_DLL) != 0);
|
(flags & AFF_REFERENCED_DLL) != 0);
|
||||||
|
#else
|
||||||
|
ret = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1112,12 +1116,15 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags)
|
||||||
default:
|
default:
|
||||||
#ifdef TCC_TARGET_PE
|
#ifdef TCC_TARGET_PE
|
||||||
ret = pe_load_file(s1, filename, fd);
|
ret = pe_load_file(s1, filename, fd);
|
||||||
|
#elif defined(TCC_TARGET_MACHO)
|
||||||
|
ret = -1;
|
||||||
#else
|
#else
|
||||||
/* as GNU ld, consider it is an ld script if not recognized */
|
/* as GNU ld, consider it is an ld script if not recognized */
|
||||||
ret = tcc_load_ldscript(s1, fd);
|
ret = tcc_load_ldscript(s1, fd);
|
||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
tcc_error_noabort("unrecognized file type");
|
tcc_error_noabort("%s: unrecognized file type %d", filename,
|
||||||
|
obj_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
Loading…
Add table
Reference in a new issue