/** atomic type of wchar_t */
extern atomic_type_kind_t wchar_atomic_kind;
-/** size of long double (this is 16 on some x86 architectures even if only the
- * lowest 80bits are used */
-extern unsigned force_long_double_size;
+/** size of long double in bits (this is the size stored to memory, not
+ * necessary the precision of the arithmetic) */
+extern unsigned long_double_size;
/** a hack that adds a call to __main into the main function, necessary on
* mingw */
bool strict_mode = false;
bool use_builtins = false;
atomic_type_kind_t wchar_atomic_kind = ATOMIC_TYPE_INT;
-unsigned force_long_double_size = 0;
+unsigned long_double_size = 0;
bool enable_main_collect2_hack = false;
bool freestanding = false;
{
const char *os = target_machine->operating_system;
wchar_atomic_kind = ATOMIC_TYPE_INT;
- force_long_double_size = 0;
enable_main_collect2_hack = false;
define_intmax_types = false;
|| streq(os, "solaris")) {
set_create_ld_ident(create_name_linux_elf);
} else if (streq(os, "darwin")) {
- force_long_double_size = 16;
+ long_double_size = 16;
set_create_ld_ident(create_name_macho);
define_intmax_types = true;
} else if (strstr(os, "mingw") != NULL || streq(os, "win32")) {
{
if (!setup_firm_for_machine(target_machine))
exit(1);
+
+ const backend_params *be_params = be_get_backend_param();
+ if (be_params->long_double_size % 8 != 0) {
+ fprintf(stderr, "firm-target long double size is not a multiple of 8, can't handle this\n");
+ exit(1);
+ }
+
+ byte_order_big_endian = be_params->byte_order_big_endian;
+ machine_size = be_params->machine_size;
+ long_double_size = be_params->long_double_size / 8;
+
init_os_support();
}
fprintf(stderr, "error: option -m supports only 16, 32 or 64\n");
argument_errors = true;
} else {
- machine_size = (unsigned int)value;
add_flag(&cppflags_obst, "-m%u", machine_size);
add_flag(&asflags_obst, "-m%u", machine_size);
add_flag(&ldflags_obst, "-m%u", machine_size);
+ /* TODO: choose/change backend based on this */
}
}
} else if (streq(option, "pg")) {
}
gen_firm_init();
- byte_order_big_endian = be_get_backend_param()->byte_order_big_endian;
init_symbol_table();
init_types();
init_typehash();
| ATOMIC_TYPE_FLAG_SIGNED,
},
[ATOMIC_TYPE_LONG_DOUBLE] = {
- .size = 12,
+ .size = (unsigned) -1, /* will be filled in later */
.alignment = (unsigned) -1,
.flags = ATOMIC_TYPE_FLAG_FLOAT | ATOMIC_TYPE_FLAG_ARITHMETIC
| ATOMIC_TYPE_FLAG_SIGNED,
props[ATOMIC_TYPE_LONGLONG].alignment = 8;
props[ATOMIC_TYPE_ULONGLONG].alignment = 8;
}
- if (force_long_double_size > 0) {
- props[ATOMIC_TYPE_LONG_DOUBLE].size = force_long_double_size;
- props[ATOMIC_TYPE_LONG_DOUBLE].alignment = force_long_double_size;
+
+ if (long_double_size > 0) {
+ props[ATOMIC_TYPE_LONG_DOUBLE].size = long_double_size;
+ props[ATOMIC_TYPE_LONG_DOUBLE].alignment = long_double_size;
+ } else {
+ props[ATOMIC_TYPE_LONG_DOUBLE] = props[ATOMIC_TYPE_DOUBLE];
}
/* TODO: make this configurable for platforms which do not use byte sized