Revert "Introduce llvm-install-name-tool"
This reverts commit b5913e6d2f6d13fb753df701619731ca11936316.
diff --git a/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp b/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
index 652c0ac..d14354e 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
@@ -59,18 +59,6 @@
Obj.SymTable.removeSymbols(RemovePred);
}
-static LoadCommand buildRPathLoadCommand(StringRef Path) {
- LoadCommand LC;
- MachO::rpath_command RPathLC;
- RPathLC.cmd = MachO::LC_RPATH;
- RPathLC.path = sizeof(MachO::rpath_command);
- RPathLC.cmdsize = alignTo(sizeof(MachO::rpath_command) + Path.size(), 8);
- LC.MachOLoadCommand.rpath_command_data = RPathLC;
- LC.Payload.assign(RPathLC.cmdsize - sizeof(MachO::rpath_command), 0);
- std::copy(Path.begin(), Path.end(), LC.Payload.begin());
- return LC;
-}
-
static Error handleArgs(const CopyConfig &Config, Object &Obj) {
if (Config.AllowBrokenLinks || !Config.BuildIdLinkDir.empty() ||
Config.BuildIdLinkInput || Config.BuildIdLinkOutput ||
@@ -93,6 +81,7 @@
return createStringError(llvm::errc::invalid_argument,
"option not supported by llvm-objcopy for MachO");
}
+
removeSections(Config, Obj);
// Mark symbols to determine which symbols are still needed.
@@ -106,19 +95,6 @@
for (Section &Sec : LC.Sections)
Sec.Relocations.clear();
- for (StringRef RPath : Config.RPathToAdd) {
- for (LoadCommand &LC : Obj.LoadCommands) {
- if (LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_RPATH &&
- RPath == StringRef(reinterpret_cast<char *>(LC.Payload.data()),
- LC.Payload.size())
- .trim(0)) {
- return createStringError(errc::invalid_argument,
- "rpath " + RPath +
- " would create a duplicate load command");
- }
- }
- Obj.addLoadCommand(buildRPathLoadCommand(RPath));
- }
return Error::success();
}
diff --git a/llvm/tools/llvm-objcopy/MachO/Object.cpp b/llvm/tools/llvm-objcopy/MachO/Object.cpp
index 812853e..5626782 100644
--- a/llvm/tools/llvm-objcopy/MachO/Object.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/Object.cpp
@@ -29,10 +29,6 @@
std::end(LC.Sections));
}
-void Object::addLoadCommand(LoadCommand LC) {
- LoadCommands.push_back(std::move(LC));
-}
-
} // end namespace macho
} // end namespace objcopy
} // end namespace llvm
diff --git a/llvm/tools/llvm-objcopy/MachO/Object.h b/llvm/tools/llvm-objcopy/MachO/Object.h
index 098556d..8642ce3 100644
--- a/llvm/tools/llvm-objcopy/MachO/Object.h
+++ b/llvm/tools/llvm-objcopy/MachO/Object.h
@@ -74,7 +74,7 @@
// The raw content of the payload of the load command (located right after the
// corresponding struct). In some cases it is either empty or can be
// copied-over without digging into its structure.
- std::vector<uint8_t> Payload;
+ ArrayRef<uint8_t> Payload;
// Some load commands can contain (inside the payload) an array of sections,
// though the contents of the sections are stored separately. The struct
@@ -270,7 +270,6 @@
Optional<size_t> FunctionStartsCommandIndex;
void removeSections(function_ref<bool(const Section &)> ToRemove);
- void addLoadCommand(LoadCommand LC);
};
} // end namespace macho