Skip to content

Commit

Permalink
Merge branch 'mob'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Oct 20, 2024
2 parents a96ec91 + d7f9166 commit d287390
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 195 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,44 @@ jobs:
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- name: make & test tcc
- name: make & test tcc (x86_64-linux)
run: ./configure && make && make test -k

test-x86_64-osx:
runs-on: macos-12
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- name: make & test tcc
run: ./configure --config-codesign=no && make && make test -k
- name: make & test tcc (x86_64-osx)
run: ./configure && make && make test -k

test-aarch64-osx:
runs-on: macos-14
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- name: make & test tcc (aarch64-osx)
run: ./configure && make && make test -k

test-x86_64-win32:
test-x86-win32:
runs-on: windows-2019
timeout-minutes: 4
timeout-minutes: 6
steps:
- uses: actions/checkout@v4
- name: make & test tcc
- name: make & test tcc (x86_64-win32)
shell: cmd
run: |
set MSYS2_PATH_TYPE=inherit
set MSYSTEM=MINGW64
set CHERE_INVOKING=yes
C:\msys64\usr\bin\bash -l -c "./configure && make && make test -k"
- name: make & test tcc (i386-win32)
shell: cmd
run: |
set MSYS2_PATH_TYPE=inherit
set MSYSTEM=MINGW32
set CHERE_INVOKING=yes
C:\msys64\usr\bin\bash -l -c "./configure && make clean all && make test -k"
test-x86_64-centos:
runs-on: ubuntu-latest
Expand All @@ -59,6 +74,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2
name: make & test tcc (armv7-linux)
with:
arch: armv7
distro: ubuntu20.04
Expand All @@ -76,6 +92,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2
name: make & test tcc (aarch64-linux)
with:
arch: aarch64
distro: ubuntu20.04
Expand All @@ -93,6 +110,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2
name: make & test tcc (riscv64-linux)
with:
arch: riscv64
distro: ubuntu20.04
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ else
ifdef CONFIG_OSX
NATIVE_TARGET = $(ARCH)-osx
ifneq ($(CC_NAME),tcc)
LDFLAGS += -flat_namespace -undefined warning
LDFLAGS += -flat_namespace
ifneq (1,$(shell expr $(GCC_MAJOR) ">=" 15))
LDFLAGS += -undefined warning # depreciated in clang >= 15.0
endif
endif
export MACOSX_DEPLOYMENT_TARGET := 10.6
endif
Expand Down
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ fi

# OS specific
buildos=$(uname)
cpu_sys=$(uname -m)

case $buildos in
Windows_NT|MINGW*|MSYS*|CYGWIN*)
buildos="WIN32"
test "$MSYSTEM" = "MINGW32" && cpu_sys=i386
;;
Linux)
if test "$(uname -o)" = "Android"; then
Expand All @@ -248,7 +250,6 @@ else
default targetos "$buildos"
fi

cpu_sys=$(uname -m)
default cpu "$cpu_sys"
cpu_set="$cpu"

Expand Down
1 change: 1 addition & 0 deletions include/tccdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
#define __PRETTY_FUNCTION__ __FUNCTION__
#define __has_builtin(x) 0
#define __has_feature(x) 0
#define __has_attribute(x) 0
/* C23 Keywords */
#define _Nonnull
#define _Nullable
Expand Down
3 changes: 1 addition & 2 deletions tcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ static const char help[] =
" -o outfile set output filename\n"
" -run run compiled source\n"
" -fflag set or reset (with 'no-' prefix) 'flag' (see tcc -hh)\n"
" -std=(c99|gnu99) Conform to the ISO 1999 C standard (default).\n"
" -std=(c11|gnu11) Conform to the ISO 2011 C standard.\n"
" -Wwarning set or reset (with 'no-' prefix) 'warning' (see tcc -hh)\n"
" -w disable all warnings\n"
" -v --version show version\n"
Expand Down Expand Up @@ -69,6 +67,7 @@ static const char help[] =
" -bt[N] link with backtrace (stack dump) support [show max N callers]\n"
#endif
"Misc. options:\n"
" -std=version define __STDC_VERSION__ according to version (c11/gnu11)\n"
" -x[c|a|b|n] specify type of the next infile (C,ASM,BIN,NONE)\n"
" -nostdinc do not use standard system include paths\n"
" -nostdlib do not link with standard crt and libraries\n"
Expand Down
18 changes: 12 additions & 6 deletions tccasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ static void asm_parse_directive(TCCState *s1, int global)
{
char sname[256];
int old_nb_section = s1->nb_sections;
int flags = SHF_ALLOC;

tok1 = tok;
/* XXX: support more options */
Expand All @@ -870,10 +871,17 @@ static void asm_parse_directive(TCCState *s1, int global)
next();
}
if (tok == ',') {
const char *p;
/* skip section options */
next();
if (tok != TOK_STR)
expect("string constant");
for (p = tokc.str.data; *p; ++p) {
if (*p == 'w')
flags |= SHF_WRITE;
if (*p == 'x')
flags |= SHF_EXECINSTR;
}
next();
if (tok == ',') {
next();
Expand All @@ -883,19 +891,17 @@ static void asm_parse_directive(TCCState *s1, int global)
}
}
last_text_section = cur_text_section;
if (tok1 == TOK_ASMDIR_section) {
if (tok1 == TOK_ASMDIR_section)
use_section(s1, sname);
/* The section directive supports flags, but they are unsupported.
For now, just assume any section contains code. */
cur_text_section->sh_flags |= SHF_EXECINSTR;
}
else
push_section(s1, sname);
/* If we just allocated a new section reset its alignment to
1. new_section normally acts for GCC compatibility and
sets alignment to PTR_SIZE. The assembler behaves different. */
if (old_nb_section != s1->nb_sections)
if (old_nb_section != s1->nb_sections) {
cur_text_section->sh_addralign = 1;
cur_text_section->sh_flags = flags;
}
}
break;
case TOK_ASMDIR_previous:
Expand Down
Loading

0 comments on commit d287390

Please sign in to comment.