Skip to content

Commit 0cab575

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:9423961f259f into amd-gfx:4b57b2fc3a59
Local branch amd-gfx 4b57b2f Merged main:acb7dfaa017d into amd-gfx:4b60f60dc3ac Remote branch main 9423961 [MC] Test the "cannot have fixups" error
2 parents 4b57b2f + 9423961 commit 0cab575

File tree

6 files changed

+9
-20
lines changed

6 files changed

+9
-20
lines changed

llvm/include/llvm/Config/llvm-config.h.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 522237
19+
#define LLVM_MAIN_REVISION 522240
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/include/llvm/MC/MCFragment.h

-10
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment {
190190
: MCEncodedFragment(FType, HasInstructions) {}
191191

192192
public:
193-
194-
using const_fixup_iterator = SmallVectorImpl<MCFixup>::const_iterator;
195-
using fixup_iterator = SmallVectorImpl<MCFixup>::iterator;
196-
197193
SmallVectorImpl<char> &getContents() { return Contents; }
198194
const SmallVectorImpl<char> &getContents() const { return Contents; }
199195

@@ -204,12 +200,6 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment {
204200
SmallVectorImpl<MCFixup> &getFixups() { return Fixups; }
205201
const SmallVectorImpl<MCFixup> &getFixups() const { return Fixups; }
206202

207-
fixup_iterator fixup_begin() { return Fixups.begin(); }
208-
const_fixup_iterator fixup_begin() const { return Fixups.begin(); }
209-
210-
fixup_iterator fixup_end() { return Fixups.end(); }
211-
const_fixup_iterator fixup_end() const { return Fixups.end(); }
212-
213203
static bool classof(const MCFragment *F) {
214204
MCFragment::FragmentType Kind = F->getKind();
215205
return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data ||

llvm/include/llvm/MC/MCSection.h

-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ class MCSection {
181181
FragList *curFragList() const { return CurFragList; }
182182
iterator begin() const { return iterator(CurFragList->Head); }
183183
iterator end() const { return {}; }
184-
bool empty() const { return !CurFragList->Head; }
185184

186185
void dump() const;
187186

llvm/lib/MC/MCAssembler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ void MCAssembler::writeSectionData(raw_ostream &OS,
829829
// into a virtual section. This is to support clients which use standard
830830
// directives to fill the contents of virtual sections.
831831
const MCDataFragment &DF = cast<MCDataFragment>(F);
832-
if (DF.fixup_begin() != DF.fixup_end())
832+
if (DF.getFixups().size())
833833
getContext().reportError(SMLoc(), Sec->getVirtualSectionKind() +
834834
" section '" + Sec->getName() +
835835
"' cannot have fixups");

llvm/lib/MC/MCFragment.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,10 @@ LLVM_DUMP_METHOD void MCFragment::dump() const {
150150
}
151151
OS << "] (" << Contents.size() << " bytes)";
152152

153-
if (DF->fixup_begin() != DF->fixup_end()) {
153+
if (DF->getFixups().size()) {
154154
OS << ",\n ";
155155
OS << " Fixups:[";
156-
for (MCDataFragment::const_fixup_iterator it = DF->fixup_begin(),
157-
ie = DF->fixup_end(); it != ie; ++it) {
158-
if (it != DF->fixup_begin()) OS << ",\n ";
159-
OS << *it;
160-
}
156+
interleave(DF->getFixups(), OS, ",\n ");
161157
OS << "]";
162158
}
163159
break;

llvm/test/MC/ELF/nobits-non-zero-value.s

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: not llvm-mc -filetype=obj -triple=x86_64 %s -o /dev/null 2>&1 | FileCheck %s
1+
# RUN: not llvm-mc -filetype=obj -triple=x86_64 %s -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
22

33
## -filetype=asm does not check the error.
44
# RUN: llvm-mc -triple=x86_64 %s
@@ -20,3 +20,7 @@
2020

2121
# CHECK: <unknown>:0: error: SHT_NOBITS section '.bss' cannot have non-zero initializers
2222
.long 1
23+
24+
.section .bss1,"aw",%nobits
25+
# CHECK: <unknown>:0: error: SHT_NOBITS section '.bss1' cannot have fixups
26+
.quad foo

0 commit comments

Comments
 (0)