Skip to content

Commit 9ee3a61

Browse files
committed
Merge branch 'mob'
2 parents 5002167 + 34b7b2c commit 9ee3a61

File tree

8 files changed

+35
-10
lines changed

8 files changed

+35
-10
lines changed

include/float.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#define LDBL_MIN_10_EXP (-4931)
5454
#define LDBL_MAX_EXP 16384
5555
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
56-
#define LDBL_MAX_EXP 16384
56+
#define LDBL_MAX_10_EXP 4932
5757
#define DECIMAL_DIG 36
5858

5959
#else

tcc.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,9 @@ int main(int argc0, char **argv0)
378378
first_file = f->name;
379379
ret = tcc_add_file(s, f->name);
380380
}
381-
done = ret || ++n >= s->nb_files;
382-
} while (!done && (s->output_type != TCC_OUTPUT_OBJ || s->option_r));
381+
} while (++n < s->nb_files
382+
&& 0 == ret
383+
&& (s->output_type != TCC_OUTPUT_OBJ || s->option_r));
383384

384385
if (s->do_bench)
385386
end_time = getclock_ms();
@@ -406,13 +407,17 @@ int main(int argc0, char **argv0)
406407
done = 1;
407408
if (t)
408409
done = 0; /* run more tests with -dt -run */
409-
else if (ret)
410-
ret = 1;
411-
else if (n < s->nb_files)
410+
else if (ret) {
411+
if (s->nb_errors)
412+
ret = 1;
413+
/* else keep the original exit code from tcc_run() */
414+
} else if (n < s->nb_files)
412415
done = 0; /* compile more files with -c */
413416
else if (s->do_bench)
414417
tcc_print_stats(s, end_time - start_time);
418+
415419
tcc_delete(s);
420+
416421
if (!done)
417422
goto redo;
418423
if (ppfp && ppfp != stdout)

tccasm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,15 @@ static void asm_parse_directive(TCCState *s1, int global)
971971
}
972972
break;
973973
#endif
974+
/* TODO: Implement symvar support. FreeBSD >= 14 needs this */
975+
case TOK_ASMDIR_symver:
976+
next();
977+
next();
978+
skip(',');
979+
next();
980+
skip('@');
981+
next();
982+
break;
974983
default:
975984
tcc_error("unknown assembler directive '.%s'", get_tok_str(tok, NULL));
976985
break;

tccelf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3169,9 +3169,11 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
31693169
|| 0 == strncmp(sh_name, ".stab", 5)) {
31703170
if (!s1->do_debug || seencompressed)
31713171
continue;
3172+
#if !(TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD)
31723173
} else if (0 == strncmp(sh_name, ".eh_frame", 9)) {
31733174
if (NULL == eh_frame_section)
31743175
continue;
3176+
#endif
31753177
} else
31763178
if (sh->sh_type != SHT_PROGBITS &&
31773179
sh->sh_type != SHT_NOTE &&
@@ -3181,6 +3183,9 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
31813183
sh->sh_type != SHT_FINI_ARRAY
31823184
#ifdef TCC_ARM_EABI
31833185
&& sh->sh_type != SHT_ARM_EXIDX
3186+
#endif
3187+
#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD
3188+
&& sh->sh_type != SHT_X86_64_UNWIND
31843189
#endif
31853190
)
31863191
continue;
@@ -3195,7 +3200,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
31953200
if (strcmp(s->name, sh_name))
31963201
continue;
31973202
if (sh->sh_type != s->sh_type
3198-
&& s != eh_frame_section
3203+
&& strcmp (s->name, ".eh_frame")
31993204
) {
32003205
tcc_error_noabort("section type conflict: %s %02x <> %02x", s->name, sh->sh_type, s->sh_type);
32013206
goto the_end;

tccrun.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ ST_FUNC void tcc_run_free(TCCState *s1)
197197
#endif
198198
}
199199

200+
#define RT_EXIT_ZERO 0xE0E00E0E /* passed from longjmp instead of '0' */
201+
200202
/* launch the compiled program with the given arguments */
201203
LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
202204
{
@@ -238,7 +240,7 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
238240
ret = tcc_setjmp(s1, main_jb, tcc_get_symbol(s1, top_sym));
239241
if (0 == ret)
240242
ret = prog_main(argc, argv, envp);
241-
else if (256 == ret)
243+
else if (RT_EXIT_ZERO == ret)
242244
ret = 0;
243245

244246
if (s1->dflag & 16 && ret) /* tcc -dt -run ... */
@@ -596,7 +598,7 @@ static void rt_exit(rt_frame *f, int code)
596598
rt_post_sem();
597599
if (s && s->run_lj) {
598600
if (code == 0)
599-
code = 256;
601+
code = RT_EXIT_ZERO;
600602
((void(*)(void*,int))s->run_lj)(s->run_jb, code);
601603
}
602604
exit(code);

tcctok.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@
412412
DEF_ASMDIR(short)
413413
DEF_ASMDIR(long)
414414
DEF_ASMDIR(int)
415+
DEF_ASMDIR(symver)
415416
DEF_ASMDIR(section) /* must be last directive */
416417

417418
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64

win32/build-tcc.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ exit /B %ERRORLEVEL%
200200
.\tcc -B. -m%1 -c ../lib/alloca.S
201201
.\tcc -B. -m%1 -c ../lib/alloca-bt.S
202202
.\tcc -B. -m%1 -c ../lib/stdatomic.c
203-
.\tcc -B. -m%1 -ar lib/%2libtcc1.a libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o alloca.o alloca-bt.o stdatomic.o
203+
.\tcc -B. -m%1 -c ../lib/builtin.c
204+
.\tcc -B. -m%1 -ar lib/%2libtcc1.a libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o alloca.o alloca-bt.o stdatomic.o builtin.o
204205
.\tcc -B. -m%1 -c ../lib/bcheck.c -o lib/%2bcheck.o -bt -I..
205206
.\tcc -B. -m%1 -c ../lib/bt-exe.c -o lib/%2bt-exe.o
206207
.\tcc -B. -m%1 -c ../lib/bt-log.c -o lib/%2bt-log.o

win32/lib/kernel32.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ LIBRARY kernel32.dll
33
EXPORTS
44
AddAtomA
55
AddAtomW
6+
AddVectoredContinueHandler
7+
AddVectoredExceptionHandler
68
AllocConsole
79
AllocLSCallback
810
AllocSLCallback

0 commit comments

Comments
 (0)