[llvm] r305407 - MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 11:52:12 PDT 2017
Author: pcc
Date: Wed Jun 14 13:52:12 2017
New Revision: 305407
URL: http://llvm.org/viewvc/llvm-project?rev=305407&view=rev
Log:
MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.
This is part of the ODR checker proposal:
http://lists.llvm.org/pipermail/llvm-dev/2017-June/113820.html
Per discussion on the gnu-gabi mailing list [1] the section type range
0x6fff4c00..0x6fff4cff is reserved for LLVM.
[1] https://sourceware.org/ml/gnu-gabi/2017-q2/msg00030.html
Differential Revision: https://reviews.llvm.org/D33978
Modified:
llvm/trunk/include/llvm/BinaryFormat/ELF.h
llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
llvm/trunk/lib/MC/MCSectionELF.cpp
llvm/trunk/lib/Object/ELF.cpp
llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
llvm/trunk/test/MC/ELF/section.s
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/include/llvm/BinaryFormat/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELF.h?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELF.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Wed Jun 14 13:52:12 2017
@@ -683,6 +683,7 @@ enum : unsigned {
SHT_GROUP = 17, // Section group.
SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries.
SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
+ SHT_LLVM_ODRTAB = 0x6fff4c00, // LLVM ODR table.
SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes.
SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table.
SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions.
Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Wed Jun 14 13:52:12 2017
@@ -603,6 +603,8 @@ EndStmt:
Type = ELF::SHT_NOTE;
else if (TypeName == "unwind")
Type = ELF::SHT_X86_64_UNWIND;
+ else if (TypeName == "llvm_odrtab")
+ Type = ELF::SHT_LLVM_ODRTAB;
else if (TypeName.getAsInteger(0, Type))
return TokError("unknown section type");
}
Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Wed Jun 14 13:52:12 2017
@@ -147,6 +147,8 @@ void MCSectionELF::PrintSwitchToSection(
// Print hex value of the flag while we do not have
// any standard symbolic representation of the flag.
OS << "0x7000001e";
+ else if (Type == ELF::SHT_LLVM_ODRTAB)
+ OS << "llvm_odrtab";
else
report_fatal_error("unsupported type 0x" + Twine::utohexstr(Type) +
" for section " + getSectionName());
Modified: llvm/trunk/lib/Object/ELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELF.cpp?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ELF.cpp (original)
+++ llvm/trunk/lib/Object/ELF.cpp Wed Jun 14 13:52:12 2017
@@ -192,6 +192,7 @@ StringRef llvm::object::getELFSectionTyp
STRINGIFY_ENUM_CASE(ELF, SHT_PREINIT_ARRAY);
STRINGIFY_ENUM_CASE(ELF, SHT_GROUP);
STRINGIFY_ENUM_CASE(ELF, SHT_SYMTAB_SHNDX);
+ STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_ODRTAB);
STRINGIFY_ENUM_CASE(ELF, SHT_GNU_ATTRIBUTES);
STRINGIFY_ENUM_CASE(ELF, SHT_GNU_HASH);
STRINGIFY_ENUM_CASE(ELF, SHT_GNU_verdef);
Modified: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFYAML.cpp?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp Wed Jun 14 13:52:12 2017
@@ -372,6 +372,7 @@ void ScalarEnumerationTraits<ELFYAML::EL
ECase(SHT_GROUP);
ECase(SHT_SYMTAB_SHNDX);
ECase(SHT_LOOS);
+ ECase(SHT_LLVM_ODRTAB);
ECase(SHT_GNU_ATTRIBUTES);
ECase(SHT_GNU_HASH);
ECase(SHT_GNU_verdef);
Modified: llvm/trunk/test/MC/ELF/section.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section.s?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section.s (original)
+++ llvm/trunk/test/MC/ELF/section.s Wed Jun 14 13:52:12 2017
@@ -267,3 +267,15 @@ bar:
// CHECK-NEXT: SHF_TLS
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
+
+// Test SHT_LLVM_ODRTAB
+
+.section .odrtab,"e", at llvm_odrtab
+// ASM: .section .odrtab,"e", at llvm_odrtab
+
+// CHECK: Section {
+// CHECK: Name: .odrtab
+// CHECK-NEXT: Type: SHT_LLVM_ODRTAB
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_EXCLUDE
+// CHECK-NEXT: ]
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=305407&r1=305406&r2=305407&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Wed Jun 14 13:52:12 2017
@@ -2629,6 +2629,8 @@ std::string getSectionTypeString(unsigne
return "GROUP";
case SHT_SYMTAB_SHNDX:
return "SYMTAB SECTION INDICES";
+ case SHT_LLVM_ODRTAB:
+ return "LLVM_ODRTAB";
// FIXME: Parse processor specific GNU attributes
case SHT_GNU_ATTRIBUTES:
return "ATTRIBUTES";
More information about the llvm-commits
mailing list