Unified · Split
| @@ -14,7 +14,7 @@ jobs: · 13 unmodified lines | ||
| 14 | 14 | run: ./configure && make && make test -k |
| 15 | 15 | |
| 16 | 16 | test-x86_64-osx: |
| 17 | − runs-on: macos-12 | |
| 17 | + runs-on: macos-13 | |
| 18 | 18 | timeout-minutes: 2 |
| 19 | 19 | steps: |
| 20 | 20 | - uses: actions/checkout@v4 |
| @@ -822,6 +822,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 821 unmodified lines | ||
| 822 | 822 | s->warn_implicit_function_declaration = 1; |
| 823 | 823 | s->warn_discarded_qualifiers = 1; |
| 824 | 824 | s->ms_extensions = 1; |
| 825 | + s->unwind_tables = 1; | |
| 825 | 826 | |
| 826 | 827 | #ifdef CHAR_IS_UNSIGNED |
| 827 | 828 | s->char_is_unsigned = 1; |
| @@ -1674,6 +1675,8 @@ static const FlagDef options_f[] = { · 846 unmodified lines | ||
| 1674 | 1675 | { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" }, |
| 1675 | 1676 | { offsetof(TCCState, test_coverage), 0, "test-coverage" }, |
| 1676 | 1677 | { offsetof(TCCState, reverse_funcargs), 0, "reverse-funcargs" }, |
| 1678 | + { offsetof(TCCState, gnu89_inline), 0, "gnu89-inline" }, | |
| 1679 | + { offsetof(TCCState, unwind_tables), 0, "asynchronous-unwind-tables" }, | |
| 1677 | 1680 | { 0, 0, NULL } |
| 1678 | 1681 | }; |
| 1679 | 1682 | |
| @@ -116,6 +116,8 @@ static const char help2[] = · 115 unmodified lines | ||
| 116 | 116 | " ms-extensions allow anonymous struct in struct\n" |
| 117 | 117 | " dollars-in-identifiers allow '$' in C symbols\n" |
| 118 | 118 | " 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" | |
| 119 | 121 | " test-coverage create code coverage code\n" |
| 120 | 122 | "-m... target specific options:\n" |
| 121 | 123 | " ms-bitfields use MSVC bitfield layout\n" |
| @@ -777,6 +777,8 @@ struct TCCState { · 776 unmodified lines | ||
| 777 | 777 | unsigned char dollars_in_identifiers; /* allows '$' char in identifiers */ |
| 778 | 778 | unsigned char ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */ |
| 779 | 779 | 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 */ | |
| 780 | 782 | |
| 781 | 783 | /* warning switches */ |
| 782 | 784 | unsigned char warn_none; |
| @@ -716,6 +716,8 @@ ST_FUNC void tcc_eh_frame_start(TCCState *s1) · 715 unmodified lines | ||
| 716 | 716 | { |
| 717 | 717 | #if !(defined _WIN32 || defined __APPLE__ || defined TCC_TARGET_ARM || \ |
| 718 | 718 | defined TARGETOS_BSD) |
| 719 | + if (!s1->unwind_tables) | |
| 720 | + return; | |
| 719 | 721 | eh_frame_section = new_section(s1, ".eh_frame", SHT_PROGBITS, SHF_ALLOC); |
| 720 | 722 | |
| 721 | 723 | s1->eh_start = eh_frame_section->data_offset; |
| @@ -8459,6 +8459,7 @@ static int decl(int l) · 8458 unmodified lines | ||
| 8459 | 8459 | CType type, btype; |
| 8460 | 8460 | Sym *sym; |
| 8461 | 8461 | AttributeDef ad, adbase; |
| 8462 | + ElfSym *esym; | |
| 8462 | 8463 | |
| 8463 | 8464 | while (1) { |
| 8464 | 8465 | |
| @@ -8529,21 +8530,17 @@ static int decl(int l) · 64 unmodified lines | ||
| 8529 | 8530 | func_vt = type; |
| 8530 | 8531 | decl(VT_CMP); |
| 8531 | 8532 | } |
| 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)) { | |
| 8536 | 8535 | /* always_inline functions must be handled as if they |
| 8537 | 8536 | don't generate multiple global defs, even if extern |
| 8538 | 8537 | inline, i.e. GNU inline semantics for those. Rewrite |
| 8539 | 8538 | 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 */ | |
| 8542 | 8543 | } |
| 8543 | −#endif | |
| 8544 | − /* always compile 'extern inline' */ | |
| 8545 | − if (type.t & VT_EXTERN) | |
| 8546 | − type.t &= ~VT_INLINE; | |
| 8547 | 8544 | |
| 8548 | 8545 | } else if (oldint) { |
| 8549 | 8546 | tcc_warning("type defaults to int"); |
| @@ -8682,7 +8679,7 @@ static int decl(int l) · 132 unmodified lines | ||
| 8682 | 8679 | ) { |
| 8683 | 8680 | /* external variable or function */ |
| 8684 | 8681 | type.t |= VT_EXTERN; |
| 8685 | − sym = external_sym(v, &type, r, &ad); | |
| 8682 | + external_sym(v, &type, r, &ad); | |
| 8686 | 8683 | } else { |
| 8687 | 8684 | if (l == VT_CONST || (type.t & VT_STATIC)) |
| 8688 | 8685 | r |= VT_CONST; |
| @@ -8702,8 +8699,7 @@ static int decl(int l) · 13 unmodified lines | ||
| 8702 | 8699 | We only support the case where the base is already |
| 8703 | 8700 | defined, otherwise we would need deferring to emit |
| 8704 | 8701 | 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)); | |
| 8707 | 8703 | if (!esym) |
| 8708 | 8704 | tcc_error("unsupported forward __alias__ attribute"); |
| 8709 | 8705 | put_extern_sym2(sym_find(v), esym->st_shndx, |