[llvm] r289013 - [CodeGen] Fix invalid DWARF info on Win64
Keno Fischer via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 13:21:26 PST 2016
This was reverted right after because it broke on MSVC bots, so if it's
still broken, it wasn't me ;).
On Thu, Dec 8, 2016 at 4:20 PM, Mike Aizatsky <aizatsky at google.com> wrote:
> Keno,
>
> Either this or a previous commit has broken the asan build:
>
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/1229
>
> ==17795==ERROR: AddressSanitizer: heap-use-after-free on address
> 0x621000009090 at pc 0x000002752b3e bp 0x7ffdc28a1be0 sp 0x7ffdc28a1bd8
> READ of size 4 at 0x621000009090 thread T0
> #0 0x2752b3d in getKeyLength /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/llvm/include/llvm/ADT/StringMap.h:45:42
> #1 0x2752b3d in Destroy<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
> 4096, 4096> > /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/
> build/llvm/include/llvm/ADT/StringMap.h:206
> #2 0x2752b3d in ~StringMap /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/llvm/include/llvm/ADT/StringMap.h:439
> #3 0x2752b3d in ~DwarfStringPool /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/
> AsmPrinter/DwarfStringPool.h:28
> #4 0x2752b3d in operator() /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/libcxx_build_asan/
> include/c++/v1/memory:2398
> #5 0x2752b3d in reset /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/libcxx_build_asan/
> include/c++/v1/memory:2604
> #6 0x2752b3d in ~unique_ptr /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/libcxx_build_asan/
> include/c++/v1/memory:2572
> #7 0x2752b3d in llvm::dwarfgen::Generator::~Generator()
> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/
> build/llvm/lib/CodeGen/DwarfGenerator.cpp:114
> #8 0x727d44 in operator() /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/libcxx_build_asan/
> include/c++/v1/memory:2398:13
> #9 0x727d44 in reset /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/libcxx_build_asan/
> include/c++/v1/memory:2604
> #10 0x727d44 in ~unique_ptr /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/libcxx_build_asan/
> include/c++/v1/memory:2572
> #11 0x727d44 in ~Expected /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/Error.h:713
> #12 0x727d44 in void (anonymous namespace)::TestReferences<(unsigned
> short)3, unsigned long>() /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/llvm/unittests/DebugInfo/DWARF/
> DWARFDebugInfoTest.cpp:747
> #13 0x34d0fec in HandleExceptionsInMethodIfSupported<testing::Test,
> void> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/
> build/llvm/utils/unittest/googletest/src/gtest.cc:2145:12
> #14 0x34d0fec in testing::Test::Run() /mnt/b/sanitizer-buildbot3/
> sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/
> googletest/src/gtest.cc:2161
>
>
> On Wed, Dec 7, 2016 at 5:52 PM Keno Fischer via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: kfischer
>> Date: Wed Dec 7 19:40:21 2016
>> New Revision: 289013
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=289013&view=rev
>> Log:
>> [CodeGen] Fix invalid DWARF info on Win64
>>
>> The relocations for `DIEEntry::EmitValue` were wrong for Win64
>> (emitting FK_Data_4 instead of FK_SecRel_4). This corrects that
>> oversight so that the DWARF data is correct in Win64 COFF files.
>>
>> Fixes PR15393.
>>
>> Patch by Jameson Nash <jameson at juliacomputing.com> based on a patch
>> by David Majnemer.
>>
>> Differential Revision: https://reviews.llvm.org/D21731
>>
>> Modified:
>> llvm/trunk/docs/Extensions.rst
>> llvm/trunk/include/llvm/MC/MCStreamer.h
>> llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h
>> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
>> llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
>> llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
>> llvm/trunk/lib/MC/MCAsmStreamer.cpp
>> llvm/trunk/lib/MC/MCCodeView.cpp
>> llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
>> llvm/trunk/lib/MC/MCStreamer.cpp
>> llvm/trunk/lib/MC/WinCOFFStreamer.cpp
>> llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll
>>
>> Modified: llvm/trunk/docs/Extensions.rst
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/
>> Extensions.rst?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/docs/Extensions.rst (original)
>> +++ llvm/trunk/docs/Extensions.rst Wed Dec 7 19:40:21 2016
>> @@ -67,7 +67,7 @@ the target. It corresponds to the COFF
>> .long 4
>> .long 242
>> .long 40
>> - .secrel32 _function_name
>> + .secrel32 _function_name + 0
>> .secidx _function_name
>> ...
>>
>>
>> Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
>> llvm/MC/MCStreamer.h?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
>> +++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Dec 7 19:40:21 2016
>> @@ -471,7 +471,7 @@ public:
>> /// \brief Emits a COFF section relative relocation.
>> ///
>> /// \param Symbol - Symbol the section relative relocation should
>> point to.
>> - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
>> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset);
>>
>> /// \brief Emit an ELF .size directive.
>> ///
>>
>> Modified: llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
>> llvm/MC/MCWinCOFFStreamer.h?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h (original)
>> +++ llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h Wed Dec 7 19:40:21
>> 2016
>> @@ -52,7 +52,7 @@ public:
>> void EndCOFFSymbolDef() override;
>> void EmitCOFFSafeSEH(MCSymbol const *Symbol) override;
>> void EmitCOFFSectionIndex(MCSymbol const *Symbol) override;
>> - void EmitCOFFSecRel32(MCSymbol const *Symbol) override;
>> + void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset)
>> override;
>> void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
>> unsigned ByteAlignment) override;
>> void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>> CodeGen/AsmPrinter/AsmPrinter.cpp?rev=289013&r1=289012&r2=
>> 289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Dec 7 19:40:21
>> 2016
>> @@ -1688,7 +1688,7 @@ void AsmPrinter::EmitLabelPlusOffset(con
>> unsigned Size,
>> bool IsSectionRelative) const {
>> if (MAI->needsDwarfSectionOffsetDirective() && IsSectionRelative) {
>> - OutStreamer->EmitCOFFSecRel32(Label);
>> + OutStreamer->EmitCOFFSecRel32(Label, Offset);
>> return;
>> }
>>
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>> CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=289013&r1=289012&r2=289013&
>> view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Wed Dec 7
>> 19:40:21 2016
>> @@ -149,7 +149,7 @@ void AsmPrinter::emitDwarfSymbolReferenc
>> if (!ForceOffset) {
>> // On COFF targets, we have to emit the special .secrel32 directive.
>> if (MAI->needsDwarfSectionOffsetDirective()) {
>> - OutStreamer->EmitCOFFSecRel32(Label);
>> + OutStreamer->EmitCOFFSecRel32(Label, /*Offset=*/0);
>> return;
>> }
>>
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>> CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=289013&
>> r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Wed Dec 7
>> 19:40:21 2016
>> @@ -801,7 +801,7 @@ void CodeViewDebug::emitDebugInfoForFunc
>> OS.AddComment("Function type index");
>> OS.EmitIntValue(getFuncIdForSubprogram(GV->getSubprogram()).getIndex(),
>> 4);
>> OS.AddComment("Function section relative address");
>> - OS.EmitCOFFSecRel32(Fn);
>> + OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
>> OS.AddComment("Function section index");
>> OS.EmitCOFFSectionIndex(Fn);
>> OS.AddComment("Flags");
>> @@ -2271,7 +2271,7 @@ void CodeViewDebug::emitDebugInfoForGlob
>> OS.AddComment("Type");
>> OS.EmitIntValue(getCompleteTypeIndex(DIGV->getType()).getIndex(), 4);
>> OS.AddComment("DataOffset");
>> - OS.EmitCOFFSecRel32(GVSym);
>> + OS.EmitCOFFSecRel32(GVSym, /*Offset=*/0);
>> OS.AddComment("Segment");
>> OS.EmitCOFFSectionIndex(GVSym);
>> OS.AddComment("Name");
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>> CodeGen/AsmPrinter/DIE.cpp?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed Dec 7 19:40:21 2016
>> @@ -642,7 +642,7 @@ void DIEEntry::EmitValue(const AsmPrinte
>> MCSection *Section = Unit->getSection();
>> if (Section) {
>> const MCSymbol *SectionSym = Section->getBeginSymbol();
>> - AP->EmitLabelPlusOffset(SectionSym, Addr, SizeOf(AP, Form));
>> + AP->EmitLabelPlusOffset(SectionSym, Addr, SizeOf(AP, Form),
>> true);
>> return;
>> }
>> }
>>
>> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
>> MCAsmStreamer.cpp?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
>> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Dec 7 19:40:21 2016
>> @@ -150,7 +150,7 @@ public:
>> void EndCOFFSymbolDef() override;
>> void EmitCOFFSafeSEH(MCSymbol const *Symbol) override;
>> void EmitCOFFSectionIndex(MCSymbol const *Symbol) override;
>> - void EmitCOFFSecRel32(MCSymbol const *Symbol) override;
>> + void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset)
>> override;
>> void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
>> void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
>> unsigned ByteAlignment) override;
>> @@ -614,9 +614,11 @@ void MCAsmStreamer::EmitCOFFSectionIndex
>> EmitEOL();
>> }
>>
>> -void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
>> +void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t
>> Offset) {
>> OS << "\t.secrel32\t";
>> Symbol->print(OS, MAI);
>> + if (Offset != 0)
>> + OS << '+' << Offset;
>> EmitEOL();
>> }
>>
>>
>> Modified: llvm/trunk/lib/MC/MCCodeView.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
>> MCCodeView.cpp?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/MC/MCCodeView.cpp (original)
>> +++ llvm/trunk/lib/MC/MCCodeView.cpp Wed Dec 7 19:40:21 2016
>> @@ -200,7 +200,7 @@ void CodeViewContext::emitLineTableForFu
>> OS.EmitIntValue(unsigned(ModuleSubstreamKind::Lines), 4);
>> OS.emitAbsoluteSymbolDiff(LineEnd, LineBegin, 4);
>> OS.EmitLabel(LineBegin);
>> - OS.EmitCOFFSecRel32(FuncBegin);
>> + OS.EmitCOFFSecRel32(FuncBegin, /*Offset=*/0);
>> OS.EmitCOFFSectionIndex(FuncBegin);
>>
>> // Actual line info.
>>
>> Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
>> MCParser/COFFAsmParser.cpp?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp (original)
>> +++ llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Wed Dec 7 19:40:21 2016
>> @@ -455,13 +455,26 @@ bool COFFAsmParser::ParseDirectiveSecRel
>> if (getParser().parseIdentifier(SymbolID))
>> return TokError("expected identifier in directive");
>>
>> + int64_t Offset = 0;
>> + SMLoc OffsetLoc;
>> + if (getLexer().is(AsmToken::Plus)) {
>> + OffsetLoc = getLexer().getLoc();
>> + if (getParser().parseAbsoluteExpression(Offset))
>> + return true;
>> + }
>> +
>> if (getLexer().isNot(AsmToken::EndOfStatement))
>> return TokError("unexpected token in directive");
>>
>> + if (Offset < 0 || Offset > UINT32_MAX)
>> + return Error(OffsetLoc,
>> + "invalid '.secrel32' directive offset, can't be less "
>> + "than zero or greater than UINT32_MAX");
>> +
>> MCSymbol *Symbol = getContext().getOrCreateSymbol(SymbolID);
>>
>> Lex();
>> - getStreamer().EmitCOFFSecRel32(Symbol);
>> + getStreamer().EmitCOFFSecRel32(Symbol, Offset);
>> return false;
>> }
>>
>>
>> Modified: llvm/trunk/lib/MC/MCStreamer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
>> MCStreamer.cpp?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/MC/MCStreamer.cpp (original)
>> +++ llvm/trunk/lib/MC/MCStreamer.cpp Wed Dec 7 19:40:21 2016
>> @@ -125,7 +125,7 @@ void MCStreamer::EmitSymbolValue(const M
>> if (!IsSectionRelative)
>> EmitValueImpl(MCSymbolRefExpr::create(Sym, getContext()), Size);
>> else
>> - EmitCOFFSecRel32(Sym);
>> + EmitCOFFSecRel32(Sym, /*Offset=*/0);
>> }
>>
>> void MCStreamer::EmitDTPRel64Value(const MCExpr *Value) {
>> @@ -689,8 +689,7 @@ void MCStreamer::EmitCOFFSafeSEH(MCSymbo
>> void MCStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
>> }
>>
>> -void MCStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
>> -}
>> +void MCStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t
>> Offset) {}
>>
>> /// EmitRawText - If this file is backed by an assembly streamer, this
>> dumps
>> /// the specified string in the output .s file. This capability is
>>
>> Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
>> WinCOFFStreamer.cpp?rev=289013&r1=289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
>> +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Wed Dec 7 19:40:21 2016
>> @@ -195,11 +195,20 @@ void MCWinCOFFStreamer::EmitCOFFSectionI
>> DF->getContents().resize(DF->getContents().size() + 2, 0);
>> }
>>
>> -void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
>> +void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol,
>> + uint64_t Offset) {
>> MCDataFragment *DF = getOrCreateDataFragment();
>> - const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create(Symbol,
>> getContext());
>> - MCFixup Fixup = MCFixup::create(DF->getContents().size(), SRE,
>> FK_SecRel_4);
>> + // Create Symbol A for the relocation relative reference.
>> + const MCExpr *MCE = MCSymbolRefExpr::create(Symbol, getContext());
>> + // Add the constant offset, if given.
>> + if (Offset)
>> + MCE = MCBinaryExpr::createAdd(
>> + MCE, MCConstantExpr::create(Offset, getContext()), getContext());
>> + // Build the secrel32 relocation.
>> + MCFixup Fixup = MCFixup::create(DF->getContents().size(), MCE,
>> FK_SecRel_4);
>> + // Record the relocation.
>> DF->getFixups().push_back(Fixup);
>> + // Emit 4 bytes (zeros) to the object file.
>> DF->getContents().resize(DF->getContents().size() + 4, 0);
>> }
>>
>>
>> Modified: llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
>> DebugInfo/X86/ref_addr_relocation.ll?rev=289013&r1=
>> 289012&r2=289013&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll (original)
>> +++ llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll Wed Dec 7
>> 19:40:21 2016
>> @@ -1,10 +1,22 @@
>> -; RUN: llc -filetype=asm -O0 -mtriple=x86_64-linux-gnu < %s | FileCheck
>> %s
>> -; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-linux-gnu -o %t
>> -; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=CHECK-DWARF
>> -
>> -; RUN: llc -filetype=asm -O0 -mtriple=x86_64-apple-darwin < %s |
>> FileCheck --check-prefix=DARWIN-ASM %s
>> -; RUN: llc -filetype=obj %s -mtriple=x86_64-apple-darwin -o %t2
>> -; RUN: llvm-dwarfdump %t2 | FileCheck %s -check-prefix=DARWIN-DWARF
>> +; RUN: llc -filetype=asm -O0 -mtriple=x86_64-linux-gnu < %s
>> -dwarf-version 2 | FileCheck -check-prefixes=CHECK,ELF-ASM %s
>> +; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-linux-gnu -o %t-2
>> -dwarf-version 2
>> +; RUN: llvm-dwarfdump %t-2 | FileCheck %s -check-prefix=CHECK-DWARF
>> +; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-linux-gnu -o %t-4
>> -dwarf-version 2
>> +; RUN: llvm-dwarfdump %t-4 | FileCheck %s -check-prefix=CHECK-DWARF
>> +
>> +; RUN: llc -filetype=asm -O0 -mtriple=x86_64-apple-darwin < %s
>> -dwarf-version 2 | FileCheck -check-prefixes=CHECK,DARWIN-ASM2 %s
>> +; RUN: llc -filetype=asm -O0 -mtriple=x86_64-apple-darwin < %s
>> -dwarf-version 4 | FileCheck -check-prefixes=CHECK,DARWIN-ASM4 %s
>> +; RUN: llc -filetype=obj %s -mtriple=x86_64-apple-darwin -o %t2-2
>> -dwarf-version 2
>> +; RUN: llvm-dwarfdump %t2-2 | FileCheck %s -check-prefix=CHECK-DWARF
>> +; RUN: llc -filetype=obj %s -mtriple=x86_64-apple-darwin -o %t2-4
>> -dwarf-version 4
>> +; RUN: llvm-dwarfdump %t2-4 | FileCheck %s -check-prefix=CHECK-DWARF
>> +
>> +; RUN: llc -filetype=asm -O0 -mtriple=x86_64-pc-win32 < %s
>> -dwarf-version 2 | FileCheck -check-prefixes=CHECK,COFF-ASM %s
>> +; RUN: llc -filetype=asm -O0 -mtriple=x86_64-pc-win32 < %s
>> -dwarf-version 4 | FileCheck -check-prefixes=CHECK,COFF-ASM %s
>> +; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-pc-win32 -o %t3-2
>> -dwarf-version 2
>> +; RUN: llvm-dwarfdump %t3-2 | FileCheck %s -check-prefix=CHECK-DWARF2
>> +; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-pc-win32 -o %t3-4
>> -dwarf-version 4
>> +; RUN: llvm-dwarfdump %t3-4 | FileCheck %s -check-prefix=CHECK-DWARF
>>
>> ; Testing case generated from:
>> ; clang++ tu1.cpp tu2.cpp -g -emit-llvm -c
>> @@ -22,7 +34,10 @@
>> ; Make sure we use relocation for ref_addr on non-darwin platforms.
>> ; CHECK: DW_TAG_compile_unit
>> ; CHECK: DW_TAG_variable
>> -; CHECK: .long [[TYPE:.*]] # DW_AT_type
>> +; ELF-ASM: .long [[TYPE:.*]] # DW_AT_type
>> +; DARWIN-ASM2: .long [[TYPE:.*]] ## DW_AT_type
>> +; DARWIN-ASM4: .long [[TYPE:.*]] ## DW_AT_type
>> +; COFF-ASM: .long [[TYPE:.*]] # DW_AT_type
>> ; CHECK: DW_TAG_structure_type
>> ; CHECK: cu_begin1
>> ; CHECK: DW_TAG_compile_unit
>> @@ -30,25 +45,24 @@
>> ; This variable's type is in the 1st CU.
>> ; CHECK: DW_TAG_variable
>> ; Make sure this is relocatable.
>> -; CHECK: .quad .Lsection_info+[[TYPE]] # DW_AT_type
>> +; and test that we don't create the labels to emit a correct COFF
>> relocation
>> +; ELF-ASM: .quad .Lsection_info+[[TYPE]] # DW_AT_type
>> +; COFF-ASM: .secrel32 .Lsection_info+[[TYPE]] # DW_AT_type
>> +; DARWIN-ASM2: .quad [[TYPE]] ## DW_AT_type
>> +; DARWIN-ASM4: .long [[TYPE]] ## DW_AT_type
>> ; CHECK-NOT: DW_TAG_structure_type
>> ; CHECK: .section
>>
>> -; test that we don't create useless labels
>> -; DARWIN-ASM: .long [[TYPE:.*]] ## DW_AT_type
>> -; DARWIN-ASM: .quad [[TYPE]] ## DW_AT_type
>> -
>> ; CHECK-DWARF: DW_TAG_compile_unit
>> ; CHECK-DWARF: 0x[[ADDR:.*]]: DW_TAG_structure_type
>> ; CHECK-DWARF: DW_TAG_compile_unit
>> ; CHECK-DWARF: DW_TAG_variable
>> ; CHECK-DWARF: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[ADDR]])
>>
>> -; DARWIN-DWARF: DW_TAG_compile_unit
>> -; DARWIN-DWARF: 0x[[ADDR:.*]]: DW_TAG_structure_type
>> -; DARWIN-DWARF: DW_TAG_compile_unit
>> -; DARWIN-DWARF: DW_TAG_variable
>> -; DARWIN-DWARF: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[ADDR]])
>> +; CHECK-DWARF2: DW_TAG_compile_unit
>> +; CHECK-DWARF2: DW_TAG_variable
>> +; CHECK-DWARF2: DW_AT_type [DW_FORM_ref4] {{.*}} => {[[ADDR:.*]]})
>> +; CHECK-DWARF2: [[ADDR]]: DW_TAG_structure_type
>>
>> %struct.foo = type { i8 }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
> --
> Mike
> Sent from phone
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161208/35ed8ee8/attachment.html>
More information about the llvm-commits
mailing list