define a X86_32_ASAN_BIT_OFFSET macro that defaults differently on netbsd/i386 than other x86-32 targets. fixes PR#56280.diff -r1.24 -r1.25 src/external/gpl3/gcc/dist/gcc/config/i386/i386.c
(mrg)
--- src/external/gpl3/gcc/dist/gcc/config/i386/i386.c 2021/04/11 00:02:13 1.24
+++ src/external/gpl3/gcc/dist/gcc/config/i386/i386.c 2021/07/11 22:41:38 1.25
@@ -1389,27 +1389,27 @@ ix86_legitimate_combined_insn (rtx_insn | @@ -1389,27 +1389,27 @@ ix86_legitimate_combined_insn (rtx_insn | |||
1389 | return false; | 1389 | return false; | |
1390 | } | 1390 | } | |
1391 | 1391 | |||
1392 | return true; | 1392 | return true; | |
1393 | } | 1393 | } | |
1394 | 1394 | |||
1395 | /* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */ | 1395 | /* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */ | |
1396 | 1396 | |||
1397 | static unsigned HOST_WIDE_INT | 1397 | static unsigned HOST_WIDE_INT | |
1398 | ix86_asan_shadow_offset (void) | 1398 | ix86_asan_shadow_offset (void) | |
1399 | { | 1399 | { | |
1400 | return TARGET_LP64 ? (TARGET_MACHO ? (HOST_WIDE_INT_1 << 44) | 1400 | return TARGET_LP64 ? (TARGET_MACHO ? (HOST_WIDE_INT_1 << 44) | |
1401 | : HOST_WIDE_INT_C (0x7fff8000)) | 1401 | : HOST_WIDE_INT_C (0x7fff8000)) | |
1402 | : (HOST_WIDE_INT_1 << 29); | 1402 | : (HOST_WIDE_INT_1 << X86_32_ASAN_BIT_OFFSET); | |
1403 | } | 1403 | } | |
1404 | 1404 | |||
1405 | /* Argument support functions. */ | 1405 | /* Argument support functions. */ | |
1406 | 1406 | |||
1407 | /* Return true when register may be used to pass function parameters. */ | 1407 | /* Return true when register may be used to pass function parameters. */ | |
1408 | bool | 1408 | bool | |
1409 | ix86_function_arg_regno_p (int regno) | 1409 | ix86_function_arg_regno_p (int regno) | |
1410 | { | 1410 | { | |
1411 | int i; | 1411 | int i; | |
1412 | enum calling_abi call_abi; | 1412 | enum calling_abi call_abi; | |
1413 | const int *parm_regs; | 1413 | const int *parm_regs; | |
1414 | 1414 | |||
1415 | if (!TARGET_64BIT) | 1415 | if (!TARGET_64BIT) |
--- src/external/gpl3/gcc/dist/gcc/config/i386/i386.h 2021/04/11 00:02:14 1.14
+++ src/external/gpl3/gcc/dist/gcc/config/i386/i386.h 2021/07/11 22:41:39 1.15
@@ -2965,18 +2965,21 @@ extern void debug_dispatch_window (int); | @@ -2965,18 +2965,21 @@ extern void debug_dispatch_window (int); | |||
2965 | #define IX86_HLE_RELEASE (1 << 17) | 2965 | #define IX86_HLE_RELEASE (1 << 17) | |
2966 | 2966 | |||
2967 | /* For switching between functions with different target attributes. */ | 2967 | /* For switching between functions with different target attributes. */ | |
2968 | #define SWITCHABLE_TARGET 1 | 2968 | #define SWITCHABLE_TARGET 1 | |
2969 | 2969 | |||
2970 | #define TARGET_SUPPORTS_WIDE_INT 1 | 2970 | #define TARGET_SUPPORTS_WIDE_INT 1 | |
2971 | 2971 | |||
2972 | #if !defined(GENERATOR_FILE) && !defined(IN_LIBGCC2) | 2972 | #if !defined(GENERATOR_FILE) && !defined(IN_LIBGCC2) | |
2973 | extern enum attr_cpu ix86_schedule; | 2973 | extern enum attr_cpu ix86_schedule; | |
2974 | 2974 | |||
2975 | #define NUM_X86_64_MS_CLOBBERED_REGS 12 | 2975 | #define NUM_X86_64_MS_CLOBBERED_REGS 12 | |
2976 | #endif | 2976 | #endif | |
2977 | 2977 | |||
2978 | /* Standard location for 32-bit ASAN shadow map. */ | |||
2979 | #define X86_32_ASAN_BIT_OFFSET 29 | |||
2980 | ||||
2978 | /* | 2981 | /* | |
2979 | Local variables: | 2982 | Local variables: | |
2980 | version-control: t | 2983 | version-control: t | |
2981 | End: | 2984 | End: | |
2982 | */ | 2985 | */ |
--- src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h 2021/04/11 00:02:14 1.14
+++ src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h 2021/07/11 22:41:39 1.15
@@ -119,13 +119,17 @@ along with GCC; see the file COPYING3. | @@ -119,13 +119,17 @@ along with GCC; see the file COPYING3. | |||
119 | #define TARGET_GAS 1 | 119 | #define TARGET_GAS 1 | |
120 | 120 | |||
121 | /* Default to pcc-struct-return, because this is the ELF abi and | 121 | /* Default to pcc-struct-return, because this is the ELF abi and | |
122 | we don't care about compatibility with older gcc versions. */ | 122 | we don't care about compatibility with older gcc versions. */ | |
123 | #define DEFAULT_PCC_STRUCT_RETURN 1 | 123 | #define DEFAULT_PCC_STRUCT_RETURN 1 | |
124 | 124 | |||
125 | #define HAVE_ENABLE_EXECUTE_STACK | 125 | #define HAVE_ENABLE_EXECUTE_STACK | |
126 | 126 | |||
127 | #define IX86_MAYBE_NO_LIBGCC_TFMODE | 127 | #define IX86_MAYBE_NO_LIBGCC_TFMODE | |
128 | 128 | |||
129 | /* Preserve i386 psABI */ | 129 | /* Preserve i386 psABI */ | |
130 | #undef PREFERRED_STACK_BOUNDARY_DEFAULT | 130 | #undef PREFERRED_STACK_BOUNDARY_DEFAULT | |
131 | #define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY | 131 | #define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY | |
132 | ||||
133 | /* NetBSD/x86 on 32-bit places the ASAN shadow map at 0x40000000. */ | |||
134 | #undef X86_32_ASAN_BIT_OFFSET | |||
135 | #define X86_32_ASAN_BIT_OFFSET 30 |
--- src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h 2021/04/11 00:02:14 1.14
+++ src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h 2021/07/11 22:41:39 1.15
@@ -63,13 +63,17 @@ along with GCC; see the file COPYING3. | @@ -63,13 +63,17 @@ along with GCC; see the file COPYING3. | |||
63 | fprintf (FILE, "\tcall __mcount@PLT\n"); \ | 63 | fprintf (FILE, "\tcall __mcount@PLT\n"); \ | |
64 | else if (flag_pic) \ | 64 | else if (flag_pic) \ | |
65 | fprintf (FILE, "\tcall __mcount@PLT\n"); \ | 65 | fprintf (FILE, "\tcall __mcount@PLT\n"); \ | |
66 | else \ | 66 | else \ | |
67 | fprintf (FILE, "\tcall __mcount\n"); \ | 67 | fprintf (FILE, "\tcall __mcount\n"); \ | |
68 | } | 68 | } | |
69 | 69 | |||
70 | /* Preserve i386 psABI */ | 70 | /* Preserve i386 psABI */ | |
71 | #undef PREFERRED_STACK_BOUNDARY_DEFAULT | 71 | #undef PREFERRED_STACK_BOUNDARY_DEFAULT | |
72 | #define PREFERRED_STACK_BOUNDARY_DEFAULT \ | 72 | #define PREFERRED_STACK_BOUNDARY_DEFAULT \ | |
73 | ((TARGET_64BIT || TARGET_SSE) ? 128 : 32) | 73 | ((TARGET_64BIT || TARGET_SSE) ? 128 : 32) | |
74 | 74 | |||
75 | #define HAVE_ENABLE_EXECUTE_STACK | 75 | #define HAVE_ENABLE_EXECUTE_STACK | |
76 | ||||
77 | /* NetBSD/x86 on 32-bit places the ASAN shadow map at 0x40000000. */ | |||
78 | #undef X86_32_ASAN_BIT_OFFSET | |||
79 | #define X86_32_ASAN_BIT_OFFSET 30 |