diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | sys/cmd/cc/ast.c | 3 | ||||
-rw-r--r-- | sys/cmd/cc/cc.h | 3 |
3 files changed, 10 insertions, 6 deletions
@@ -12,15 +12,15 @@ OBJ_DIR := build TST_DIR := test # C runtime library -# CINIT := $(LIB_DIR)/crt/crt1.o $(LIB_DIR)/crt/x86_64/crti.o `gcc --print-file-name=crtbeginS.o` -# CFINI := `gcc --print-file-name=crtendS.o` $(LIB_DIR)/crt/x86_64/crtn.o +CINIT := $(LIB_DIR)/crt/crt1.o $(LIB_DIR)/crt/x86_64/crti.o `gcc --print-file-name=crtbeginS.o` +CFINI := `gcc --print-file-name=crtendS.o` $(LIB_DIR)/crt/x86_64/crtn.o # Flags, Libraries and Includes CFLAGS := -g -march=native -fno-strict-aliasing -fwrapv -fms-extensions -# STATIC := -static -nodefaultlibs -nostartfiles +STATIC := -static -nodefaultlibs -nostartfiles AFLAGS := -f elf64 -INCS := -I $(INC_DIR) #-isystem $(INC_DIR)/vendor/libc -ELIBS := #-L$(LIB_DIR) #-lc +INCS := -I $(INC_DIR) -isystem $(INC_DIR)/vendor/libc +ELIBS := -L$(LIB_DIR) -lc # Named generic rules (must be evaluated lazily) COMPILE = @echo "CC "$@;\ diff --git a/sys/cmd/cc/ast.c b/sys/cmd/cc/ast.c index 6a3ed9f..14eddb9 100644 --- a/sys/cmd/cc/ast.c +++ b/sys/cmd/cc/ast.c @@ -1689,6 +1689,9 @@ spec(Parser *p, Lexer *lx, uint64 *spec) } if (name) declaretag(p, tag, name); + + /* NOTE: This offset is needed to correctly obtain Tstruct */ + n++; break; default: diff --git a/sys/cmd/cc/cc.h b/sys/cmd/cc/cc.h index de1ec3f..8fc5f73 100644 --- a/sys/cmd/cc/cc.h +++ b/sys/cmd/cc/cc.h @@ -528,8 +528,9 @@ enum Mreg = iota(Kregister), Mtls = iota(Ktls), Mtype = iota(Ktypedef), + Mextern = iota(Kextern), - MaskMem = Mauto | Mstatic | Mreg | Mtls | Mtype, + MaskMem = Mauto | Mstatic | Mreg | Mtls | Mtype | Mextern, /* qualifiers */ Qconst = iota(Kconst), |