- /* OS option must be set to the backend */
- switch (firm_opt.os_support) {
- case OS_SUPPORT_MINGW:
- set_be_option("ia32-gasmode=mingw");
- wchar_atomic_kind = ATOMIC_TYPE_USHORT;
- break;
- case OS_SUPPORT_LINUX:
- set_be_option("ia32-gasmode=elf");
- break;
- case OS_SUPPORT_MACHO:
- set_be_option("ia32-gasmode=macho");
- set_be_option("ia32-stackalign=4");
- set_be_option("pic");
- break;
+ 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;
+
+ if (strstr(os, "linux") != NULL || strstr(os, "bsd") != NULL
+ || streq(os, "solaris")) {
+ set_create_ld_ident(create_name_linux_elf);
+ } else if (streq(os, "darwin")) {
+ force_long_double_size = 16;
+ set_create_ld_ident(create_name_macho);
+ define_intmax_types = true;
+ } else if (strstr(os, "mingw") != NULL || streq(os, "win32")) {
+ wchar_atomic_kind = ATOMIC_TYPE_USHORT;
+ enable_main_collect2_hack = true;
+ set_create_ld_ident(create_name_win32);
+ } else {
+ return false;