[LLVMbugs] [Bug 18993] New: MC COFF: Assertion "Sections with relocations must be real!" failed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 27 10:23:15 PST 2014


            Bug ID: 18993
           Summary: MC COFF: Assertion "Sections with relocations must be
                    real!" failed
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: echristo at gmail.com, llvmbugs at cs.uiuc.edu,
                    nico.rieck at gmail.com
    Classification: Unclassified

I hit this when I accidentally generated an empty vftable like so:
@"\01??_7C@@6BA@@@" = linkonce_odr unnamed_addr constant [0 x i8*]

This leads to an empty section in the IR file, which the COFF emitter will
skip, and then we get an assertion failure.

Fixing this isn't really high priority, but it's good to file and fix

$ cat t.s
        .def     "??0C@@QAE at XZ";
        .scl    2;
        .type   32;
        .section        .text,"xr",discard,"??0C@@QAE at XZ"
        .globl  "??0C@@QAE at XZ"
        .align  16, 0x90
"??0C@@QAE at XZ":                         # @"\01??0C@@QAE at XZ"
# BB#0:                                 # %entry
        movl    $"??_7C@@6BA@@@", %eax
        movl    $"??_7C@@6BB@@@", %eax

        .section        .rdata,"r",discard,"??_7C@@6BA@@@"
        .globl  "??_7C@@6BA@@@"         # @"\01??_7C@@6BA@@@"
        .align  4

        .section        .rdata,"r",discard,"??_7C@@6BB@@@"
        .globl  "??_7C@@6BB@@@"         # @"\01??_7C@@6BB@@@"
        .align  4
        .long   "?f at A@@UAEXXZ"

$ llvm-mc -assemble -filetype=obj t.s -o t.o
Assertion failed: Section->Number != -1 && "Sections with relocations must be
real!", file ..\lib\MC\WinCOFFObjectWriter.cpp, line 224
Stack dump:
0.      Program arguments: D:\src\llvm\build_debug\bin\llvm-mc.exe -assemble
-filetype=obj t.s -o t.o
0x01392AEA (0x0000000A 0x00000000 0x00B9F384 0x01386DAB), _NMSG_WRITE() + 0x8A
bytes(s), f:\dd\vctools\crt\crtw32\startup\crt0msg.c, line 226
0x0138912C (0x00B9F6E4 0x00B9F6F4 0xCCCCCCCC 0xCCCCCCCC), abort() + 0x1C
bytes(s), f:\dd\vctools\crt\crtw32\misc\abort.c, line 62 + 0x7 byte(s)
0x01386DAB (0x018127E0 0x01812798 0x000000E0 0x00E23EF8), _wassert() + 0xBEB
bytes(s), f:\dd\vctools\crt\crtw32\misc\assert.c, line 380
0x01442090 (0x00B9F6E8 0x00B9F6F4 0xCCCCCCCC 0xCCCCCCCC), `anonymous
namespace'::COFFSymbol::should_keep() + 0x50 bytes(s),
d:\src\llvm\lib\mc\wincoffobjectwriter.cpp, line 224 + 0x29 byte(s)
0x01443FB0 (0x00E1E8F0 0x00B9F7B4 0x00B9F984 0x00B9F844), `anonymous
namespace'::WinCOFFObjectWriter::WriteObject() + 0x220 bytes(s),
d:\src\llvm\lib\mc\wincoffobjectwriter.cpp, line 780 + 0x8 byte(s)
0x010CD7BB (0x00000000 0x00E1E820 0x00B9F83C 0x0141F02A),
llvm::MCAssembler::Finish() + 0x54B bytes(s),
d:\src\llvm\lib\mc\mcassembler.cpp, line 823 + 0x2B byte(s)
0x014504C5 (0x00E1E820 0x00B9F850 0x010AAA50 0x00B9F854),
llvm::MCObjectStreamer::FinishImpl() + 0x95 bytes(s),
d:\src\llvm\lib\mc\mcobjectstreamer.cpp, line 391
0x0141F02A (0x00B9F854 0x00000000 0x00E1E820 0x00B9F984), `anonymous
namespace'::WinCOFFStreamer::FinishImpl() + 0x2A bytes(s),
d:\src\llvm\lib\mc\wincoffstreamer.cpp, line 290
0x010AAA50 (0x00B9F9C4 0x00B9F994 0xCCCCCCCC 0xCCCCCCCC),
llvm::MCStreamer::Finish() + 0x80 bytes(s), d:\src\llvm\lib\mc\mcstreamer.cpp,
line 627 + 0x12 byte(s)
0x010DE388 (0x00000000 0x00000000 0x00B9FE4C 0x00000000), `anonymous
namespace'::AsmParser::Run() + 0x538 bytes(s),
d:\src\llvm\lib\mc\mcparser\asmparser.cpp, line 700
0x0103A243 (0x00E1679C 0x018A86D0 0x00B9FD94 0x00B9FB8C), AssembleInput() +
0x103 bytes(s), d:\src\llvm\tools\llvm-mc\llvm-mc.cpp, line 335 + 0x2A byte(s)
0x0103AECB (0x00000006 0x00E16780 0x00E16818 0x98322314), main() + 0xC0B
bytes(s), d:\src\llvm\tools\llvm-mc\llvm-mc.cpp, line 460 + 0x4B byte(s)
0x013872BA (0x00B9FEAC 0x76F4336A 0x7EFDE000 0x00B9FEEC), __tmainCRTStartup() +
0x11A bytes(s), f:\dd\vctools\crt\crtw32\startup\crt0.c, line 255 + 0x19
0x0138740D (0x7EFDE000 0x00B9FEEC 0x77A99F72 0x7EFDE000), mainCRTStartup() +
0xD bytes(s), f:\dd\vctools\crt\crtw32\startup\crt0.c, line 165
0x76F4336A (0x7EFDE000 0x5910E87B 0x00000000 0x00000000), BaseThreadInitThunk()
+ 0x12 bytes(s)
0x77A99F72 (0x01387400 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeExceptionChain() + 0x63 bytes(s)
0x77A99F45 (0x01387400 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeExceptionChain() + 0x36 bytes(s)

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140227/1b068c06/attachment.html>

More information about the llvm-bugs mailing list