diff options
| author | Simon Tatham <simon.tatham@arm.com> | 2026-02-17 09:31:36 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-17 09:31:36 +0000 |
| commit | d2d620d4beafa53acfab6d689214913705776aa6 (patch) | |
| tree | 5a418eb3fb9aaf19b1a4806c761fdfeb2d04538f /libcxx/include/__atomic/atomic_sync.h | |
| parent | 48a1652eb63cb77ae563bb11f4c48bf90e7914d5 (diff) | |
| download | llvm-main.zip llvm-main.tar.gz llvm-main.tar.bz2 | |
When assembling a source file which switches between Arm and Thumb state
using `.arm` and `.thumb`, if you defined a function in Arm state and
mark it as hidden at dynamic link time using `.hidden`, but don't
actually issue the `.hidden` directive until you have switched back to
Thumb state, then the function would be accidentally marked as Thumb as
a side effect of making it hidden.
This happened in `ARMELFStreamer::emitSymbolAttribute`, and the comment
suggests that it was semi-deliberate: it was intended to happen as a
side effect of `.type foo,%function`, because the function label might
have already been defined without a type, and shouldn't be marked as
Thumb until it's known that it's a function. But I think it was an
accident that the same behavior also applies to any other addition of a
symbol attribute, such as `.hidden`: the call to `setIsThumbFunc` was
conditioned on whether the symbol has function type after setting the
attribute, not whether function type was the attribute _actually being
set_. So if you set the symbol to function type and _then_ use
`.hidden`, the condition would match again.
Fixes #180358, in which this came up in real-world code: rustc's IR
output included a top-level function in the form of inline asm, defined
in Arm state, and marked it as hidden via the LLVM IR `declare`, so that
LLVM didn't emit the `.hidden` directive until after it had switched
back to Thumb state.
The new test case includes a check for the _intended_ behavior of the
code in `emitSymbolAttribute`, to confirm that that still works.
Diffstat (limited to 'libcxx/include/__atomic/atomic_sync.h')
0 files changed, 0 insertions, 0 deletions
