}
template <class ELFT>
-void setAddend(Elf_Rel_Impl<ELFT, false> &Rel, uint64_t Addend) {}
+static void setAddend(Elf_Rel_Impl<ELFT, false> &Rel, uint64_t Addend) {}
template <class ELFT>
-void setAddend(Elf_Rel_Impl<ELFT, true> &Rela, uint64_t Addend) {
+static void setAddend(Elf_Rel_Impl<ELFT, true> &Rela, uint64_t Addend) {
Rela.r_addend = Addend;
}
template <class RelRange, class T>
-void writeRel(const RelRange &Relocations, T *Buf) {
+static void writeRel(const RelRange &Relocations, T *Buf) {
for (const auto &Reloc : Relocations) {
Buf->r_offset = Reloc.Offset;
setAddend(*Buf, Reloc.Addend);
}
template <class T>
-void initRelocations(RelocationSection *Relocs, SymbolTableSection *SymbolTable,
- T RelRange) {
+static void initRelocations(RelocationSection *Relocs,
+ SymbolTableSection *SymbolTable, T RelRange) {
for (const auto &Rel : RelRange) {
Relocation ToAdd;
ToAdd.Offset = Rel.r_offset;
exit(1);
}
-} // end namespace llvm
-
struct CopyConfig {
StringRef OutputFilename;
StringRef InputFilename;
using SectionPred = std::function<bool(const SectionBase &Sec)>;
-bool IsDWOSection(const SectionBase &Sec) { return Sec.Name.endswith(".dwo"); }
+} // end namespace llvm
+
+static bool IsDWOSection(const SectionBase &Sec) {
+ return Sec.Name.endswith(".dwo");
+}
-bool OnlyKeepDWOPred(const Object &Obj, const SectionBase &Sec) {
+static bool OnlyKeepDWOPred(const Object &Obj, const SectionBase &Sec) {
// We can't remove the section header string table.
if (&Sec == Obj.SectionNames)
return false;
return !IsDWOSection(Sec);
}
-std::unique_ptr<Writer> CreateWriter(const CopyConfig &Config, Object &Obj,
- Buffer &Buf, ElfType OutputElfType) {
+static std::unique_ptr<Writer> CreateWriter(const CopyConfig &Config,
+ Object &Obj, Buffer &Buf,
+ ElfType OutputElfType) {
if (Config.OutputFormat == "binary") {
return llvm::make_unique<BinaryWriter>(Obj, Buf);
}
llvm_unreachable("Invalid output format");
}
-void SplitDWOToFile(const CopyConfig &Config, const Reader &Reader,
- StringRef File, ElfType OutputElfType) {
+static void SplitDWOToFile(const CopyConfig &Config, const Reader &Reader,
+ StringRef File, ElfType OutputElfType) {
auto DWOFile = Reader.create();
DWOFile->removeSections(
[&](const SectionBase &Sec) { return OnlyKeepDWOPred(*DWOFile, Sec); });
// any previous removals. Lastly whether or not something is removed shouldn't
// depend a) on the order the options occur in or b) on some opaque priority
// system. The only priority is that keeps/copies overrule removes.
-void HandleArgs(const CopyConfig &Config, Object &Obj, const Reader &Reader,
- ElfType OutputElfType) {
+static void HandleArgs(const CopyConfig &Config, Object &Obj,
+ const Reader &Reader, ElfType OutputElfType) {
if (!Config.SplitDWO.empty()) {
SplitDWOToFile(Config, Reader, Config.SplitDWO, OutputElfType);
Obj.addSection<GnuDebugLinkSection>(Config.AddGnuDebugLink);
}
-void ExecuteElfObjcopyOnBinary(const CopyConfig &Config, Binary &Binary,
- Buffer &Out) {
+static void ExecuteElfObjcopyOnBinary(const CopyConfig &Config, Binary &Binary,
+ Buffer &Out) {
ELFReader Reader(&Binary);
std::unique_ptr<Object> Obj = Reader.create();
// For regular archives this function simply calls llvm::writeArchive,
// For thin archives it writes the archive file itself as well as its members.
-Error deepWriteArchive(StringRef ArcName, ArrayRef<NewArchiveMember> NewMembers,
- bool WriteSymtab, object::Archive::Kind Kind,
- bool Deterministic, bool Thin) {
+static Error deepWriteArchive(StringRef ArcName,
+ ArrayRef<NewArchiveMember> NewMembers,
+ bool WriteSymtab, object::Archive::Kind Kind,
+ bool Deterministic, bool Thin) {
Error E =
writeArchive(ArcName, NewMembers, WriteSymtab, Kind, Deterministic, Thin);
if (!Thin || E)
return Error::success();
}
-void ExecuteElfObjcopyOnArchive(const CopyConfig &Config, const Archive &Ar) {
+static void ExecuteElfObjcopyOnArchive(const CopyConfig &Config, const Archive &Ar) {
std::vector<NewArchiveMember> NewArchiveMembers;
Error Err = Error::success();
for (const Archive::Child &Child : Ar.children(Err)) {
reportError(Config.OutputFilename, std::move(E));
}
-void ExecuteElfObjcopy(const CopyConfig &Config) {
+static void ExecuteElfObjcopy(const CopyConfig &Config) {
Expected<OwningBinary<llvm::object::Binary>> BinaryOrErr =
createBinary(Config.InputFilename);
if (!BinaryOrErr)
// ParseObjcopyOptions returns the config and sets the input arguments. If a
// help flag is set then ParseObjcopyOptions will print the help messege and
// exit.
-CopyConfig ParseObjcopyOptions(ArrayRef<const char *> ArgsArr) {
+static CopyConfig ParseObjcopyOptions(ArrayRef<const char *> ArgsArr) {
ObjcopyOptTable T;
unsigned MissingArgumentIndex, MissingArgumentCount;
llvm::opt::InputArgList InputArgs =
// ParseStripOptions returns the config and sets the input arguments. If a
// help flag is set then ParseStripOptions will print the help messege and
// exit.
-CopyConfig ParseStripOptions(ArrayRef<const char *> ArgsArr) {
+static CopyConfig ParseStripOptions(ArrayRef<const char *> ArgsArr) {
StripOptTable T;
unsigned MissingArgumentIndex, MissingArgumentCount;
llvm::opt::InputArgList InputArgs =