From 3ad10cfab874dcb1eac8a7d7f54447c2c8a3b862 Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Fri, 6 Jun 2014 08:18:18 +0000 Subject: [PATCH] Revert r210298 'Correctly set the comdat symbol on COFF' as it asserts on Windows git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210317 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCSectionCOFF.h | 1 - lib/MC/WinCOFFObjectWriter.cpp | 15 +----- test/MC/COFF/section-comdat-conflict.s | 13 ----- test/MC/COFF/section-comdat.s | 68 +++++++++----------------- 4 files changed, 26 insertions(+), 71 deletions(-) delete mode 100644 test/MC/COFF/section-comdat-conflict.s diff --git a/include/llvm/MC/MCSectionCOFF.h b/include/llvm/MC/MCSectionCOFF.h index 33ba45c2783..a428f9efb2b 100644 --- a/include/llvm/MC/MCSectionCOFF.h +++ b/include/llvm/MC/MCSectionCOFF.h @@ -76,7 +76,6 @@ class MCSymbol; return SectionName.str() + "_end"; } unsigned getCharacteristics() const { return Characteristics; } - const MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; } int getSelection() const { return Selection; } const MCSectionCOFF *getAssocSection() const { return Assoc; } diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index c3fc61b2904..961cbc6a8f7 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -347,11 +347,6 @@ void WinCOFFObjectWriter::DefineSection(MCSectionData const &SectionData) { COFFSection *coff_section = createSection(Sec.getSectionName()); COFFSymbol *coff_symbol = createSymbol(Sec.getSectionName()); - if (const MCSymbol *S = Sec.getCOMDATSymbol()) { - COFFSymbol *COMDATSymbol = GetOrCreateCOFFSymbol(S); - assert(!COMDATSymbol->Section); - COMDATSymbol->Section = coff_section; - } coff_section->Symbol = coff_symbol; coff_symbol->Section = coff_section; @@ -463,15 +458,9 @@ void WinCOFFObjectWriter::DefineSymbol(MCSymbolData const &SymbolData, coff_symbol->Data.SectionNumber = COFF::IMAGE_SYM_ABSOLUTE; } else { const MCSymbolData &BaseData = Assembler.getSymbolData(*Base); - if (BaseData.Fragment) { - COFFSection *Sec = + if (BaseData.Fragment) + coff_symbol->Section = SectionMap[&BaseData.Fragment->getParent()->getSection()]; - - if (coff_symbol->Section && coff_symbol->Section != Sec) - report_fatal_error("conflicting sections for symbol"); - - coff_symbol->Section = Sec; - } } coff_symbol->MCData = &ResSymData; diff --git a/test/MC/COFF/section-comdat-conflict.s b/test/MC/COFF/section-comdat-conflict.s deleted file mode 100644 index 7ed452a5cdc..00000000000 --- a/test/MC/COFF/section-comdat-conflict.s +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: not llvm-mc -triple i386-pc-win32 -filetype=obj < %s 2>&1 | FileCheck %s - -// CHECK: conflicting sections for symbol - - .section .xyz - .global bar -bar: - .long 42 - - .section .abcd,"xr",discard,bar - .global foo -foo: - .long 42 diff --git a/test/MC/COFF/section-comdat.s b/test/MC/COFF/section-comdat.s index e166a508bc1..dd5be871b05 100644 --- a/test/MC/COFF/section-comdat.s +++ b/test/MC/COFF/section-comdat.s @@ -40,11 +40,6 @@ Symbol6: Symbol7: .long 1 -.section SecName, "dr", newest, "Symbol8" -.globl AnotherSymbol -AnotherSymbol: -.long 1 - // CHECK: Sections [ // CHECK: Section { // CHECK: Number: 1 @@ -119,10 +114,6 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { -// CHECK: Name: Symbol1 -// CHECK: Section: secName (2) -// CHECK: } -// CHECK: Symbol { // CHECK: Name: secName // CHECK: Section: secName (3) // CHECK: AuxSectionDef { @@ -130,10 +121,6 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { -// CHECK: Name: Symbol2 -// CHECK: Section: secName (3) -// CHECK: } -// CHECK: Symbol { // CHECK: Name: SecName // CHECK: Section: SecName (4) // CHECK: AuxSectionDef { @@ -141,10 +128,6 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { -// CHECK: Name: Symbol3 -// CHECK: Section: SecName (4) -// CHECK: } -// CHECK: Symbol { // CHECK: Name: SecName // CHECK: Section: SecName (5) // CHECK: AuxSymbolCount: 1 @@ -153,10 +136,6 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { -// CHECK: Name: Symbol4 -// CHECK: Section: SecName (5) -// CHECK: } -// CHECK: Symbol { // CHECK: Name: SecName // CHECK: Section: SecName (6) // CHECK: AuxSectionDef { @@ -165,10 +144,6 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { -// CHECK: Name: Symbol5 -// CHECK: Section: SecName (6) -// CHECK: } -// CHECK: Symbol { // CHECK: Name: SecName // CHECK: Section: SecName (7) // CHECK: AuxSectionDef { @@ -176,10 +151,6 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { -// CHECK: Name: Symbol6 -// CHECK: Section: SecName (7) -// CHECK: } -// CHECK: Symbol { // CHECK: Name: SecName // CHECK: Section: SecName (8) // CHECK: AuxSectionDef { @@ -187,22 +158,31 @@ AnotherSymbol: // CHECK: } // CHECK: } // CHECK: Symbol { +// CHECK: Name: Symbol1 +// CHECK: Section: secName (2) +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: Symbol2 +// CHECK: Section: secName (3) +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: Symbol3 +// CHECK: Section: SecName (4) +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: Symbol4 +// CHECK: Section: SecName (5) +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: Symbol5 +// CHECK: Section: SecName (6) +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: Symbol6 +// CHECK: Section: SecName (7) +// CHECK: } +// CHECK: Symbol { // CHECK: Name: Symbol7 // CHECK: Section: SecName (8) // CHECK: } -// CHECK: Symbol { -// CHECK: Name: SecName -// CHECK: Section: SecName (9) -// CHECK: AuxSectionDef { -// CHECK: Selection: Newest (0x7) -// CHECK: } -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: Symbol8 -// CHECK: Section: SecName (9) -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: AnotherSymbol -// CHECK: Section: SecName (9) -// CHECK: } // CHECK: ]