diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af93edc4..afbd4d81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: jobs: test-x86_64-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 2 steps: - uses: actions/checkout@v4 @@ -50,55 +50,55 @@ jobs: C:\msys64\usr\bin\bash -l -c "./configure && make clean all && make test -k" test-armv7-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 6 steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2 + - uses: uraimo/run-on-arch-action@v3 name: make & test tcc (armv7-linux) with: arch: armv7 - distro: ubuntu20.04 + distro: ubuntu22.04 githubToken: ${{ github.token }} install: | apt-get update -q -y apt-get install -q -y gcc make run: | - echo "::endgroup::" && echo "::endgroup::" # missing in 'run-on-arch-action' + echo "::endgroup::" # flatten 'run container' ./configure && make && make test -k test-aarch64-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 6 steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2 + - uses: uraimo/run-on-arch-action@v3 name: make & test tcc (aarch64-linux) with: arch: aarch64 - distro: ubuntu20.04 + distro: ubuntu22.04 githubToken: ${{ github.token }} install: | apt-get update -q -y apt-get install -q -y gcc make run: | - echo "::endgroup::" && echo "::endgroup::" # missing in 'run-on-arch-action' + echo "::endgroup::" # flatten 'run container' ./configure && make && make test -k test-riscv64-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 6 steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2 + - uses: uraimo/run-on-arch-action@v3 name: make & test tcc (riscv64-linux) with: arch: riscv64 - distro: ubuntu20.04 + distro: ubuntu22.04 githubToken: ${{ github.token }} install: | apt-get update -q -y apt-get install -q -y gcc make run: | - echo "::endgroup::" && echo "::endgroup::" # missing in 'run-on-arch-action' + echo "::endgroup::" # flatten 'run container' ./configure && make && make test -k diff --git a/include/tccdefs.h b/include/tccdefs.h index 3ad83d12..bcde244b 100644 --- a/include/tccdefs.h +++ b/include/tccdefs.h @@ -125,6 +125,7 @@ #define __FINITE_MATH_ONLY__ 1 #define _FORTIFY_SOURCE 0 //#define __has_builtin(x) 0 + #define _Float16 short unsigned int /* fake type just for size & alignment (macOS Sequoia) */ #elif defined __ANDROID__ #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD @@ -141,6 +142,12 @@ #endif #define __INT32_TYPE__ int +#if defined __aarch64__ + /* GCC's __uint128_t appears in some Linux/OSX header files. Make it a + synonym for long double to get the size and alignment right. */ + #define __uint128_t long double +#endif + #if !defined _WIN32 /* glibc defines. We do not support __USER_NAME_PREFIX__ */ #define __REDIRECT(name, proto, alias) name proto __asm__ (#alias) diff --git a/libtcc.c b/libtcc.c index 854574b5..b163e865 100644 --- a/libtcc.c +++ b/libtcc.c @@ -78,7 +78,6 @@ ST_DATA int nb_stk_data; /* option -d (for general development purposes) */ ST_DATA int g_debug; - /********************************************************/ #ifdef _WIN32 ST_FUNC char *normalize_slashes(char *path) @@ -964,19 +963,15 @@ LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname) } /* add/update a 'DLLReference', Just find if level == -1 */ -ST_FUNC DLLReference *tcc_add_dllref(TCCState *s1, const char *dllpath, int level) +ST_FUNC DLLReference *tcc_add_dllref(TCCState *s1, const char *dllname, int level) { DLLReference *ref = NULL; int i; - const char *dllname = tcc_basename(dllpath); - const char *name; - for (i = 0; i < s1->nb_loaded_dlls; i++) { - name = tcc_basename(s1->loaded_dlls[i]->path); - if (0 == strcmp(name, dllname)) { + for (i = 0; i < s1->nb_loaded_dlls; i++) + if (0 == strcmp(s1->loaded_dlls[i]->name, dllname)) { ref = s1->loaded_dlls[i]; break; } - } if (level == -1) return ref; if (ref) { @@ -985,8 +980,8 @@ ST_FUNC DLLReference *tcc_add_dllref(TCCState *s1, const char *dllpath, int leve ref->found = 1; return ref; } - ref = tcc_mallocz(sizeof(DLLReference) + strlen(dllpath)); - strcpy(ref->path, dllpath); + ref = tcc_mallocz(sizeof(DLLReference) + strlen(dllname)); + strcpy(ref->name, dllname); dynarray_add(&s1->loaded_dlls, &s1->nb_loaded_dlls, ref); ref->level = level; ref->index = s1->nb_loaded_dlls; diff --git a/tcc.h b/tcc.h index 687fb607..45e7b5b7 100644 --- a/tcc.h +++ b/tcc.h @@ -583,7 +583,7 @@ typedef struct DLLReference { int level; void *handle; unsigned char found, index; - char path[1]; + char name[1]; } DLLReference; /* -------------------------------------------------- */ @@ -1293,7 +1293,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *argc, char ***argv, int optind); #ifdef _WIN32 ST_FUNC char *normalize_slashes(char *path); #endif -ST_FUNC DLLReference *tcc_add_dllref(TCCState *s1, const char *dllpath, int level); +ST_FUNC DLLReference *tcc_add_dllref(TCCState *s1, const char *dllname, int level); ST_FUNC char *tcc_load_text(int fd); /* for #pragma once */ ST_FUNC int normalized_PATHCMP(const char *f1, const char *f2); diff --git a/tccelf.c b/tccelf.c index 8e11c1bf..ee3e6360 100644 --- a/tccelf.c +++ b/tccelf.c @@ -1056,17 +1056,9 @@ ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve) name = (char *) s1->symtab->link->data + sym->st_name; /* Use ld.so to resolve symbol for us (for tcc -run) */ if (do_resolve) { - void *addr = NULL; -#if defined(TCC_IS_NATIVE) -#if defined(TCC_TARGET_PE) - int i; - for (i = 0; i < s1->nb_loaded_dlls; i++) { - if ((addr = GetProcAddress(s1->loaded_dlls[i]->handle, name))) - break; - } -#else +#if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE /* dlsym() needs the undecorated name. */ - addr = dlsym(RTLD_DEFAULT, &name[s1->leading_underscore]); + void *addr = dlsym(RTLD_DEFAULT, &name[s1->leading_underscore]); #if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD || TARGETOS_ANDROID if (addr == NULL) { int i; @@ -1074,7 +1066,6 @@ ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve) if ((addr = dlsym(s1->loaded_dlls[i]->handle, name))) break; } -#endif #endif if (addr) { sym->st_value = (addr_t) addr; @@ -2910,7 +2901,7 @@ static int elf_output_file(TCCState *s1, const char *filename) for(i = 0; i < s1->nb_loaded_dlls; i++) { DLLReference *dllref = s1->loaded_dlls[i]; if (dllref->level == 0) - put_dt(dynamic, DT_NEEDED, put_elf_str(dynstr, tcc_basename(dllref->path))); + put_dt(dynamic, DT_NEEDED, put_elf_str(dynstr, dllref->name)); } if (s1->rpath) @@ -3732,7 +3723,7 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) soname = dynstr + dt->d_un.d_val; /* if the dll is already loaded, do not load it */ - if (tcc_add_dllref(s1, filename, level)->found) + if (tcc_add_dllref(s1, soname, level)->found) goto ret_success; if (v.nb_versyms != nb_syms) diff --git a/tccgen.c b/tccgen.c index a177c5ad..9bed2297 100644 --- a/tccgen.c +++ b/tccgen.c @@ -4696,29 +4696,14 @@ static int parse_btype(CType *type, AttributeDef *ad, int ignore_label) } next(); break; -#ifdef TCC_TARGET_ARM64 - case TOK_UINT128: - /* GCC's __uint128_t appears in some Linux header files. Make it a - synonym for long double to get the size and alignment right. */ - u = VT_LDOUBLE; - goto basic_type; -#endif case TOK_BOOL: u = VT_BOOL; goto basic_type; case TOK_COMPLEX: tcc_error("_Complex is not yet supported"); case TOK_FLOAT: - /* macOS SDK uses it in math.h - fake the size and alignment - */ u = VT_FLOAT; - /* tcc_warning("_Float16 is not yet supported. Skipped."); - I hope no one really uses it in the wild. */ goto basic_type; - case TOK_FLOAT16: - u = VT_SHORT; - case TOK_DOUBLE: if ((t & (VT_BTYPE|VT_LONG)) == VT_LONG) { t = (t & ~(VT_BTYPE|VT_LONG)) | VT_LDOUBLE; diff --git a/tccmacho.c b/tccmacho.c index 47a8f2fe..0b70457c 100644 --- a/tccmacho.c +++ b/tccmacho.c @@ -1770,7 +1770,7 @@ static void collect_sections(TCCState *s1, struct macho *mo, const char *filenam for(i = 0; i < s1->nb_loaded_dlls; i++) { DLLReference *dllref = s1->loaded_dlls[i]; if (dllref->level == 0) - add_dylib(mo, tcc_basename(dllref->path)); + add_dylib(mo, dllref->name); } if (s1->rpath) { diff --git a/tccpe.c b/tccpe.c index 07a27c88..a77da08e 100644 --- a/tccpe.c +++ b/tccpe.c @@ -848,9 +848,7 @@ static void pe_build_imports(struct pe_info *pe) dllindex = p->dll_index; if (dllindex) - name = tcc_basename( - (dllref = pe->s1->loaded_dlls[dllindex-1]) - ->path); + name = tcc_basename((dllref = pe->s1->loaded_dlls[dllindex-1])->name); else name = "", dllref = NULL; @@ -886,7 +884,7 @@ static void pe_build_imports(struct pe_info *pe) if (pe->type == PE_RUN) { if (dllref) { if ( !dllref->handle ) - dllref->handle = LoadLibraryA(dllref->path); + dllref->handle = LoadLibraryA(dllref->name); v = (ADDR3264)GetProcAddress(dllref->handle, ordinal?(char*)0+ordinal:name); } if (!v) diff --git a/tcctok.h b/tcctok.h index 204df022..7815ce37 100644 --- a/tcctok.h +++ b/tcctok.h @@ -67,11 +67,6 @@ DEF(TOK_TYPEOF2, "__typeof") DEF(TOK_TYPEOF3, "__typeof__") DEF(TOK_LABEL, "__label__") - DEF(TOK_FLOAT16, "_Float16") - -#ifdef TCC_TARGET_ARM64 - DEF(TOK_UINT128, "__uint128_t") -#endif /*********************************************************************/ /* the following are not keywords. They are included to ease parsing */ @@ -106,10 +101,6 @@ DEF(TOK___NAN__, "__nan__") DEF(TOK___SNAN__, "__snan__") DEF(TOK___INF__, "__inf__") -#if defined TCC_TARGET_X86_64 - DEF(TOK___mzerosf, "__mzerosf") /* -0.0 */ - DEF(TOK___mzerodf, "__mzerodf") /* -0.0 */ -#endif /* attribute identifiers */ /* XXX: handle all tokens generically since speed is not critical */