Skip to content

Commit e2511ae

Browse files
authored
Fix __SOFTFP__ case for arm getcontext (#73449)
1 parent fe957c0 commit e2511ae

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

src/native/external/libunwind-version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Apply https://github.com/libunwind/libunwind/pull/365
1212
Apply https://github.com/libunwind/libunwind/pull/377
1313
Apply https://github.com/libunwind/libunwind/pull/382
1414
Apply https://github.com/libunwind/libunwind/pull/398
15+
Apply https://github.com/libunwind/libunwind/pull/400
1516

1617
For LoongArch64:
1718
Apply https://github.com/libunwind/libunwind/pull/316 and https://github.com/libunwind/libunwind/pull/322

src/native/external/libunwind/include/libunwind-arm.h

+24-17
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern "C" {
5050
require recompiling all users of this library. Stack allocation is
5151
relatively cheap and unwind-state copying is relatively rare, so we
5252
want to err on making it rather too big than too small. */
53-
53+
5454
/* FIXME for ARM. Too big? What do other things use for similar tasks? */
5555
#define UNW_TDEP_CURSOR_LEN 4096
5656

@@ -77,7 +77,7 @@ typedef enum
7777
UNW_ARM_R13,
7878
UNW_ARM_R14,
7979
UNW_ARM_R15,
80-
80+
8181
/* VFPv2 s0-s31 (obsolescent numberings). */
8282
UNW_ARM_S0 = 64,
8383
UNW_ARM_S1,
@@ -111,7 +111,7 @@ typedef enum
111111
UNW_ARM_S29,
112112
UNW_ARM_S30,
113113
UNW_ARM_S31,
114-
114+
115115
/* FPA register numberings. */
116116
UNW_ARM_F0 = 96,
117117
UNW_ARM_F1,
@@ -121,7 +121,7 @@ typedef enum
121121
UNW_ARM_F5,
122122
UNW_ARM_F6,
123123
UNW_ARM_F7,
124-
124+
125125
/* iWMMXt GR register numberings. */
126126
UNW_ARM_wCGR0 = 104,
127127
UNW_ARM_wCGR1,
@@ -131,7 +131,7 @@ typedef enum
131131
UNW_ARM_wCGR5,
132132
UNW_ARM_wCGR6,
133133
UNW_ARM_wCGR7,
134-
134+
135135
/* iWMMXt register numberings. */
136136
UNW_ARM_wR0 = 112,
137137
UNW_ARM_wR1,
@@ -149,17 +149,17 @@ typedef enum
149149
UNW_ARM_wR13,
150150
UNW_ARM_wR14,
151151
UNW_ARM_wR15,
152-
152+
153153
/* Two-byte encodings from here on. */
154-
154+
155155
/* SPSR. */
156156
UNW_ARM_SPSR = 128,
157157
UNW_ARM_SPSR_FIQ,
158158
UNW_ARM_SPSR_IRQ,
159159
UNW_ARM_SPSR_ABT,
160160
UNW_ARM_SPSR_UND,
161161
UNW_ARM_SPSR_SVC,
162-
162+
163163
/* User mode registers. */
164164
UNW_ARM_R8_USR = 144,
165165
UNW_ARM_R9_USR,
@@ -168,7 +168,7 @@ typedef enum
168168
UNW_ARM_R12_USR,
169169
UNW_ARM_R13_USR,
170170
UNW_ARM_R14_USR,
171-
171+
172172
/* FIQ registers. */
173173
UNW_ARM_R8_FIQ = 151,
174174
UNW_ARM_R9_FIQ,
@@ -177,23 +177,23 @@ typedef enum
177177
UNW_ARM_R12_FIQ,
178178
UNW_ARM_R13_FIQ,
179179
UNW_ARM_R14_FIQ,
180-
180+
181181
/* IRQ registers. */
182182
UNW_ARM_R13_IRQ = 158,
183183
UNW_ARM_R14_IRQ,
184-
184+
185185
/* ABT registers. */
186186
UNW_ARM_R13_ABT = 160,
187187
UNW_ARM_R14_ABT,
188-
188+
189189
/* UND registers. */
190190
UNW_ARM_R13_UND = 162,
191191
UNW_ARM_R14_UND,
192-
192+
193193
/* SVC registers. */
194194
UNW_ARM_R13_SVC = 164,
195195
UNW_ARM_R14_SVC,
196-
196+
197197
/* iWMMXt control registers. */
198198
UNW_ARM_wC0 = 192,
199199
UNW_ARM_wC1,
@@ -273,6 +273,13 @@ unw_tdep_context_t;
273273
may be sufficient for all libunwind use cases.
274274
In thumb mode, we return directly back to thumb mode on return (with bx), to
275275
avoid altering any registers after unw_resume. */
276+
277+
#ifdef __SOFTFP__
278+
#define VSTMIA "nop\n" /* align return address to value stored by stmia */
279+
#else
280+
#define VSTMIA "vstmia %[base], {d0-d15}\n" /* this also aligns return address to value stored by stmia */
281+
#endif
282+
276283
#ifndef __thumb__
277284
#define unw_tdep_getcontext(uc) ({ \
278285
unw_tdep_context_t *unw_ctx = (uc); \
@@ -281,7 +288,7 @@ unw_tdep_context_t;
281288
__asm__ __volatile__ ( \
282289
"mov r0, #0\n" \
283290
"stmia %[base]!, {r0-r15}\n" \
284-
"vstmia %[base], {d0-d15}\n" /* this also aligns return address to value stored by stmia */ \
291+
VSTMIA \
285292
: [r0] "=r" (r0) : [base] "r" (unw_base) : "memory"); \
286293
(int)r0; })
287294
#else /* __thumb__ */
@@ -298,13 +305,13 @@ unw_tdep_context_t;
298305
"stmia %[base], {r0-r14}\n" \
299306
"adr r0, ret%=+1\n" \
300307
"stmia %[base]!, {r0}\n" \
301-
"vstmia %[base], {d0-d15}\n" \
308+
VSTMIA \
302309
"orr r0, pc, #1\n" \
303310
"bx r0\n" \
304311
".code 16\n" \
305312
"mov r0, #0\n" \
306313
"ret%=:\n" \
307-
: [r0] "=r" (r0), [base] "+r" (unw_base) : : "memory", "cc"); \
314+
: [r0] "=r" (r0), [base] "+r" (unw_base) : : "memory", "cc"); \
308315
(int)r0; })
309316
#endif
310317

src/native/external/libunwind/src/dwarf/Gfind_proc_info-lsb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local,
135135
#if defined(SHF_COMPRESSED)
136136
if (shdr->sh_flags & SHF_COMPRESSED)
137137
{
138-
unsigned long destSize;
139138
Elf_W (Chdr) *chdr = (shdr->sh_offset + ei.image);
140139
#ifdef HAVE_ZLIB
140+
unsigned long destSize;
141141
if (chdr->ch_type == ELFCOMPRESS_ZLIB)
142142
{
143143
*bufsize = destSize = chdr->ch_size;

0 commit comments

Comments
 (0)