Skip to content

Commit 4e80fb8

Browse files
committed
Support .gehcont as well
1 parent 874c9cc commit 4e80fb8

File tree

3 files changed

+396
-4
lines changed

3 files changed

+396
-4
lines changed

llvm/lib/ObjCopy/COFF/COFFWriter.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ Error COFFWriter::finalizeSymbolContents() {
9494
return Error::success();
9595
}
9696

97-
Error COFFWriter::finalizeCFGuardContents() {
97+
Error COFFWriter::finalizeSymIdxContents() {
9898
// CFGuards shouldn't be present in PE
9999
if (Obj.IsPE)
100100
return Error::success();
101101

102+
// Currently handle only sections consisting only of .symidx.
103+
// TODO: other sections such as .impcall and .hybmp$x require more complex
104+
// handling as they have more complex layout.
102105
auto IsSymIdxSection = [](StringRef Name) {
103-
return Name == ".gljmp$y" || Name == ".giats$y" || Name == ".gfids$y";
106+
return Name == ".gljmp$y" || Name == ".giats$y" || Name == ".gfids$y" ||
107+
Name == ".gehcont$y";
104108
};
105109

106110
DenseMap<size_t, size_t> SymIdMap;
@@ -254,7 +258,7 @@ Error COFFWriter::finalize(bool IsBigObj) {
254258
return E;
255259
if (Error E = finalizeSymbolContents())
256260
return E;
257-
if (Error E = finalizeCFGuardContents())
261+
if (Error E = finalizeSymIdxContents())
258262
return E;
259263

260264
size_t SizeOfHeaders = 0;

llvm/lib/ObjCopy/COFF/COFFWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class COFFWriter {
3434
template <class SymbolTy> std::pair<size_t, size_t> finalizeSymbolTable();
3535
Error finalizeRelocTargets();
3636
Error finalizeSymbolContents();
37-
Error finalizeCFGuardContents();
37+
Error finalizeSymIdxContents();
3838
void layoutSections();
3939
Expected<size_t> finalizeStringTable();
4040

0 commit comments

Comments
 (0)