Skip to content

Commit ca6f616

Browse files
author
Georgii Rymar
committed
Revert "[yaml2obj/obj2yaml] - Add support for SHT_RELR sections."
This reverts commit 46d11e3. It broke bots. E.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/60744
1 parent 884a65a commit ca6f616

File tree

6 files changed

+7
-401
lines changed

6 files changed

+7
-401
lines changed

llvm/include/llvm/ObjectYAML/ELFYAML.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ struct Chunk {
138138
Group,
139139
RawContent,
140140
Relocation,
141-
Relr,
142141
NoBits,
143142
Note,
144143
Hash,
@@ -441,17 +440,6 @@ struct RelocationSection : Section {
441440
}
442441
};
443442

444-
struct RelrSection : Section {
445-
Optional<std::vector<llvm::yaml::Hex64>> Entries;
446-
Optional<yaml::BinaryRef> Content;
447-
448-
RelrSection() : Section(ChunkKind::Relr) {}
449-
450-
static bool classof(const Chunk *S) {
451-
return S->Kind == ChunkKind::Relr;
452-
}
453-
};
454-
455443
struct SymtabShndxSection : Section {
456444
std::vector<uint32_t> Entries;
457445

llvm/lib/ObjectYAML/ELFEmitter.cpp

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ template <class ELFT> class ELFState {
110110
typedef typename ELFT::Rela Elf_Rela;
111111
typedef typename ELFT::Relr Elf_Relr;
112112
typedef typename ELFT::Dyn Elf_Dyn;
113-
typedef typename ELFT::uint uintX_t;
114113

115114
enum class SymtabType { Static, Dynamic };
116115

@@ -166,9 +165,6 @@ template <class ELFT> class ELFState {
166165
void writeSectionContent(Elf_Shdr &SHeader,
167166
const ELFYAML::RelocationSection &Section,
168167
ContiguousBlobAccumulator &CBA);
169-
void writeSectionContent(Elf_Shdr &SHeader,
170-
const ELFYAML::RelrSection &Section,
171-
ContiguousBlobAccumulator &CBA);
172168
void writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::Group &Group,
173169
ContiguousBlobAccumulator &CBA);
174170
void writeSectionContent(Elf_Shdr &SHeader,
@@ -458,8 +454,6 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders,
458454
writeSectionContent(SHeader, *S, CBA);
459455
} else if (auto S = dyn_cast<ELFYAML::RelocationSection>(Sec)) {
460456
writeSectionContent(SHeader, *S, CBA);
461-
} else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) {
462-
writeSectionContent(SHeader, *S, CBA);
463457
} else if (auto S = dyn_cast<ELFYAML::Group>(Sec)) {
464458
writeSectionContent(SHeader, *S, CBA);
465459
} else if (auto S = dyn_cast<ELFYAML::MipsABIFlags>(Sec)) {
@@ -776,6 +770,10 @@ void ELFState<ELFT>::writeSectionContent(
776770

777771
if (Section.EntSize)
778772
SHeader.sh_entsize = *Section.EntSize;
773+
else if (Section.Type == llvm::ELF::SHT_RELR)
774+
SHeader.sh_entsize = sizeof(Elf_Relr);
775+
else
776+
SHeader.sh_entsize = 0;
779777

780778
if (Section.Info)
781779
SHeader.sh_info = *Section.Info;
@@ -829,30 +827,6 @@ void ELFState<ELFT>::writeSectionContent(
829827
}
830828
}
831829

832-
template <class ELFT>
833-
void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
834-
const ELFYAML::RelrSection &Section,
835-
ContiguousBlobAccumulator &CBA) {
836-
raw_ostream &OS =
837-
CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign);
838-
SHeader.sh_entsize =
839-
Section.EntSize ? uint64_t(*Section.EntSize) : sizeof(Elf_Relr);
840-
841-
if (Section.Content) {
842-
SHeader.sh_size = writeContent(OS, Section.Content, None);
843-
return;
844-
}
845-
846-
for (llvm::yaml::Hex64 E : *Section.Entries) {
847-
if (!ELFT::Is64Bits && E > UINT32_MAX)
848-
reportError(Section.Name + ": the value is too large for 32-bits: 0x" +
849-
Twine::utohexstr(E));
850-
support::endian::write<uintX_t>(OS, E, ELFT::TargetEndianness);
851-
}
852-
853-
SHeader.sh_size = sizeof(uintX_t) * Section.Entries->size();
854-
}
855-
856830
template <class ELFT>
857831
void ELFState<ELFT>::writeSectionContent(
858832
Elf_Shdr &SHeader, const ELFYAML::SymtabShndxSection &Shndx,
@@ -915,6 +889,7 @@ template <class ELFT>
915889
void ELFState<ELFT>::writeSectionContent(
916890
Elf_Shdr &SHeader, const ELFYAML::StackSizesSection &Section,
917891
ContiguousBlobAccumulator &CBA) {
892+
using uintX_t = typename ELFT::uint;
918893
raw_ostream &OS =
919894
CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign);
920895

@@ -1140,6 +1115,8 @@ template <class ELFT>
11401115
void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
11411116
const ELFYAML::DynamicSection &Section,
11421117
ContiguousBlobAccumulator &CBA) {
1118+
typedef typename ELFT::uint uintX_t;
1119+
11431120
assert(Section.Type == llvm::ELF::SHT_DYNAMIC &&
11441121
"Section type is not SHT_DYNAMIC");
11451122

llvm/lib/ObjectYAML/ELFYAML.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,12 +1101,6 @@ static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
11011101
IO.mapOptional("Relocations", Section.Relocations);
11021102
}
11031103

1104-
static void sectionMapping(IO &IO, ELFYAML::RelrSection &Section) {
1105-
commonSectionMapping(IO, Section);
1106-
IO.mapOptional("Entries", Section.Entries);
1107-
IO.mapOptional("Content", Section.Content);
1108-
}
1109-
11101104
static void groupSectionMapping(IO &IO, ELFYAML::Group &Group) {
11111105
commonSectionMapping(IO, Group);
11121106
IO.mapOptional("Info", Group.Signature);
@@ -1206,11 +1200,6 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
12061200
Section.reset(new ELFYAML::RelocationSection());
12071201
sectionMapping(IO, *cast<ELFYAML::RelocationSection>(Section.get()));
12081202
break;
1209-
case ELF::SHT_RELR:
1210-
if (!IO.outputting())
1211-
Section.reset(new ELFYAML::RelrSection());
1212-
sectionMapping(IO, *cast<ELFYAML::RelrSection>(Section.get()));
1213-
break;
12141203
case ELF::SHT_GROUP:
12151204
if (!IO.outputting())
12161205
Section.reset(new ELFYAML::Group());
@@ -1452,12 +1441,6 @@ StringRef MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::validate(
14521441
return {};
14531442
}
14541443

1455-
if (const auto *RS = dyn_cast<ELFYAML::RelrSection>(C.get())) {
1456-
if (RS->Entries && RS->Content)
1457-
return "\"Entries\" and \"Content\" can't be used together";
1458-
return {};
1459-
}
1460-
14611444
return {};
14621445
}
14631446

llvm/test/tools/obj2yaml/relr-section.yaml

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)