Index: lib/MC/MCContext.cpp =================================================================== --- lib/MC/MCContext.cpp +++ lib/MC/MCContext.cpp @@ -516,8 +516,10 @@ StringRef CachedName = Entry.first.SectionName; MCSymbol *Begin = nullptr; - if (BeginSymName) - Begin = createTempSymbol(BeginSymName, false); + if (BeginSymName) { + Begin = createSymbol(BeginSymName, false, false); + cast(Begin)->setType(wasm::WASM_SYMBOL_TYPE_SECTION); + } MCSectionWasm *Result = new (WasmAllocator.Allocate()) MCSectionWasm(CachedName, Kind, GroupSym, UniqueID, Begin); Index: lib/MC/MCObjectFileInfo.cpp =================================================================== --- lib/MC/MCObjectFileInfo.cpp +++ lib/MC/MCObjectFileInfo.cpp @@ -866,19 +866,19 @@ DataSection = Ctx->getWasmSection(".data", SectionKind::getData()); // TODO: Set the section types and flags. - DwarfLineSection = Ctx->getWasmSection(".debug_line", SectionKind::getMetadata()); + DwarfLineSection = Ctx->getWasmSection(".debug_line", SectionKind::getMetadata(), ".debug_line"); DwarfLineStrSection = Ctx->getWasmSection(".debug_line_str", SectionKind::getMetadata()); - DwarfStrSection = Ctx->getWasmSection(".debug_str", SectionKind::getMetadata()); + DwarfStrSection = Ctx->getWasmSection(".debug_str", SectionKind::getMetadata(), ".debug_str"); DwarfLocSection = Ctx->getWasmSection(".debug_loc", SectionKind::getMetadata()); - DwarfAbbrevSection = Ctx->getWasmSection(".debug_abbrev", SectionKind::getMetadata(), "section_abbrev"); + DwarfAbbrevSection = Ctx->getWasmSection(".debug_abbrev", SectionKind::getMetadata(), ".section_abbrev"); DwarfARangesSection = Ctx->getWasmSection(".debug_aranges", SectionKind::getMetadata()); - DwarfRangesSection = Ctx->getWasmSection(".debug_ranges", SectionKind::getMetadata(), "debug_range"); - DwarfMacinfoSection = Ctx->getWasmSection(".debug_macinfo", SectionKind::getMetadata(), "debug_macinfo"); + DwarfRangesSection = Ctx->getWasmSection(".debug_ranges", SectionKind::getMetadata(), ".debug_range"); + DwarfMacinfoSection = Ctx->getWasmSection(".debug_macinfo", SectionKind::getMetadata(), ".debug_macinfo"); DwarfAddrSection = Ctx->getWasmSection(".debug_addr", SectionKind::getMetadata()); DwarfCUIndexSection = Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata()); DwarfTUIndexSection = Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata()); - DwarfInfoSection = Ctx->getWasmSection(".debug_info", SectionKind::getMetadata(), "section_info"); + DwarfInfoSection = Ctx->getWasmSection(".debug_info", SectionKind::getMetadata(), ".section_info"); DwarfFrameSection = Ctx->getWasmSection(".debug_frame", SectionKind::getMetadata()); DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata()); DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata()); Index: lib/MC/MCWasmStreamer.cpp =================================================================== --- lib/MC/MCWasmStreamer.cpp +++ lib/MC/MCWasmStreamer.cpp @@ -156,17 +156,8 @@ } void MCWasmStreamer::EmitIdent(StringRef IdentString) { - MCSection *Comment = getAssembler().getContext().getWasmSection( - ".comment", SectionKind::getMetadata()); - PushSection(); - SwitchSection(Comment); - if (!SeenIdent) { - EmitIntValue(0, 1); - SeenIdent = true; - } - EmitBytes(IdentString); - EmitIntValue(0, 1); - PopSection(); + // TODO(sbc): Add the ident section once we support mergable strings + // sections in the object format } void MCWasmStreamer::EmitInstToFragment(const MCInst &Inst, Index: lib/MC/WasmObjectWriter.cpp =================================================================== --- lib/MC/WasmObjectWriter.cpp +++ lib/MC/WasmObjectWriter.cpp @@ -242,8 +242,6 @@ DenseMap WasmIndices; // Maps data symbols to the Wasm segment and offset/size with the segment. DenseMap DataLocations; - // Maps section symbols to the section. - DenseMap CustomSectionSymbols; // Stores output data (index, relocations, content offset) for custom // section. @@ -293,13 +291,15 @@ FunctionTypes.clear(); Globals.clear(); DataSegments.clear(); - CustomSectionSymbols.clear(); MCObjectWriter::reset(); NumFunctionImports = 0; NumGlobalImports = 0; } void writeHeader(const MCAssembler &Asm); + bool shouldRelocateWithSymbol(const MCSymbolRefExpr *Ref, + const MCSymbolWasm *Sym, + unsigned Type) const; void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, @@ -414,6 +414,47 @@ const MCAsmLayout &Layout) { } +// It is always valid to create a relocation with a symbol. It is preferable +// to use a relocation with a section if that is possible. Using the section +// allows us to omit some local symbols from the symbol table. +bool WasmObjectWriter::shouldRelocateWithSymbol(const MCSymbolRefExpr *Ref, + const MCSymbolWasm *Sym, + unsigned Type) const { + if (!Ref) + return false; + + if (Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32 || + Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32) + return false; + + if (Sym->isUndefined()) + return true; + + if (Sym->isTemporary() && Sym->getName().empty()) + return false; + + if (Sym->isData()) + return true; + + if (Sym->isFunction()) + return true; + + if (Sym->isWeak()) { + // If the symbol is weak, it might be overridden by a symbol in another + // file. The relocation has to point to the symbol so that the linker + // can update it. + return true; + } + + if (Sym->isGlobal()) { + // Global ELF symbols can be preempted by the dynamic linker. The relocation + // has to point to the symbol for a reason analogous to the STB_WEAK case. + return true; + } + + return false; +} + void WasmObjectWriter::recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, @@ -431,11 +472,6 @@ if (FixupSection.getSectionName().startswith(".init_array")) return; - // TODO: Add support for non-debug metadata sections? - if (FixupSection.getKind().isMetadata() && - !FixupSection.getSectionName().startswith(".debug_")) - return; - if (const MCSymbolRefExpr *RefB = Target.getSymB()) { assert(RefB->getKind() == MCSymbolRefExpr::VK_None && "Should not have constructed this"); @@ -493,36 +529,60 @@ // be negative and don't wrap. FixedValue = 0; - if (SymA) - SymA->setUsedInReloc(); - + unsigned Type = getRelocType(Target, Fixup); assert(!IsPCRel); assert(SymA); - unsigned Type = getRelocType(Target, Fixup); + // Add containing absolute offset within functions or sections are only + // currently supports for metadata sections + // See: test/MC/WebAssembly/blockaddress.ll + if (Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32 || + Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32) { + if (!FixupSection.getKind().isMetadata()) + report_fatal_error("relocations for function or section offsets are " + "only supported for metadata sections"); + } - WasmRelocationEntry Rec(FixupOffset, SymA, C, Type, &FixupSection); - DEBUG(dbgs() << "WasmReloc: " << Rec << "\n"); + bool RelocateWithSymbol = shouldRelocateWithSymbol(RefA, SymA, Type); + if (!RelocateWithSymbol) { + const MCSymbolWasm *SectionSymbol = nullptr; + const MCSection &SecA = SymA->getSection(); + if (SecA.getKind().isText()) { + //dbgs() << "FRAGS = " << SecA.getFragmentList().size() << "\n"; + const MCFragment &Frag = *SecA.begin(); + //dbgs() << Frag << "\n"; + SectionSymbol = cast(Frag.getAtom()); + } else { + SectionSymbol = cast_or_null(SecA.getBeginSymbol()); + } + if (SectionSymbol) { + assert(Type != wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB); + SectionSymbol->setUsedInReloc(); + C += Layout.getSymbolOffset(*SymA); + WasmRelocationEntry Rec(FixupOffset, SectionSymbol, C, Type, &FixupSection); + DEBUG(dbgs() << "WasmRelocX: " << Rec << "\n"); + assert(FixupSection.getKind().isMetadata()); + CustomSectionsRelocations[&FixupSection].push_back(Rec); + return; + } + } - // Relocation other than R_WEBASSEMBLY_TYPE_INDEX_LEB, - // R_WEBASSEMBLY_SECTION_OFFSET_I32 or R_WEBASSEMBLY_FUNCTION_OFFSET_I32 - // are currently required to be against a named symbol. - // TODO(sbc): Add support for relocations against unnamed temporaries such - // as those generated by llvm's `blockaddress`. - // See: test/MC/WebAssembly/blockaddress.ll - if (SymA->getName().empty() && - !(Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB || - Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32 || - Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32)) + // Relocation other than R_WEBASSEMBLY_TYPE_INDEX_LEB are required to be + // against a named symbol. + if (SymA->getName().empty() && Type != wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) report_fatal_error("relocations against un-named temporaries are not yet " "supported by wasm"); + if (SymA && Type != wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) + SymA->setUsedInReloc(); + WasmRelocationEntry Rec(FixupOffset, SymA, C, Type, &FixupSection); + DEBUG(dbgs() << "WasmReloc: " << Rec << "\n"); + if (FixupSection.isWasmData()) { DataRelocations.push_back(Rec); } else if (FixupSection.getKind().isText()) { CodeRelocations.push_back(Rec); } else if (FixupSection.getKind().isMetadata()) { - assert(FixupSection.getSectionName().startswith(".debug_")); CustomSectionsRelocations[&FixupSection].push_back(Rec); } else { llvm_unreachable("unexpected section type"); @@ -595,7 +655,8 @@ return Section.getSectionOffset() + RelEntry.Addend; } case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32: { - const auto &Section = *CustomSectionSymbols.find(RelEntry.Symbol)->second; + const auto &Section = + static_cast(RelEntry.Symbol->getSection()); return Section.getSectionOffset() + RelEntry.Addend; } case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB: @@ -1031,49 +1092,10 @@ CustomSection.OutputIndex = Section.Index; endSection(Section); - } -} - -void WasmObjectWriter::updateCustomSectionRelocations( - const SmallVector &Functions, const MCAsmLayout &Layout) { - std::map SectionSymbols; - for (const auto &P : CustomSectionSymbols) - SectionSymbols[P.second] = P.first; - std::map FuncSymbols; - for (const auto &FuncInfo : Functions) - FuncSymbols[&FuncInfo.Sym->getSection()] = FuncInfo.Sym; - - // Patch relocation records for R_WEBASSEMBLY_FUNCTION_OFFSET_I32 and - // R_WEBASSEMBLY_SECTION_OFFSET_I32. The Addend is stuffed the offset from - // the beginning of the function or custom section -- all such relocations - // target the function or custom section starts. - for (auto &Section : CustomSections) { - auto &Relocations = CustomSectionsRelocations[Section.Section]; - for (WasmRelocationEntry &RelEntry : Relocations) { - switch (RelEntry.Type) { - case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32: { - assert(RelEntry.hasAddend()); - auto &Section = - static_cast(RelEntry.Symbol->getSection()); - RelEntry.Addend += Layout.getSymbolOffset(*RelEntry.Symbol); - RelEntry.Symbol = FuncSymbols[&Section]; - break; - } - case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32: { - assert(RelEntry.hasAddend()); - auto &Section = - static_cast(RelEntry.Symbol->getSection()); - RelEntry.Addend += Layout.getSymbolOffset(*RelEntry.Symbol); - RelEntry.Symbol = SectionSymbols[&Section]; - break; - } - default: - break; - } - } // Apply fixups. - applyRelocations(Relocations, Section.OutputContentsOffset); + auto &Relocations = CustomSectionsRelocations[CustomSection.Section]; + applyRelocations(Relocations, CustomSection.OutputContentsOffset); } } @@ -1102,6 +1124,25 @@ return Pair.first->second; } +static bool isInSymtab(const MCSymbolWasm &Sym) { + if (Sym.isUsedInReloc()) + return true; + + if (Sym.isComdat() && !Sym.isDefined()) + return false; + + if (Sym.isTemporary() && Sym.getName().empty()) + return false; + + if (Sym.isTemporary() && Sym.isData() && !Sym.getSize()) + return false; + + if (Sym.isSection()) + return false; + + return true; +} + void WasmObjectWriter::writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) { DEBUG(dbgs() << "WasmObjectWriter::writeObject\n"); @@ -1179,76 +1220,58 @@ } } - // Populate DataSegments, which must be done before populating DataLocations. + // Populate DataSegments and CustomSections, which must be done before + // populating DataLocations. for (MCSection &Sec : Asm) { auto &Section = static_cast(Sec); - - if (Section.getSectionName().startswith(".custom_section.")) { - if (Section.getFragmentList().empty()) - continue; - if (Section.getFragmentList().size() != 1) - report_fatal_error( - "only one .custom_section section fragment supported"); - const MCFragment &Frag = *Section.begin(); - if (Frag.hasInstructions() || Frag.getKind() != MCFragment::FT_Data) - report_fatal_error("only data supported in .custom_section section"); - const auto &DataFrag = cast(Frag); - if (!DataFrag.getFixups().empty()) - report_fatal_error("fixups not supported in .custom_section section"); - StringRef UserName = Section.getSectionName().substr(16); - CustomSections.emplace_back(UserName, &Section); - continue; - } - - if (!Section.isWasmData()) - continue; + StringRef SectionName = Section.getSectionName(); // .init_array sections are handled specially elsewhere. - if (cast(Sec).getSectionName().startswith(".init_array")) + if (SectionName.startswith(".init_array")) continue; - uint32_t SegmentIndex = DataSegments.size(); - DataSize = alignTo(DataSize, Section.getAlignment()); - DataSegments.emplace_back(); - WasmDataSegment &Segment = DataSegments.back(); - Segment.Name = Section.getSectionName(); - Segment.Offset = DataSize; - Segment.Section = &Section; - addData(Segment.Data, Section); - Segment.Alignment = Section.getAlignment(); - Segment.Flags = 0; - DataSize += Segment.Data.size(); - Section.setSegmentIndex(SegmentIndex); - - if (const MCSymbolWasm *C = Section.getGroup()) { - Comdats[C->getName()].emplace_back( - WasmComdatEntry{wasm::WASM_COMDAT_DATA, SegmentIndex}); - } - } - - // Create symbols for debug/custom sections. - for (MCSection &Sec : Asm) { - auto &DebugSection = static_cast(Sec); - StringRef SectionName = DebugSection.getSectionName(); - - // TODO: Add support for non-debug metadata sections? - if (!Sec.getKind().isMetadata() || !SectionName.startswith(".debug_")) + // Code is handled separately + if (Section.getKind().isText()) continue; - uint32_t ElementIndex = CustomSections.size(); - CustomSections.emplace_back(SectionName, &DebugSection); - - MCSymbolWasm *SectionSym = - cast(Ctx.getOrCreateSymbol(SectionName)); - CustomSectionSymbols[SectionSym] = &DebugSection; - - wasm::WasmSymbolInfo Info; - Info.Name = SectionSym->getName(); - Info.Kind = wasm::WASM_SYMBOL_TYPE_SECTION; - Info.Flags = wasm::WASM_SYMBOL_BINDING_LOCAL; - Info.ElementIndex = ElementIndex; - SymbolIndices[SectionSym] = SymbolInfos.size(); - SymbolInfos.emplace_back(Info); + if (Section.isWasmData()) { + uint32_t SegmentIndex = DataSegments.size(); + DataSize = alignTo(DataSize, Section.getAlignment()); + DataSegments.emplace_back(); + WasmDataSegment &Segment = DataSegments.back(); + Segment.Name = SectionName; + Segment.Offset = DataSize; + Segment.Section = &Section; + addData(Segment.Data, Section); + Segment.Alignment = Section.getAlignment(); + Segment.Flags = 0; + DataSize += Segment.Data.size(); + Section.setSegmentIndex(SegmentIndex); + + if (const MCSymbolWasm *C = Section.getGroup()) { + Comdats[C->getName()].emplace_back( + WasmComdatEntry{wasm::WASM_COMDAT_DATA, SegmentIndex}); + } + } else { + // Create custom sections + assert(Sec.getKind().isMetadata()); + + StringRef Name; + + // Create section symbols for debug sections. + // We don't do this for user-defined custom sections becasue they + // don't have relocations, and also the names could collide with other + // things in the symbol table. + if (SectionName.startswith(".custom_section.")) + Name = SectionName.substr(strlen(".custom_section.")); + else + Name = SectionName; + + MCSymbol* Begin = Sec.getBeginSymbol(); + if (Begin) + WasmIndices[cast(Begin)] = CustomSections.size(); + CustomSections.emplace_back(Name, &Section); + } } // Populate WasmIndices and DataLocations for defined symbols. @@ -1378,12 +1401,9 @@ // Finally, populate the symbol table itself, in its "natural" order. for (const MCSymbol &S : Asm.symbols()) { const auto &WS = static_cast(S); - if (WS.isTemporary() && WS.getName().empty()) - continue; - if (WS.isComdat() && !WS.isDefined()) - continue; - if (WS.isTemporary() && WS.isData() && !WS.getSize()) + if (!isInSymtab(WS)) continue; + DEBUG(dbgs() << "adding to symtab: " << WS << " " << WS.isData() << "\n"); uint32_t Flags = 0; if (WS.isWeak()) @@ -1399,10 +1419,16 @@ Info.Name = WS.getName(); Info.Kind = WS.getType(); Info.Flags = Flags; - if (!WS.isData()) + if (!WS.isData()) { + if (WasmIndices.count(&WS) == 0) + report_fatal_error("symbol not found in WasmIndices: " + WS.getName()); Info.ElementIndex = WasmIndices.find(&WS)->second; - else if (WS.isDefined()) + } else if (WS.isDefined()) { + if (DataLocations.count(&WS) == 0) + report_fatal_error("symbol not found in DataLocations: " + + WS.getName()); Info.DataRef = DataLocations.find(&WS)->second; + } SymbolIndices[&WS] = SymbolInfos.size(); SymbolInfos.emplace_back(Info); } @@ -1453,10 +1479,13 @@ if (Frag.hasInstructions() || Frag.getKind() != MCFragment::FT_Data) report_fatal_error("only data supported in .init_array section"); uint16_t Priority = UINT16_MAX; - if (WS.getSectionName().size() != 11) { - if (WS.getSectionName()[11] != '.') + unsigned PrefixLength = strlen(".init_array"); + if (WS.getSectionName().size() > PrefixLength) { + if (WS.getSectionName()[PrefixLength] != '.') report_fatal_error(".init_array section priority should start with '.'"); - if (WS.getSectionName().substr(12).getAsInteger(10, Priority)) + if (WS.getSectionName() + .substr(PrefixLength + 1) + .getAsInteger(10, Priority)) report_fatal_error("invalid .init_array section priority"); } const auto &DataFrag = cast(Frag); @@ -1476,8 +1505,10 @@ if (Sym->getKind() != MCSymbolRefExpr::VK_WebAssembly_FUNCTION) report_fatal_error("symbols in .init_array should be for functions"); auto I = SymbolIndices.find(cast(&Sym->getSymbol())); - if (I == SymbolIndices.end()) + if (I == SymbolIndices.end()) { + dbgs() << *Sym << "\n"; report_fatal_error("symbols in .init_array should be defined"); + } uint32_t Index = I->second; InitFuncs.push_back(std::make_pair(Priority, Index)); } @@ -1497,7 +1528,6 @@ writeCodeSection(Asm, Layout, Functions); writeDataSection(); writeCustomSections(Asm, Layout); - updateCustomSectionRelocations(Functions, Layout); writeLinkingMetaDataSection(SymbolInfos, InitFuncs, Comdats); writeRelocSection(CodeSectionIndex, "CODE", CodeRelocations); writeRelocSection(DataSectionIndex, "DATA", DataRelocations); Index: test/MC/WebAssembly/blockaddress.ll =================================================================== --- test/MC/WebAssembly/blockaddress.ll +++ test/MC/WebAssembly/blockaddress.ll @@ -1,6 +1,6 @@ ; TODO(sbc): Make this test pass by adding support for unnamed tempoaries ; in wasm relocations. -; RUN: not llc -filetype=obj %s +; RUN: not llc -filetype=obj %s 2>&1 | FileCheck %s target triple = "wasm32-unknown-unknown-wasm" @@ -13,3 +13,6 @@ addr: ret i32 0 } + +; CHECK: LLVM ERROR: relocations for function or section offsets are only supported for metadata sections + Index: test/MC/WebAssembly/debug-info.ll =================================================================== --- test/MC/WebAssembly/debug-info.ll +++ test/MC/WebAssembly/debug-info.ll @@ -96,38 +96,38 @@ ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) -; CHECK-NEXT: Size: 100 +; CHECK-NEXT: Size: 88 ; CHECK-NEXT: Offset: 733 ; CHECK-NEXT: Name: linking ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 9 -; CHECK-NEXT: Offset: 847 +; CHECK-NEXT: Offset: 835 ; CHECK-NEXT: Name: reloc.DATA ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 58 -; CHECK-NEXT: Offset: 873 +; CHECK-NEXT: Offset: 861 ; CHECK-NEXT: Name: reloc..debug_info ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 955 +; CHECK-NEXT: Offset: 943 ; CHECK-NEXT: Name: reloc..debug_pubnames ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 989 +; CHECK-NEXT: Offset: 977 ; CHECK-NEXT: Name: reloc..debug_pubtypes ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 1023 +; CHECK-NEXT: Offset: 1011 ; CHECK-NEXT: Name: reloc..debug_line ; CHECK-NEXT: } ; CHECK-NEXT:] @@ -163,37 +163,37 @@ ; CHECK-NEXT:] ; CHECK-NEXT:Symbols [ ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_str -; CHECK-NEXT: Type: SECTION (0x3) -; CHECK-NEXT: Flags: 0x2 +; CHECK-NEXT: Name: f2 +; CHECK-NEXT: Type: FUNCTION (0x0) +; CHECK-NEXT: Flags: 0x4 ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_abbrev -; CHECK-NEXT: Type: SECTION (0x3) -; CHECK-NEXT: Flags: 0x2 +; CHECK-NEXT: Name: foo +; CHECK-NEXT: Type: DATA (0x1) +; CHECK-NEXT: Flags: 0x4 ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_info -; CHECK-NEXT: Type: SECTION (0x3) -; CHECK-NEXT: Flags: 0x2 +; CHECK-NEXT: Name: myextern +; CHECK-NEXT: Type: DATA (0x1) +; CHECK-NEXT: Flags: 0x10 ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_ranges -; CHECK-NEXT: Type: SECTION (0x3) -; CHECK-NEXT: Flags: 0x2 +; CHECK-NEXT: Name: ptr2 +; CHECK-NEXT: Type: DATA (0x1) +; CHECK-NEXT: Flags: 0x4 ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_macinfo +; CHECK-NEXT: Name: .debug_str ; CHECK-NEXT: Type: SECTION (0x3) ; CHECK-NEXT: Flags: 0x2 ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_pubnames +; CHECK-NEXT: Name: .debug_abbrev ; CHECK-NEXT: Type: SECTION (0x3) ; CHECK-NEXT: Flags: 0x2 ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: .debug_pubtypes +; CHECK-NEXT: Name: .debug_info ; CHECK-NEXT: Type: SECTION (0x3) ; CHECK-NEXT: Flags: 0x2 ; CHECK-NEXT: } @@ -202,26 +202,6 @@ ; CHECK-NEXT: Type: SECTION (0x3) ; CHECK-NEXT: Flags: 0x2 ; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: f2 -; CHECK-NEXT: Type: FUNCTION (0x0) -; CHECK-NEXT: Flags: 0x4 -; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: foo -; CHECK-NEXT: Type: DATA (0x1) -; CHECK-NEXT: Flags: 0x4 -; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: myextern -; CHECK-NEXT: Type: DATA (0x1) -; CHECK-NEXT: Flags: 0x10 -; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: ptr2 -; CHECK-NEXT: Type: DATA (0x1) -; CHECK-NEXT: Flags: 0x4 -; CHECK-NEXT: } ; CHECK-NEXT:] target triple = "wasm32-unknown-unknown-wasm"