tcc -fgnu89-inline -fno-asynchronous-unwind-tables
-fgnu89-inline: 'extern inline' like 'static inline' -fno-asynchronous-unwind-tables: don't emit eh_frames
This commit is contained in:
parent
f24727b6bb
commit
3eb6352c52
6 changed files with 19 additions and 14 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
|||
run: ./configure && make && make test -k
|
||||
|
||||
test-x86_64-osx:
|
||||
runs-on: macos-12
|
||||
runs-on: macos-13
|
||||
timeout-minutes: 2
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
3
libtcc.c
3
libtcc.c
|
@ -822,6 +822,7 @@ LIBTCCAPI TCCState *tcc_new(void)
|
|||
s->warn_implicit_function_declaration = 1;
|
||||
s->warn_discarded_qualifiers = 1;
|
||||
s->ms_extensions = 1;
|
||||
s->unwind_tables = 1;
|
||||
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
s->char_is_unsigned = 1;
|
||||
|
@ -1674,6 +1675,8 @@ static const FlagDef options_f[] = {
|
|||
{ offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" },
|
||||
{ offsetof(TCCState, test_coverage), 0, "test-coverage" },
|
||||
{ offsetof(TCCState, reverse_funcargs), 0, "reverse-funcargs" },
|
||||
{ offsetof(TCCState, gnu89_inline), 0, "gnu89-inline" },
|
||||
{ offsetof(TCCState, unwind_tables), 0, "asynchronous-unwind-tables" },
|
||||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
|
|
2
tcc.c
2
tcc.c
|
@ -116,6 +116,8 @@ static const char help2[] =
|
|||
" ms-extensions allow anonymous struct in struct\n"
|
||||
" dollars-in-identifiers allow '$' in C symbols\n"
|
||||
" reverse-funcargs evaluate function arguments right to left\n"
|
||||
" gnu89-inline 'extern inline' is like 'static inline'\n"
|
||||
" asynchronous-unwind-tables create eh_frame section [on]\n"
|
||||
" test-coverage create code coverage code\n"
|
||||
"-m... target specific options:\n"
|
||||
" ms-bitfields use MSVC bitfield layout\n"
|
||||
|
|
2
tcc.h
2
tcc.h
|
@ -777,6 +777,8 @@ struct TCCState {
|
|||
unsigned char dollars_in_identifiers; /* allows '$' char in identifiers */
|
||||
unsigned char ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */
|
||||
unsigned char reverse_funcargs; /* if true, evaluate last function arg first */
|
||||
unsigned char gnu89_inline; /* treat 'extern inline' like 'static inline' */
|
||||
unsigned char unwind_tables; /* create eh_frame section */
|
||||
|
||||
/* warning switches */
|
||||
unsigned char warn_none;
|
||||
|
|
2
tccdbg.c
2
tccdbg.c
|
@ -716,6 +716,8 @@ ST_FUNC void tcc_eh_frame_start(TCCState *s1)
|
|||
{
|
||||
#if !(defined _WIN32 || defined __APPLE__ || defined TCC_TARGET_ARM || \
|
||||
defined TARGETOS_BSD)
|
||||
if (!s1->unwind_tables)
|
||||
return;
|
||||
eh_frame_section = new_section(s1, ".eh_frame", SHT_PROGBITS, SHF_ALLOC);
|
||||
|
||||
s1->eh_start = eh_frame_section->data_offset;
|
||||
|
|
22
tccgen.c
22
tccgen.c
|
@ -8459,6 +8459,7 @@ static int decl(int l)
|
|||
CType type, btype;
|
||||
Sym *sym;
|
||||
AttributeDef ad, adbase;
|
||||
ElfSym *esym;
|
||||
|
||||
while (1) {
|
||||
|
||||
|
@ -8529,21 +8530,17 @@ static int decl(int l)
|
|||
func_vt = type;
|
||||
decl(VT_CMP);
|
||||
}
|
||||
#if defined TCC_TARGET_MACHO || defined TARGETOS_ANDROID
|
||||
if (sym->f.func_alwinl
|
||||
&& ((type.t & (VT_EXTERN | VT_INLINE))
|
||||
== (VT_EXTERN | VT_INLINE))) {
|
||||
|
||||
if ((type.t & (VT_EXTERN|VT_INLINE)) == (VT_EXTERN|VT_INLINE)) {
|
||||
/* always_inline functions must be handled as if they
|
||||
don't generate multiple global defs, even if extern
|
||||
inline, i.e. GNU inline semantics for those. Rewrite
|
||||
them into static inline. */
|
||||
type.t &= ~VT_EXTERN;
|
||||
type.t |= VT_STATIC;
|
||||
if (tcc_state->gnu89_inline || sym->f.func_alwinl)
|
||||
type.t = (type.t & ~VT_EXTERN) | VT_STATIC;
|
||||
else
|
||||
type.t &= ~VT_INLINE; /* always compile otherwise */
|
||||
}
|
||||
#endif
|
||||
/* always compile 'extern inline' */
|
||||
if (type.t & VT_EXTERN)
|
||||
type.t &= ~VT_INLINE;
|
||||
|
||||
} else if (oldint) {
|
||||
tcc_warning("type defaults to int");
|
||||
|
@ -8682,7 +8679,7 @@ static int decl(int l)
|
|||
) {
|
||||
/* external variable or function */
|
||||
type.t |= VT_EXTERN;
|
||||
sym = external_sym(v, &type, r, &ad);
|
||||
external_sym(v, &type, r, &ad);
|
||||
} else {
|
||||
if (l == VT_CONST || (type.t & VT_STATIC))
|
||||
r |= VT_CONST;
|
||||
|
@ -8702,8 +8699,7 @@ static int decl(int l)
|
|||
We only support the case where the base is already
|
||||
defined, otherwise we would need deferring to emit
|
||||
the aliases until the end of the compile unit. */
|
||||
Sym *alias_target = sym_find(ad.alias_target);
|
||||
ElfSym *esym = elfsym(alias_target);
|
||||
esym = elfsym(sym_find(ad.alias_target));
|
||||
if (!esym)
|
||||
tcc_error("unsupported forward __alias__ attribute");
|
||||
put_extern_sym2(sym_find(v), esym->st_shndx,
|
||||
|
|
Loading…
Reference in a new issue