Lines Matching +full:llvm +full:- +full:ranlib
1 //===- Archive.cpp - ar File Format implementation --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
8 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Object/Archive.h"
15 #include "llvm/ADT/SmallString.h"
16 #include "llvm/ADT/Twine.h"
17 #include "llvm/Support/Endian.h"
18 #include "llvm/Support/MemoryBuffer.h"
19 #include "llvm/Support/Path.h"
21 using namespace llvm;
23 using namespace llvm::support::endian;
36 llvm::StringRef::size_type end = in getName()
37 llvm::StringRef(Name, sizeof(Name)).find(EndCond); in getName()
38 if (end == llvm::StringRef::npos) in getName()
42 return llvm::StringRef(Name, end); in getName()
47 if (llvm::StringRef(Size, sizeof(Size)).rtrim(" ").getAsInteger(10, Ret)) in getSize()
123 if (Parent->IsThin) { in getSize()
124 ErrorOr<uint32_t> Size = getHeader()->getSize(); in getSize()
129 return Data.size() - StartOfFile; in getSize()
133 ErrorOr<uint32_t> Size = getHeader()->getSize(); in getRawSize()
140 StringRef Name = getHeader()->getName(); in isThinMember()
141 return Parent->IsThin && Name != "/" && Name != "//"; in isThinMember()
154 Parent->getMemoryBufferRef().getBufferIdentifier()); in getFullName()
173 Parent->ThinBuffers.push_back(std::move(*Buf)); in getBuffer()
174 return Parent->ThinBuffers.back()->getBuffer(); in getBuffer()
186 if (NextLoc == Parent->Data.getBufferEnd()) in getNext()
190 if (NextLoc > Parent->Data.getBufferEnd()) in getNext()
201 const char *a = Parent->Data.getBuffer().data(); in getChildOffset()
203 uint64_t offset = c - a; in getChildOffset()
222 if (offset >= Parent->StringTable.size()) in getName()
224 const char *addr = Parent->StringTable.begin() + offset; in getName()
227 if (Parent->kind() == K_GNU || Parent->kind() == K_MIPS64) { in getName()
229 return StringRef(addr, End - 1); in getName()
239 if (name[name.size() - 1] != '/') { in getName()
244 if (name[name.size() - 1] == '/') in getName()
245 return name.substr(0, name.size() - 1); in getName()
325 StringRef Name = C->getRawName(); in Archive()
353 SymbolTable = *C->getBuffer(); in Archive()
365 ErrorOr<StringRef> NameOrErr = C->getName(); in Archive()
374 SymbolTable = *C->getBuffer(); in Archive()
382 SymbolTable = *C->getBuffer(); in Archive()
390 // MIPS 64-bit ELF archives use a special format of a symbol table. in Archive()
393 // http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf in Archive()
399 SymbolTable = *C->getBuffer(); in Archive()
409 Name = C->getRawName(); in Archive()
416 StringTable = *C->getBuffer(); in Archive()
439 SymbolTable = *C->getBuffer(); in Archive()
450 Name = C->getRawName(); in Archive()
455 StringTable = *C->getBuffer(); in Archive()
490 return Parent->getSymbolTable().begin() + StringIndex; in getName()
494 const char *Buf = Parent->getSymbolTable().begin(); in getMember()
496 if (Parent->kind() == K_MIPS64 || Parent->kind() == K_DARWIN64) in getMember()
501 if (Parent->kind() == K_GNU) { in getMember()
503 } else if (Parent->kind() == K_MIPS64) { in getMember()
505 } else if (Parent->kind() == K_BSD) { in getMember()
506 // The SymbolIndex is an index into the ranlib structs that start at in getMember()
507 // Offsets (the first uint32_t is the number of bytes of the ranlib in getMember()
508 // structs). The ranlib structs are a pair of uint32_t's the first in getMember()
513 } else if (Parent->kind() == K_DARWIN64) { in getMember()
537 --OffsetIndex; in getMember()
545 const char *Loc = Parent->getData().begin() + Offset; in getMember()
555 if (Parent->kind() == K_BSD) { in getNext()
557 // "__.SYMDEF SORTED" member into the string table for the ranlib in getNext()
564 // which is the number of bytes of ranlib structs that follow. The ranlib in getNext()
569 const char *Buf = Parent->getSymbolTable().begin(); in getNext()
573 // don't change the t.StringIndex as we don't want to reference a ranlib in getNext()
581 t.StringIndex -= CurRanStrx; in getNext()
586 t.StringIndex = Parent->getSymbolTable().find('\0', t.StringIndex) + 1; in getNext()
606 // which is the number of bytes of ranlib structs that follow. The ranlib in symbol_begin()
644 uint32_t string_start_offset = buf - getSymbolTable().begin(); in symbol_begin()
675 StringRef SymName = bs->getName(); in findSym()
677 if (auto MemberOrErr = bs->getMember()) in findSym()