[LLVMbugs] [Bug 8248] New: [MC-COFF] Invalid object file output when using "internal global"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 27 20:46:28 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8248

           Summary: [MC-COFF] Invalid object file output when using
                    "internal global"
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bigcheesegs at gmail.com
                CC: llvmbugs at cs.uiuc.edu


The following LLVM IR produces an invalid COFF object file which fails to link.

; Reduced from 'SingleSource/Benchmarks/McGill/exptree.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i686-pc-win32"

@a = internal global i32 0

On Windows:
% clang hand-reduced.ll
cc-000000.o : fatal error LNK1143: invalid or corrupt file: no symbol for
COMDAT section 0x1
clang: error: linker command failed with exit code 1143 (use -v to see
invocation)

% clang -c hand-reduced.ll
% coff-dump.py hand-reduced.o
{
  MachineType              = IMAGE_FILE_MACHINE_I386 (0x14C)
  NumberOfSections         = 1
  TimeDateStamp            = 1285644207
  PointerToSymbolTable     = 0x3C
  NumberOfSymbols          = 3
  SizeOfOptionalHeader     = 0
  Characteristics          = 0x0
  Sections                 = [
    1 = {
      Name                     = .bss$linkonce_a
      VirtualSize              = 0
      VirtualAddress           = 0
      SizeOfRawData            = 0
      PointerToRawData         = 0x0
      PointerToRelocations     = 0x0
      PointerToLineNumbers     = 0x0
      NumberOfRelocations      = 0
      NumberOfLineNumbers      = 0
      Charateristics           = 0xC0101080
        IMAGE_SCN_CNT_UNINITIALIZED_DATA
        IMAGE_SCN_LNK_COMDAT
        IMAGE_SCN_ALIGN_1BYTES
        IMAGE_SCN_MEM_READ
        IMAGE_SCN_MEM_WRITE
      SectionData              = None
      Relocations              = None
    }
  ]
  Symbols                  = [
    0 = {
      Name                     = .bss$linkonce_a
      Value                    = 0
      SectionNumber            = 1
      SimpleType               = IMAGE_SYM_TYPE_NULL (0)
      ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
      StorageClass             = IMAGE_SYM_CLASS_STATIC (3)
      NumberOfAuxSymbols       = 1
      AuxillaryData            =
        00 00 00 00 00 00 00 00 - 00 00 00 00 01 00 06 00 |................|
        00 00                                             |..|

    }
    1 = {
      Name                     = _a
      Value                    = 0
      SectionNumber            = 1
      SimpleType               = IMAGE_SYM_TYPE_NULL (0)
      ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
      StorageClass             = IMAGE_SYM_CLASS_LABEL (6)
      NumberOfAuxSymbols       = 0
      AuxillaryData            =

    }
  ]
}

Number of symbols is 3 when it should be 2. The linker error also seems wrong,
but is probably due to the incorrect number of symbols being output.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list