Commit 6142cf9
committed
Fix ARMv6 fiber asm: gate Cortex-M0 branch on __ARM_ARCH_6M__
The Boost.Context 1.91.0 sync (GH-22584) pulled in boostorg/context#325,
"fix cortex-m0 support to aapcs_elf_gas target", which adds a fallback
branch to make_fcontext/jump_fcontext for the Thumb-1 encoding limits of
ARMv6-M. The branch is correct for Cortex-M0 but is gated on
__ARM_ARCH >= 7, which is also false for classic ARMv6 in ARM state
(Alpine armhf, Raspberry Pi 1/Zero) -- targets that can encode every
instruction in the >= 7 branch and need none of the workaround.
Two consequences. make_fcontext took `ldr a2, =finish', materialising the
absolute address of finish through a literal pool in .text and emitting
R_ARM_ABS32 against .text. In a PIE link that becomes an R_ARM_RELATIVE
dynamic relocation inside the read-only text segment, tagging the binary
DT_TEXTREL. musl supports DT_TEXTREL only for DSOs it maps itself; the
main executable is kernel-mapped and handled by kernel_mapped_dso(),
which never inspects it, so ldso writes to a read-only page and dies with
SIGSEGV in do_relocs() before main(). Every SAPI, every invocation, no
output. glibc masks this by mprotecting the segment writable, which is
why only musl builds noticed.
Separately, jump_fcontext -- the hot path on every fiber switch -- grew
from 13 to 43 instructions on all ARMv6 builds, glibc included.
Gate on __ARM_ARCH_6M__ instead, exactly the target #325 names. The
result emits byte-identical .text to 8.6.0alpha1 on every ARM target
except Cortex-M0, where it emits byte-identical .text to current master:
each target gets back the code it had before the regression, and M0 keeps
what #325 added. armv7 and arm64 are unaffected either way.
Zend/asm is vendored and verified by the Verify Bundled Files workflow,
so carry the same diff in .github/scripts/download-bundled and re-apply
it from the sync script, as uriparser already does.1 parent d826d49 commit 6142cf9
4 files changed
Lines changed: 84 additions & 7 deletions
File tree
- .github/scripts/download-bundled
- Zend/asm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
0 commit comments