diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-02-08 23:15:49 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-02-13 09:34:46 +0800 |
| commit | 5cefe205883d280e8f5a395cb6a185113457bbe3 (patch) | |
| tree | 702cbe5d75c5314a4089e1cf63854352ed8a0cf1 | |
| parent | e460239ea1bc22517e1e62dabd24e9e9ddb66c15 (diff) | |
| download | sparse-dev-5cefe205883d280e8f5a395cb6a185113457bbe3.tar.gz | |
add support for LLP64 arch
There was recently on the mailing list some questions
and a need to support LLP64 model.
This patch add is by adjusting a few size-related variables
under the control of a new flag: -msize-llp64 (ugly name
but we already have we have '-msize-long').
CC: Dibyendu Majumdar <mobile@majumdar.org.uk>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
| -rw-r--r-- | lib.c | 34 |
1 files changed, 27 insertions, 7 deletions
@@ -257,10 +257,14 @@ static enum { STANDARD_C89, STANDARD_GNU89, STANDARD_GNU99, } standard = STANDARD_GNU89; +#define ARCH_LP32 0 +#define ARCH_LP64 1 +#define ARCH_LLP64 2 + #ifdef __x86_64__ -#define ARCH_M64_DEFAULT 1 +#define ARCH_M64_DEFAULT ARCH_LP64 #else -#define ARCH_M64_DEFAULT 0 +#define ARCH_M64_DEFAULT ARCH_LP32 #endif int arch_m64 = ARCH_M64_DEFAULT; @@ -387,9 +391,11 @@ static char **handle_multiarch_dir(char *arg, char **next) static char **handle_switch_m(char *arg, char **next) { if (!strcmp(arg, "m64")) { - arch_m64 = 1; + arch_m64 = ARCH_LP64; } else if (!strcmp(arg, "m32")) { - arch_m64 = 0; + arch_m64 = ARCH_LP32; + } else if (!strcmp(arg, "msize-llp64")) { + arch_m64 = ARCH_LLP64; } else if (!strcmp(arg, "msize-long")) { arch_msize_long = 1; } else if (!strcmp(arg, "multiarch-dir")) @@ -399,18 +405,32 @@ static char **handle_switch_m(char *arg, char **next) static void handle_arch_m64_finalize(void) { - if (arch_m64) { + switch (arch_m64) { + case ARCH_LP32: + /* default values */ + return; + case ARCH_LP64: bits_in_long = 64; max_int_alignment = 8; - bits_in_pointer = 64; - pointer_alignment = 8; size_t_ctype = &ulong_ctype; ssize_t_ctype = &long_ctype; add_pre_buffer("#weak_define __LP64__ 1\n"); add_pre_buffer("#weak_define _LP64 1\n"); + goto case_64bit_common; + case ARCH_LLP64: + bits_in_long = 32; + max_int_alignment = 4; + size_t_ctype = &ullong_ctype; + ssize_t_ctype = &llong_ctype; + add_pre_buffer("#weak_define __LLP64__ 1\n"); + goto case_64bit_common; + case_64bit_common: + bits_in_pointer = 64; + pointer_alignment = 8; #ifdef __x86_64__ add_pre_buffer("#weak_define __x86_64__ 1\n"); #endif + break; } } |
