File gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch of Package cross-m68k-gcc7
206
1
From c3982f5bddf56bbc96d838ea35540eae81504bb3 Mon Sep 17 00:00:00 2001
2
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
3
Date: Fri, 16 Nov 2018 23:53:30 +0000
4
Subject: [PATCH 08/22] Backport: ICE: segmentation fault with
5
patchable_function_entry attribute for msp430-elf -mlarge)
6
7
2021-10-07 Giuliano Belinassi <gbelinassi@suse.de>
8
9
Backport from mainline
10
2018-11-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
11
12
PR target/87927
13
* target-def.h: Initialize TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP.
14
Add them to the TARGET_ASM_{,UN}ALIGNED_INT_OP structs.
15
* target.def: Enumerate TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP in
16
the byte_op hook.
17
* target.h: Add psi, pdi, pti to struct asm_int_op definition.
18
* targhooks.c (default_print_patchable_function_entry): Assert
19
asm_int_op does not return a NULL string.
20
* varasm.c (integer_asm_op): Return the op for a partial int type
21
when the requested size does not correspond to an integer type.
22
* config/msp430/msp430.c: Initialize TARGET_ASM_{,UN}ALIGNED_PSI_OP.
23
* doc/tm.texi: Regenerate.
24
---
25
gcc/config/msp430/msp430.c | 5 +++++
26
gcc/doc/tm.texi | 6 ++++++
27
gcc/target-def.h | 15 +++++++++++++++
28
gcc/target.def | 6 ++++++
29
gcc/target.h | 3 +++
30
gcc/targhooks.c | 4 +++-
31
gcc/varasm.c | 14 ++++++++++++++
32
7 files changed, 52 insertions(+), 1 deletion(-)
33
34
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
35
index c1f0d5b0026..3ad552d9e94 100644
36
--- a/gcc/config/msp430/msp430.c
37
+++ b/gcc/config/msp430/msp430.c
38
39
}
40
}
41
42
+#undef TARGET_ASM_ALIGNED_PSI_OP
43
+#define TARGET_ASM_ALIGNED_PSI_OP "\t.long\t"
44
+#undef TARGET_ASM_UNALIGNED_PSI_OP
45
+#define TARGET_ASM_UNALIGNED_PSI_OP TARGET_ASM_ALIGNED_PSI_OP
46
+
47
#undef TARGET_PRINT_OPERAND_ADDRESS
48
#define TARGET_PRINT_OPERAND_ADDRESS msp430_print_operand_addr
49
50
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
51
index b4456f7cd40..cb9fabb4295 100644
52
--- a/gcc/doc/tm.texi
53
+++ b/gcc/doc/tm.texi
54
55
56
@deftypevr {Target Hook} {const char *} TARGET_ASM_BYTE_OP
57
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP
58
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PSI_OP
59
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP
60
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PDI_OP
61
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP
62
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PTI_OP
63
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP
64
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP
65
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PSI_OP
66
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP
67
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PDI_OP
68
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP
69
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PTI_OP
70
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP
71
These hooks specify assembly directives for creating certain kinds
72
of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a
73
diff --git a/gcc/target-def.h b/gcc/target-def.h
74
index c99bfaa0105..cbd9fe6b967 100644
75
--- a/gcc/target-def.h
76
+++ b/gcc/target-def.h
77
78
#define TARGET_ASM_UNALIGNED_TI_OP NULL
79
#endif /* OBJECT_FORMAT_ELF */
80
81
+/* There is no standard way to handle P{S,D,T}Imode, targets must implement them
82
+ if required. */
83
+#define TARGET_ASM_ALIGNED_PSI_OP NULL
84
+#define TARGET_ASM_UNALIGNED_PSI_OP NULL
85
+#define TARGET_ASM_ALIGNED_PDI_OP NULL
86
+#define TARGET_ASM_UNALIGNED_PDI_OP NULL
87
+#define TARGET_ASM_ALIGNED_PTI_OP NULL
88
+#define TARGET_ASM_UNALIGNED_PTI_OP NULL
89
+
90
#if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2)
91
# ifdef CTORS_SECTION_ASM_OP
92
# define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor
93
94
95
#define TARGET_ASM_ALIGNED_INT_OP \
96
{TARGET_ASM_ALIGNED_HI_OP, \
97
+ TARGET_ASM_ALIGNED_PSI_OP, \
98
TARGET_ASM_ALIGNED_SI_OP, \
99
+ TARGET_ASM_ALIGNED_PDI_OP, \
100
TARGET_ASM_ALIGNED_DI_OP, \
101
+ TARGET_ASM_ALIGNED_PTI_OP, \
102
TARGET_ASM_ALIGNED_TI_OP}
103
104
#define TARGET_ASM_UNALIGNED_INT_OP \
105
{TARGET_ASM_UNALIGNED_HI_OP, \
106
+ TARGET_ASM_UNALIGNED_PSI_OP, \
107
TARGET_ASM_UNALIGNED_SI_OP, \
108
+ TARGET_ASM_UNALIGNED_PDI_OP, \
109
TARGET_ASM_UNALIGNED_DI_OP, \
110
+ TARGET_ASM_UNALIGNED_PTI_OP, \
111
TARGET_ASM_UNALIGNED_TI_OP}
112
113
#if !defined (TARGET_FUNCTION_INCOMING_ARG)
114
diff --git a/gcc/target.def b/gcc/target.def
115
index bea79404836..c50ed9445cd 100644
116
--- a/gcc/target.def
117
+++ b/gcc/target.def
118
119
DEFHOOKPOD
120
(byte_op,
121
"@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP\n\
122
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PSI_OP\n\
123
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP\n\
124
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PDI_OP\n\
125
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP\n\
126
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PTI_OP\n\
127
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP\n\
128
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP\n\
129
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PSI_OP\n\
130
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP\n\
131
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PDI_OP\n\
132
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP\n\
133
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PTI_OP\n\
134
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP\n\
135
These hooks specify assembly directives for creating certain kinds\n\
136
of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a\n\
137
diff --git a/gcc/target.h b/gcc/target.h
138
index 393de408b97..5f2b1d6d9cc 100644
139
--- a/gcc/target.h
140
+++ b/gcc/target.h
141
142
struct asm_int_op
143
{
144
const char *hi;
145
+ const char *psi;
146
const char *si;
147
+ const char *pdi;
148
const char *di;
149
+ const char *pti;
150
const char *ti;
151
};
152
153
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
154
index 77ca69105d0..c57967966c5 100644
155
--- a/gcc/targhooks.c
156
+++ b/gcc/targhooks.c
157
158
char buf[256];
159
static int patch_area_number;
160
section *previous_section = in_section;
161
+ const char *asm_op = integer_asm_op (POINTER_SIZE_UNITS, false);
162
163
+ gcc_assert (asm_op != NULL);
164
patch_area_number++;
165
ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE", patch_area_number);
166
167
switch_to_section (get_section ("__patchable_function_entries",
168
0, NULL));
169
- fputs (integer_asm_op (POINTER_SIZE_UNITS, false), file);
170
+ fputs (asm_op, file);
171
assemble_name_raw (file, buf);
172
fputc ('\n', file);
173
174
diff --git a/gcc/varasm.c b/gcc/varasm.c
175
index 6e9a8c3133e..5711ba69555 100644
176
--- a/gcc/varasm.c
177
+++ b/gcc/varasm.c
178
179
return targetm.asm_out.byte_op;
180
case 2:
181
return ops->hi;
182
+ case 3:
183
+ return ops->psi;
184
case 4:
185
return ops->si;
186
+ case 5:
187
+ case 6:
188
+ case 7:
189
+ return ops->pdi;
190
case 8:
191
return ops->di;
192
+ case 9:
193
+ case 10:
194
+ case 11:
195
+ case 12:
196
+ case 13:
197
+ case 14:
198
+ case 15:
199
+ return ops->pti;
200
case 16:
201
return ops->ti;
202
default:
203
--
204
2.33.1
205
206