Showing with 28 additions and 7 deletions.
  1. +9 −1 src/backend/backconfig.c
  2. +6 −6 src/backend/cc.h
  3. +13 −0 src/backend/cdef.h
10 changes: 9 additions & 1 deletion src/backend/backconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void out_config_init(
if (model == 64)
{ config.exe = EX_WIN64;
config.fpxmmregs = TRUE;
config.ehmethod = EH_DM;

// Not sure we really need these two lines, try removing them later
config.flags |= CFGnoebp;
Expand All @@ -79,7 +80,9 @@ void out_config_init(
config.objfmt = OBJ_MSCOFF;
}
else
{ config.exe = EX_NT;
{
config.exe = EX_NT;
config.ehmethod = EH_WIN32;
config.flags2 |= CFG2seh; // Win32 eh
config.objfmt = mscoff ? OBJ_MSCOFF : OBJ_OMF;
}
Expand All @@ -106,6 +109,7 @@ void out_config_init(
config.flags |= CFGalwaysframe; // PIC needs a frame for TLS fixups
}
config.objfmt = OBJ_ELF;
config.ehmethod = EH_DM;
#endif
#if TARGET_OSX
config.fpxmmregs = TRUE;
Expand All @@ -124,6 +128,7 @@ void out_config_init(
}
config.flags |= CFGromable; // put switch tables in code segment
config.objfmt = OBJ_MACH;
config.ehmethod = EH_DM;
#endif
#if TARGET_FREEBSD
if (model == 64)
Expand All @@ -143,6 +148,7 @@ void out_config_init(
config.flags |= CFGalwaysframe; // PIC needs a frame for TLS fixups
}
config.objfmt = OBJ_ELF;
config.ehmethod = EH_DM;
#endif
#if TARGET_OPENBSD
if (model == 64)
Expand All @@ -160,6 +166,7 @@ void out_config_init(
if (!exe)
config.flags3 |= CFG3pic;
config.objfmt = OBJ_ELF;
config.ehmethod = EH_DM;
#endif
#if TARGET_SOLARIS
if (model == 64)
Expand All @@ -177,6 +184,7 @@ void out_config_init(
if (!exe)
config.flags3 |= CFG3pic;
config.objfmt = OBJ_ELF;
config.ehmethod = EH_DM;
#endif
config.flags2 |= CFG2nodeflib; // no default library
config.flags3 |= CFG3eseqds;
Expand Down
12 changes: 6 additions & 6 deletions src/backend/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ typedef struct block
struct
{
#if MARS
Symbol *jcatchvar; // __j_throw() fills in this
Symbol *jcatchvar; // __d_throw() fills in this
#define jcatchvar BS.BI_TRY.jcatchvar
#endif
int Bscope_index; // index into scope table
Expand All @@ -446,7 +446,7 @@ typedef struct block
} BS;
Srcpos Bsrcpos; // line number (0 if not known)
unsigned char BC; // exit condition (enum BC)
// NEW

unsigned char Balign; // alignment

unsigned short Bflags; // flags (BFLxxxx)
Expand Down Expand Up @@ -592,13 +592,13 @@ enum BC {
BCcatch = 11, // C++ catch block
BCjump = 12, // Belem specifies (near) address to jump to
BC_try = 13, // SEH: first block of try-except or try-finally
// Mars: try-catch or try-finally
// D: try-catch or try-finally
BC_filter = 14, // SEH exception-filter (always exactly one block)
BC_finally = 15, // first block of SEH termination-handler,
// or finally block
BC_ret = 16, // last block of SEH termination-handler or finally block
// or D finally block
BC_ret = 16, // last block of SEH termination-handler or D _finally block
BC_except = 17, // first block of SEH exception-handler
BCjcatch = 18, // first block of Mars catch-block
BCjcatch = 18, // D catch block
BCMAX
};

Expand Down
13 changes: 13 additions & 0 deletions src/backend/cdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,18 @@ typedef enum LINKAGE
LINK_MAXDIM /* array dimension */
} linkage_t;

/**********************************
* Exception handling method
*/

enum EHmethod
{
EH_NONE, // no exception handling
EH_WIN32, // Win32 SEH
EH_WIN64, // Win64 SEH (not supported yet)
EH_DM, // Digital Mars method
EH_DWARF, // Dwarf method
};

// This part of the configuration is saved in the precompiled header for use
// in comparing to make sure it hasn't changed.
Expand Down Expand Up @@ -837,6 +849,7 @@ struct Config
#define THRESHMAX 0xFFFF // if threshold == THRESHMAX, all data defaults
// to near
enum LINKAGE linkage; // default function call linkage
enum EHmethod ehmethod; // exception handling method
};

// Configuration that is not saved in precompiled header
Expand Down