llvm.org GIT mirror llvm / 4d16adb
[ARM] Fix handling of mapping symbols when changing sections ChangeSection incorrectly registers LastEMSInfo as belonging to the previous section, not the current section. This happens to work when changing sections using .section, as the previous section is set to the current section before the call to ChangeSection, but not when using .popsection. Differential Revision: https://reviews.llvm.org/D32225 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300831 91177308-0d34-0410-b5e6-96231b3b80d8 John Brawn 3 years ago
2 changed file(s) with 19 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
463463 void emitUnwindRaw(int64_t Offset, const SmallVectorImpl &Opcodes);
464464
465465 void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
466 LastMappingSymbols[getPreviousSection().first] = std::move(LastEMSInfo);
466 LastMappingSymbols[getCurrentSection().first] = std::move(LastEMSInfo);
467467 MCELFStreamer::ChangeSection(Section, Subsection);
468468 auto LastMappingSymbol = LastMappingSymbols.find(Section);
469469 if (LastMappingSymbol != LastMappingSymbols.end()) {
2020 .arm
2121 add r0, r0, r0
2222
23 @ Similarly no $t if we change back .starts_thumb using .pushsection
24 .pushsection .starts_thumb
25 .thumb
26 adds r0, r0, r0
27
28 @ When we change back to .text using .popsection .thumb is still active, so we
29 @ should emit a $t
30 .popsection
31 add r0, r0, r0
32
33 @ .ident does a push then pop of the .comment section, so the .word should
34 @ cause $d to appear in the .text section
35 .ident "ident"
36 .word 0
37
2338 @ With all those constraints, we want:
24 @ + .text to have $a at 0 and no others
39 @ + .text to have $a at 0, $t at 8, $d at 12
2540 @ + .wibble to have $a at 0
2641 @ + .starts_thumb to have $t at 0
2742 @ + .starts_data to have $d at 0
2843
2944 @ CHECK: 00000000 .text 00000000 $a
3045 @ CHECK-NEXT: 00000000 .wibble 00000000 $a
46 @ CHECK-NEXT: 0000000a .text 00000000 $d
3147 @ CHECK-NEXT: 00000000 .starts_thumb 00000000 $t
48 @ CHECK-NEXT: 00000008 .text 00000000 $t
3249 @ CHECK-NOT: ${{[adt]}}
3350