History

tcc -fgnu89-inline -fno-asynchronous-unwind-tables

grischka committed 1 year ago

Commit 3eb63521 parent f24727b6 files · +19 −14Browse files

Unified · Split

6 files
  1. .github/workflows/build.yml +1 −1
  2. libtcc.c +3 −0
  3. tcc.c +2 −0
  4. tcc.h +2 −0
  5. tccdbg.c +2 −0
  6. tccgen.c +9 −13
.github/workflows/build.yml+1−1
@@ -14,7 +14,7 @@ jobs: · 13 unmodified lines
1414 run: ./configure && make && make test -k
1515
1616 test-x86_64-osx:
17− runs-on: macos-12
17+ runs-on: macos-13
1818 timeout-minutes: 2
1919 steps:
2020 - uses: actions/checkout@v4
libtcc.c+3−0
@@ -822,6 +822,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 821 unmodified lines
822822 s->warn_implicit_function_declaration = 1;
823823 s->warn_discarded_qualifiers = 1;
824824 s->ms_extensions = 1;
825+ s->unwind_tables = 1;
825826
826827 #ifdef CHAR_IS_UNSIGNED
827828 s->char_is_unsigned = 1;
@@ -1674,6 +1675,8 @@ static const FlagDef options_f[] = { · 846 unmodified lines
16741675 { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" },
16751676 { offsetof(TCCState, test_coverage), 0, "test-coverage" },
16761677 { offsetof(TCCState, reverse_funcargs), 0, "reverse-funcargs" },
1678+ { offsetof(TCCState, gnu89_inline), 0, "gnu89-inline" },
1679+ { offsetof(TCCState, unwind_tables), 0, "asynchronous-unwind-tables" },
16771680 { 0, 0, NULL }
16781681 };
16791682
tcc.c+2−0
@@ -116,6 +116,8 @@ static const char help2[] = · 115 unmodified lines
116116 " ms-extensions allow anonymous struct in struct\n"
117117 " dollars-in-identifiers allow '$' in C symbols\n"
118118 " reverse-funcargs evaluate function arguments right to left\n"
119+ " gnu89-inline 'extern inline' is like 'static inline'\n"
120+ " asynchronous-unwind-tables create eh_frame section [on]\n"
119121 " test-coverage create code coverage code\n"
120122 "-m... target specific options:\n"
121123 " ms-bitfields use MSVC bitfield layout\n"
tcc.h+2−0
@@ -777,6 +777,8 @@ struct TCCState { · 776 unmodified lines
777777 unsigned char dollars_in_identifiers; /* allows '$' char in identifiers */
778778 unsigned char ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */
779779 unsigned char reverse_funcargs; /* if true, evaluate last function arg first */
780+ unsigned char gnu89_inline; /* treat 'extern inline' like 'static inline' */
781+ unsigned char unwind_tables; /* create eh_frame section */
780782
781783 /* warning switches */
782784 unsigned char warn_none;
tccdbg.c+2−0
@@ -716,6 +716,8 @@ ST_FUNC void tcc_eh_frame_start(TCCState *s1) · 715 unmodified lines
716716 {
717717 #if !(defined _WIN32 || defined __APPLE__ || defined TCC_TARGET_ARM || \
718718 defined TARGETOS_BSD)
719+ if (!s1->unwind_tables)
720+ return;
719721 eh_frame_section = new_section(s1, ".eh_frame", SHT_PROGBITS, SHF_ALLOC);
720722
721723 s1->eh_start = eh_frame_section->data_offset;
tccgen.c+9−13
@@ -8459,6 +8459,7 @@ static int decl(int l) · 8458 unmodified lines
84598459 CType type, btype;
84608460 Sym *sym;
84618461 AttributeDef ad, adbase;
8462+ ElfSym *esym;
84628463
84638464 while (1) {
84648465
@@ -8529,21 +8530,17 @@ static int decl(int l) · 64 unmodified lines
85298530 func_vt = type;
85308531 decl(VT_CMP);
85318532 }
8532−#if defined TCC_TARGET_MACHO || defined TARGETOS_ANDROID
8533− if (sym->f.func_alwinl
8534− && ((type.t & (VT_EXTERN | VT_INLINE))
8535− == (VT_EXTERN | VT_INLINE))) {
8533+
8534+ if ((type.t & (VT_EXTERN|VT_INLINE)) == (VT_EXTERN|VT_INLINE)) {
85368535 /* always_inline functions must be handled as if they
85378536 don't generate multiple global defs, even if extern
85388537 inline, i.e. GNU inline semantics for those. Rewrite
85398538 them into static inline. */
8540− type.t &= ~VT_EXTERN;
8541− type.t |= VT_STATIC;
8539+ if (tcc_state->gnu89_inline || sym->f.func_alwinl)
8540+ type.t = (type.t & ~VT_EXTERN) | VT_STATIC;
8541+ else
8542+ type.t &= ~VT_INLINE; /* always compile otherwise */
85428543 }
8543−#endif
8544− /* always compile 'extern inline' */
8545− if (type.t & VT_EXTERN)
8546− type.t &= ~VT_INLINE;
85478544
85488545 } else if (oldint) {
85498546 tcc_warning("type defaults to int");
@@ -8682,7 +8679,7 @@ static int decl(int l) · 132 unmodified lines
86828679 ) {
86838680 /* external variable or function */
86848681 type.t |= VT_EXTERN;
8685− sym = external_sym(v, &type, r, &ad);
8682+ external_sym(v, &type, r, &ad);
86868683 } else {
86878684 if (l == VT_CONST || (type.t & VT_STATIC))
86888685 r |= VT_CONST;
@@ -8702,8 +8699,7 @@ static int decl(int l) · 13 unmodified lines
87028699 We only support the case where the base is already
87038700 defined, otherwise we would need deferring to emit
87048701 the aliases until the end of the compile unit. */
8705− Sym *alias_target = sym_find(ad.alias_target);
8706− ElfSym *esym = elfsym(alias_target);
8702+ esym = elfsym(sym_find(ad.alias_target));
87078703 if (!esym)
87088704 tcc_error("unsupported forward __alias__ attribute");
87098705 put_extern_sym2(sym_find(v), esym->st_shndx,

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