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