--- gcc/config/m68k/next.h 2018/04/24 18:10:24 1.1 +++ gcc/config/m68k/next.h 2018/04/24 18:14:29 1.1.1.2 @@ -33,7 +33,7 @@ the Free Software Foundation, 675 Mass A /* Names to predefine in the preprocessor for this target machine. */ -#define CPP_PREDEFINES "-Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"m68k\"" +#define CPP_PREDEFINES "-Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"m68k\" -Asystem(unix) -Asystem(mach) -Acpu(m68k) -Amachine(m68k)" /* Every structure or union's size must be a multiple of 2 bytes. (Why isn't this in m68k.h?) */ @@ -181,3 +181,26 @@ the Free Software Foundation, 675 Mass A #define OBJC_FORWARDING_STACK_OFFSET 8 #define OBJC_FORWARDING_MIN_OFFSET 8 + +/* INITIALIZE_TRAMPOLINE is changed so that it also enables executable + stack. The __enable_execute_stack also clears the insn cache. */ + +/* NOTE: part of this is copied from m68k.h */ +#undef INITIALIZE_TRAMPOLINE +#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ +{ \ + rtx _addr, _func; \ + emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), TRAMP); \ + emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 18)), CXT); \ + emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 22)), FNADDR); \ + _addr = memory_address (SImode, (TRAMP)); \ + _func = gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"); \ + emit_library_call (_func, 0, VOIDmode, 1, _addr, Pmode); \ +} + +/* A C expression used to clear the instruction cache from + address BEG to address END. On NeXTSTEP this i a system trap. */ + +#define CLEAR_INSN_CACHE(BEG, END) \ + asm volatile ("trap #2") +