aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
diff options
context:
space:
mode:
authorgrischka <grischka>2017-05-13 08:59:06 +0200
committergrischka <grischka>2017-05-13 08:59:06 +0200
commit28435ec58c2ef9bb571cad5f8a1129aea3ecc204 (patch)
treea08b77f90c9c24972e0fccd6c223af73b5b240f6 /tcc.h
parent3a9d6b3655bd15e752e65a4f0f23f64f4ec56fe1 (diff)
downloadtinycc-28435ec58c2ef9bb571cad5f8a1129aea3ecc204.tar.gz
tinycc-28435ec58c2ef9bb571cad5f8a1129aea3ecc204.tar.bz2
configure: --config-musl/-uClibc switch & misc cleanups
- configure: - add --config-uClibc,-musl switch and suggest to use it if uClibc/musl is detected - make warning options magic clang compatible - simplify (use $confvars instead of individual options) - Revert "Remove some unused-parameter lint" 7443db0d5f841b81a55e918bf8c228dd20f9ddb2 rather use -Wno-unused-parameter (or just not -Wextra) - #ifdef functions that are unused on some targets - tccgen.c: use PTR_SIZE==8 instead of (X86_64 || ARM64) - tccpe.c: fix some warnings - integrate dummy arm-asm better
Diffstat (limited to 'tcc.h')
-rw-r--r--tcc.h59
1 files changed, 28 insertions, 31 deletions
diff --git a/tcc.h b/tcc.h
index 5f7bd10..cbced87 100644
--- a/tcc.h
+++ b/tcc.h
@@ -122,10 +122,10 @@
/* target selection */
/* #define TCC_TARGET_I386 *//* i386 code generator */
+/* #define TCC_TARGET_X86_64 *//* x86-64 code generator */
/* #define TCC_TARGET_ARM *//* ARMv4 code generator */
/* #define TCC_TARGET_ARM64 *//* ARMv8 code generator */
/* #define TCC_TARGET_C67 *//* TMS320C67xx code generator */
-/* #define TCC_TARGET_X86_64 *//* x86-64 code generator */
/* default target is I386 */
#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \
@@ -134,18 +134,6 @@
#define TCC_TARGET_I386
#endif
-#if !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \
- !defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_C67) && \
- !defined(CONFIG_USE_LIBGCC) && !defined(TCC_MUSL)
-#define CONFIG_TCC_BCHECK /* enable bound checking code */
-#endif
-
-/* define it to include assembler support */
-#if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_ARM64) && \
- !defined(TCC_TARGET_C67)
-#define CONFIG_TCC_ASM
-#endif
-
/* object format selection */
#if defined(TCC_TARGET_C67)
#define TCC_TARGET_COFF
@@ -166,6 +154,10 @@
#if defined TCC_IS_NATIVE && !defined CONFIG_TCCBOOT
# define CONFIG_TCC_BACKTRACE
+# if (defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64) \
+ && !defined TCC_UCLIBC && !defined TCC_MUSL
+# define CONFIG_TCC_BCHECK /* enable bound checking code */
+# endif
#endif
/* ------------ path configuration ------------ */
@@ -282,24 +274,6 @@
#include "elf.h"
#include "stab.h"
-#if defined(TCC_TARGET_ARM64) || defined(TCC_TARGET_X86_64)
-# define ELFCLASSW ELFCLASS64
-# define ElfW(type) Elf##64##_##type
-# define ELFW(type) ELF##64##_##type
-# define ElfW_Rel ElfW(Rela)
-# define SHT_RELX SHT_RELA
-# define REL_SECTION_FMT ".rela%s"
-#else
-# define ELFCLASSW ELFCLASS32
-# define ElfW(type) Elf##32##_##type
-# define ELFW(type) ELF##32##_##type
-# define ElfW_Rel ElfW(Rel)
-# define SHT_RELX SHT_REL
-# define REL_SECTION_FMT ".rel%s"
-#endif
-/* target address type */
-#define addr_t ElfW(Addr)
-
/* -------------------------------------------- */
#ifndef PUB_FUNC /* functions used by tcc.c but not in libtcc.h */
@@ -335,6 +309,7 @@
#ifdef TCC_TARGET_ARM
# include "arm-gen.c"
# include "arm-link.c"
+# include "arm-asm.c"
#endif
#ifdef TCC_TARGET_ARM64
# include "arm64-gen.c"
@@ -349,6 +324,26 @@
/* -------------------------------------------- */
+#if PTR_SIZE == 8
+# define ELFCLASSW ELFCLASS64
+# define ElfW(type) Elf##64##_##type
+# define ELFW(type) ELF##64##_##type
+# define ElfW_Rel ElfW(Rela)
+# define SHT_RELX SHT_RELA
+# define REL_SECTION_FMT ".rela%s"
+#else
+# define ELFCLASSW ELFCLASS32
+# define ElfW(type) Elf##32##_##type
+# define ELFW(type) ELF##32##_##type
+# define ElfW_Rel ElfW(Rel)
+# define SHT_RELX SHT_REL
+# define REL_SECTION_FMT ".rel%s"
+#endif
+/* target address type */
+#define addr_t ElfW(Addr)
+
+/* -------------------------------------------- */
+
#define INCLUDE_STACK_SIZE 32
#define IFDEF_STACK_SIZE 64
#define VSTACK_SIZE 256
@@ -1390,7 +1385,9 @@ ST_FUNC Section *new_symtab(TCCState *s1, const char *symtab_name, int sh_type,
ST_FUNC void put_extern_sym2(Sym *sym, Section *section, addr_t value, unsigned long size, int can_add_underscore);
ST_FUNC void put_extern_sym(Sym *sym, Section *section, addr_t value, unsigned long size);
+#if PTR_SIZE == 4
ST_FUNC void greloc(Section *s, Sym *sym, unsigned long offset, int type);
+#endif
ST_FUNC void greloca(Section *s, Sym *sym, unsigned long offset, int type, addr_t addend);
ST_FUNC int put_elf_str(Section *s, const char *sym);