char const *orig_opt;
GET_ARG_AFTER(orig_opt, "-f");
- if (strstart(orig_opt, "align-loops=") ||
- strstart(orig_opt, "align-jumps=") ||
- strstart(orig_opt, "align-functions=")) {
- fprintf(stderr, "ignoring gcc option '-f%s'\n", orig_opt);
- } else if (strstart(orig_opt, "input-charset=")) {
+ if (strstart(orig_opt, "input-charset=")) {
char const* const encoding = strchr(orig_opt, '=') + 1;
select_input_encoding(encoding);
} else if (streq(orig_opt, "verbose-asm")) {
mode = truth_value ? ParseOnly : CompileAssembleLink;
} else if (streq(opt, "unsigned-char")) {
char_is_signed = !truth_value;
+ } else if (truth_value == false &&
+ streq(opt, "asynchronous-unwind-tables")) {
+ /* nothing todo, a gcc feature which we don't support
+ * anyway was deactivated */
+ } else if (strstart(orig_opt, "align-loops=") ||
+ strstart(orig_opt, "align-jumps=") ||
+ strstart(orig_opt, "align-functions=")) {
+ fprintf(stderr, "ignoring gcc option '-f%s'\n", orig_opt);
} else if (streq(opt, "fast-math") ||
streq(opt, "jump-tables") ||
streq(opt, "expensive-optimizations") ||
streq(opt, "common") ||
- streq(opt, "PIC") ||
+ streq(opt, "optimize-sibling-calls") ||
streq(opt, "align-loops") ||
streq(opt, "align-jumps") ||
streq(opt, "align-functions")) {
set_be_option("omitleaffp=0");
} else if (streq(opt, "rtd")) {
default_calling_convention = CC_STDCALL;
+ } else if (strstart(opt, "regparm=")) {
+ fprintf(stderr, "error: regparm convention not supported yet\n");
+ argument_errors = true;
+ } else if (streq(opt, "soft-float")) {
+ fprintf(stderr, "error: software floatingpoint not supported yet\n");
+ argument_errors = true;
} else {
char *endptr;
long int value = strtol(opt, &endptr, 10);
assert(is_declaration(entity));
if (entity->kind == ENTITY_FUNCTION) {
+ type_t *type = skip_typeref(entity->declaration.type);
+ assert(is_type_function(type));
+
if (entity->declaration.modifiers & DM_DLLIMPORT)
/* add prefix for imported symbols */
obstack_printf(o, "__imp_");
- cc_kind_t cc = entity->declaration.type->function.calling_convention;
+ cc_kind_t cc = type->function.calling_convention;
/* calling convention prefix */
switch (cc) {
- case CC_DEFAULT:
- case CC_CDECL:
- case CC_STDCALL: obstack_1grow(o, '_'); break;
- case CC_FASTCALL: obstack_1grow(o, '@'); break;
- default: panic("unhandled calling convention");
+ case CC_DEFAULT:
+ case CC_CDECL:
+ case CC_STDCALL: obstack_1grow(o, '_'); break;
+ case CC_FASTCALL: obstack_1grow(o, '@'); break;
+ default: panic("unhandled calling convention");
}
- switch (entity->declaration.type->function.linkage) {
- case LINKAGE_INVALID:
- panic("linkage type of function is invalid");
+ switch (type->function.linkage) {
+ case LINKAGE_INVALID:
+ panic("linkage type of function is invalid");
- case LINKAGE_C:
- obstack_printf(o, "%s", entity->base.symbol->string);
- break;
+ case LINKAGE_C:
+ obstack_printf(o, "%s", entity->base.symbol->string);
+ break;
- case LINKAGE_CXX:
- mangle_entity(entity);
- break;
+ case LINKAGE_CXX:
+ mangle_entity(entity);
+ break;
}
/* calling convention suffix */
switch (cc) {
- case CC_DEFAULT:
- case CC_CDECL:
- break;
-
- case CC_STDCALL:
- case CC_FASTCALL: {
- ir_type *irtype = get_ir_type(entity->declaration.type);
- unsigned size = 0;
- for (int i = get_method_n_params(irtype) - 1; i >= 0; --i) {
- size += get_type_size_bytes(get_method_param_type(irtype, i));
- }
- obstack_printf(o, "@%u", size);
- break;
+ case CC_DEFAULT:
+ case CC_CDECL:
+ break;
+
+ case CC_STDCALL:
+ case CC_FASTCALL: {
+ ir_type *irtype = get_ir_type(entity->declaration.type);
+ unsigned size = 0;
+ for (int i = get_method_n_params(irtype) - 1; i >= 0; --i) {
+ size += get_type_size_bytes(get_method_param_type(irtype, i));
}
+ obstack_printf(o, "@%u", size);
+ break;
+ }
- default:
- panic("unhandled calling convention");
+ default:
+ panic("unhandled calling convention");
}
} else {
obstack_printf(o, "_%s", entity->base.symbol->string);
bool needs_mangling = false;
if (entity->kind == ENTITY_FUNCTION) {
- switch (entity->declaration.type->function.linkage) {
+ type_t *type = skip_typeref(entity->declaration.type);
+ assert(is_type_function(type));
+ switch (type->function.linkage) {
case LINKAGE_INVALID:
panic("linkage type of function is invalid");
- case LINKAGE_C: break;
- case LINKAGE_CXX: needs_mangling = true; break;
+ case LINKAGE_C: break;
+ case LINKAGE_CXX: needs_mangling = true; break;
}
}
*/
ident *create_name_macho(entity_t *entity)
{
- if (entity->kind == ENTITY_FUNCTION && entity->declaration.type->function.linkage == LINKAGE_INVALID)
- panic("linkage type of function is invalid");
+ if (entity->kind == ENTITY_FUNCTION) {
+ type_t *type = skip_typeref(entity->declaration.type);
+ assert(is_type_function(type));
+ if (type->function.linkage == LINKAGE_INVALID)
+ panic("linkage type of function is invalid");
+ }
obstack_printf(&obst, "_%s", entity->base.symbol->string);
return make_id_from_obst();