Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
Show First 20 Lines • Show All 568 Lines • ▼ Show 20 Lines | static Error handleArgs(const CopyConfig &Config, Object &Obj, | ||||
for (const NewSymbolInfo &SI : Config.SymbolsToAdd) { | for (const NewSymbolInfo &SI : Config.SymbolsToAdd) { | ||||
SectionBase *Sec = Obj.findSection(SI.SectionName); | SectionBase *Sec = Obj.findSection(SI.SectionName); | ||||
uint64_t Value = Sec ? Sec->Addr + SI.Value : SI.Value; | uint64_t Value = Sec ? Sec->Addr + SI.Value : SI.Value; | ||||
Obj.SymbolTable->addSymbol(SI.SymbolName, SI.Bind, SI.Type, Sec, Value, | Obj.SymbolTable->addSymbol(SI.SymbolName, SI.Bind, SI.Type, Sec, Value, | ||||
SI.Visibility, | SI.Visibility, | ||||
Sec ? SYMBOL_SIMPLE_INDEX : SHN_ABS, 0); | Sec ? SYMBOL_SIMPLE_INDEX : SHN_ABS, 0); | ||||
} | } | ||||
if (Config.EntryExpr) | |||||
Obj.Entry = Config.EntryExpr(Obj.Entry); | |||||
return Error::success(); | return Error::success(); | ||||
} | } | ||||
Error executeObjcopyOnRawBinary(const CopyConfig &Config, MemoryBuffer &In, | Error executeObjcopyOnRawBinary(const CopyConfig &Config, MemoryBuffer &In, | ||||
Buffer &Out) { | Buffer &Out) { | ||||
BinaryReader Reader(Config.BinaryArch, &In); | BinaryReader Reader(Config.BinaryArch, &In); | ||||
std::unique_ptr<Object> Obj = Reader.create(); | std::unique_ptr<Object> Obj = Reader.create(); | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |