aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2017-04-25 21:01:54 +0200
committergrischka <grischka>2017-04-25 21:01:54 +0200
commit7acf9aa86275a24b468786d6ea9f308ae33f011c (patch)
tree5bc1c65e4a894185de1d45456d662e7b1297fa25 /libtcc.c
parentfb4f57666cf23aa94d6ef421383013e6a0dc12cc (diff)
downloadtinycc-7acf9aa86275a24b468786d6ea9f308ae33f011c.tar.gz
tinycc-7acf9aa86275a24b468786d6ea9f308ae33f011c.tar.bz2
final adjustments for release
- configure/Makefiles: minor adjustments - build-tcc.bat: add -static to gcc options (avoids libgcc_s*.dll dependency with some mingw versions) - tccpe.c/tcctools.c: eliminate MAX_PATH (not available for cross compilers) - tccasm.c: use uint64_t/strtoull in unary() (unsigned long sometimes is only uint32_t, as always on windows) - tccgen.c: Revert (f077d16c) "tccgen: gen_cast: cast FLOAT to DOUBLE" Was a rather experimental, tentative commit, not really necessary and somewhat ugly too. - cleanup recent osx support: - Makefile/libtcc.c: cleanup copy&paste code - tccpp.c: restore deleted function
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/libtcc.c b/libtcc.c
index b4b2615..9243e49 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1054,6 +1054,11 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags)
/* do not display line number if error */
file->line_num = 0;
+#ifdef TCC_TARGET_MACHO
+ if (0 == obj_type && 0 == strcmp(tcc_fileextension(filename), "dylib"))
+ obj_type = AFF_BINTYPE_DYN;
+#endif
+
switch (obj_type) {
case AFF_BINTYPE_REL:
ret = tcc_load_object_file(s1, fd, 0);
@@ -1081,19 +1086,7 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags)
break;
#endif
default:
-#if defined(TCC_TARGET_MACHO)
- if (s1->output_type == TCC_OUTPUT_MEMORY) {
- ret = 0;
-#ifdef TCC_IS_NATIVE
- if (NULL == dlopen(filename, RTLD_GLOBAL | RTLD_LAZY)) {
- ret = -1;
- }
-#endif /* TCC_TARGET_MACHO */
- } else {
- ret = tcc_load_dll(s1, fd, filename,
- (flags & AFF_REFERENCED_DLL) != 0);
- }
-#elif defined(TCC_TARGET_PE)
+#ifdef TCC_TARGET_PE
ret = pe_load_file(s1, filename, fd);
#else
/* as GNU ld, consider it is an ld script if not recognized */
@@ -1155,12 +1148,12 @@ ST_FUNC int tcc_add_crt(TCCState *s, const char *filename)
/* the library name is the same as the argument of the '-l' option */
LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname)
{
-#if defined(TCC_TARGET_MACHO)
- const char *libs[] = { "%s/lib%s.dylib", "%s/lib%s.a", NULL };
- const char **pp = s->static_link ? libs + 1 : libs;
-#elif defined(TCC_TARGET_PE)
+#if defined TCC_TARGET_PE
const char *libs[] = { "%s/%s.def", "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll", "%s/lib%s.a", NULL };
const char **pp = s->static_link ? libs + 4 : libs;
+#elif defined TCC_TARGET_MACHO
+ const char *libs[] = { "%s/lib%s.dylib", "%s/lib%s.a", NULL };
+ const char **pp = s->static_link ? libs + 1 : libs;
#else
const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL };
const char **pp = s->static_link ? libs + 1 : libs;