aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-07-24 23:37:48 -0700
committerGitHub <noreply@github.com>2025-07-24 23:37:48 -0700
commit1955a01d63eceaf806faa29c2ed7c61e135889eb (patch)
tree6d13c47757efc790a2b7a258c8470e428d3852ad /clang/lib/CodeGen/CodeGenModule.cpp
parent84dc97e51eb4cd85de27805476d2f438ed9e6224 (diff)
downloadllvm-1955a01d63eceaf806faa29c2ed7c61e135889eb.zip
llvm-1955a01d63eceaf806faa29c2ed7c61e135889eb.tar.gz
llvm-1955a01d63eceaf806faa29c2ed7c61e135889eb.tar.bz2
MC: Allocate initial fragment and define section symbol in changeSection
13a79bbfe583e1d8cc85d241b580907260065eb8 (2017) introduced fragment creation in MCContext for createELFSectionImpl, which was inappropriate. Fragments should only be created when using MCSteramer, not during `MCContext::get*Section` calls. `initMachOMCObjectFileInfo` defines multiple sections, some of which may not be used by the code generator. This caused symbol names matching these sections to be incorrectly marked as undefined (see https://reviews.llvm.org/D55173). The fragment code was later replicated in other file formats, such as WebAssembly (see https://reviews.llvm.org/D46561), XCOFF, and GOFF. This patch fixes the problem by moving initial fragment allocation from MCContext::createSection to MCStreamer::changeSection. While MCContext still creates a section symbol, the symbol is not attached to the initial fragment. In addition, move `emitLabel`/`setFragment` from `switchSection*` and overridden changeSection to `MCObjectStreamer::changeSection` for consistency. * test/CodeGen/XCore/section-name.ll now passes. XCore doesn't support MCObjectStreamer. I don't think the MCAsmStreamer output behavior change matters. Pull Request: https://github.com/llvm/llvm-project/pull/150574
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions