| author | |
| committer | |
| log | 016a59e3a155894412ccf3d98fe6ac1054243d06 |
| tree | bb71096f2dad14d3389dca10d48302cc55700792 |
| parent | 185cb1327806f073b91218ff2fd6f21d95060c00 |
| signature | Commit is signed but in an unrecognized format. |
33 files changed, 555 insertions(+), 190 deletions(-)
deps/lld/CMakeLists.txt-1| ... | ... | @@ -56,7 +56,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) |
| 56 | 56 | include(HandleLLVMOptions) |
| 57 | 57 | |
| 58 | 58 | if(LLVM_INCLUDE_TESTS) |
| 59 | set(Python_ADDITIONAL_VERSIONS 2.7) | |
| 60 | 59 | include(FindPythonInterp) |
| 61 | 60 | if(NOT PYTHONINTERP_FOUND) |
| 62 | 61 | message(FATAL_ERROR |
deps/lld/COFF/Config.h+1| ... | ... | @@ -189,6 +189,7 @@ struct Configuration { |
| 189 | 189 | // Used for /thinlto-object-suffix-replace: |
| 190 | 190 | std::pair<llvm::StringRef, llvm::StringRef> thinLTOObjectSuffixReplace; |
| 191 | 191 | |
| 192 | uint64_t align = 4096; | |
| 192 | 193 | uint64_t imageBase = -1; |
| 193 | 194 | uint64_t fileAlign = 512; |
| 194 | 195 | uint64_t stackReserve = 1024 * 1024; |
deps/lld/COFF/Driver.cpp+32-8| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | #include "llvm/Option/Option.h" |
| 37 | 37 | #include "llvm/Support/Debug.h" |
| 38 | 38 | #include "llvm/Support/LEB128.h" |
| 39 | #include "llvm/Support/MathExtras.h" | |
| 39 | 40 | #include "llvm/Support/Path.h" |
| 40 | 41 | #include "llvm/Support/Process.h" |
| 41 | 42 | #include "llvm/Support/TarWriter.h" |
| ... | ... | @@ -270,13 +271,12 @@ void LinkerDriver::addArchiveBuffer(MemoryBufferRef mb, StringRef symName, |
| 270 | 271 | } |
| 271 | 272 | |
| 272 | 273 | void LinkerDriver::enqueueArchiveMember(const Archive::Child &c, |
| 273 | StringRef symName, | |
| 274 | const Archive::Symbol &sym, | |
| 274 | 275 | StringRef parentName) { |
| 275 | 276 | |
| 276 | auto reportBufferError = [=](Error &&e, | |
| 277 | StringRef childName) { | |
| 277 | auto reportBufferError = [=](Error &&e, StringRef childName) { | |
| 278 | 278 | fatal("could not get the buffer for the member defining symbol " + |
| 279 | symName + ": " + parentName + "(" + childName + "): " + | |
| 279 | toCOFFString(sym) + ": " + parentName + "(" + childName + "): " + | |
| 280 | 280 | toString(std::move(e))); |
| 281 | 281 | }; |
| 282 | 282 | |
| ... | ... | @@ -287,7 +287,8 @@ void LinkerDriver::enqueueArchiveMember(const Archive::Child &c, |
| 287 | 287 | reportBufferError(mbOrErr.takeError(), check(c.getFullName())); |
| 288 | 288 | MemoryBufferRef mb = mbOrErr.get(); |
| 289 | 289 | enqueueTask([=]() { |
| 290 | driver->addArchiveBuffer(mb, symName, parentName, offsetInArchive); | |
| 290 | driver->addArchiveBuffer(mb, toCOFFString(sym), parentName, | |
| 291 | offsetInArchive); | |
| 291 | 292 | }); |
| 292 | 293 | return; |
| 293 | 294 | } |
| ... | ... | @@ -295,15 +296,16 @@ void LinkerDriver::enqueueArchiveMember(const Archive::Child &c, |
| 295 | 296 | std::string childName = CHECK( |
| 296 | 297 | c.getFullName(), |
| 297 | 298 | "could not get the filename for the member defining symbol " + |
| 298 | symName); | |
| 299 | toCOFFString(sym)); | |
| 299 | 300 | auto future = std::make_shared<std::future<MBErrPair>>( |
| 300 | 301 | createFutureForFile(childName)); |
| 301 | 302 | enqueueTask([=]() { |
| 302 | 303 | auto mbOrErr = future->get(); |
| 303 | 304 | if (mbOrErr.second) |
| 304 | 305 | reportBufferError(errorCodeToError(mbOrErr.second), childName); |
| 305 | driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)), symName, | |
| 306 | parentName, /* OffsetInArchive */ 0); | |
| 306 | driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)), | |
| 307 | toCOFFString(sym), parentName, | |
| 308 | /*OffsetInArchive=*/0); | |
| 307 | 309 | }); |
| 308 | 310 | } |
| 309 | 311 | |
| ... | ... | @@ -1053,6 +1055,12 @@ void LinkerDriver::maybeExportMinGWSymbols(const opt::InputArgList &args) { |
| 1053 | 1055 | }); |
| 1054 | 1056 | } |
| 1055 | 1057 | |
| 1058 | static const char *libcallRoutineNames[] = { | |
| 1059 | #define HANDLE_LIBCALL(code, name) name, | |
| 1060 | #include "llvm/IR/RuntimeLibcalls.def" | |
| 1061 | #undef HANDLE_LIBCALL | |
| 1062 | }; | |
| 1063 | ||
| 1056 | 1064 | void LinkerDriver::link(ArrayRef<const char *> argsArr) { |
| 1057 | 1065 | // Needed for LTO. |
| 1058 | 1066 | InitializeAllTargetInfos(); |
| ... | ... | @@ -1421,6 +1429,13 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { |
| 1421 | 1429 | for (auto *arg : args.filtered(OPT_section)) |
| 1422 | 1430 | parseSection(arg->getValue()); |
| 1423 | 1431 | |
| 1432 | // Handle /align | |
| 1433 | if (auto *arg = args.getLastArg(OPT_align)) { | |
| 1434 | parseNumbers(arg->getValue(), &config->align); | |
| 1435 | if (!isPowerOf2_64(config->align)) | |
| 1436 | error("/align: not a power of two: " + StringRef(arg->getValue())); | |
| 1437 | } | |
| 1438 | ||
| 1424 | 1439 | // Handle /aligncomm |
| 1425 | 1440 | for (auto *arg : args.filtered(OPT_aligncomm)) |
| 1426 | 1441 | parseAligncomm(arg->getValue()); |
| ... | ... | @@ -1748,6 +1763,15 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { |
| 1748 | 1763 | u->weakAlias = symtab->addUndefined(to); |
| 1749 | 1764 | } |
| 1750 | 1765 | |
| 1766 | // If any inputs are bitcode files, the LTO code generator may create | |
| 1767 | // references to library functions that are not explicit in the bitcode | |
| 1768 | // file's symbol table. If any of those library functions are defined in a | |
| 1769 | // bitcode file in an archive member, we need to arrange to use LTO to | |
| 1770 | // compile those archive members by adding them to the link beforehand. | |
| 1771 | if (!BitcodeFile::instances.empty()) | |
| 1772 | for (const char *s : libcallRoutineNames) | |
| 1773 | symtab->addLibcall(s); | |
| 1774 | ||
| 1751 | 1775 | // Windows specific -- if __load_config_used can be resolved, resolve it. |
| 1752 | 1776 | if (symtab->findUnderscore("_load_config_used")) |
| 1753 | 1777 | addUndefined(mangle("_load_config_used")); |
deps/lld/COFF/Driver.h+1-1| ... | ... | @@ -72,7 +72,7 @@ public: |
| 72 | 72 | void parseDirectives(InputFile *file); |
| 73 | 73 | |
| 74 | 74 | // Used by ArchiveFile to enqueue members. |
| 75 | void enqueueArchiveMember(const Archive::Child &c, StringRef symName, | |
| 75 | void enqueueArchiveMember(const Archive::Child &c, const Archive::Symbol &sym, | |
| 76 | 76 | StringRef parentName); |
| 77 | 77 | |
| 78 | 78 | MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> mb); |
deps/lld/COFF/InputFiles.cpp+4-4| ... | ... | @@ -85,16 +85,16 @@ void ArchiveFile::parse() { |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Returns a buffer pointing to a member file containing a given symbol. |
| 88 | void ArchiveFile::addMember(const Archive::Symbol *sym) { | |
| 88 | void ArchiveFile::addMember(const Archive::Symbol &sym) { | |
| 89 | 89 | const Archive::Child &c = |
| 90 | CHECK(sym->getMember(), | |
| 91 | "could not get the member for symbol " + sym->getName()); | |
| 90 | CHECK(sym.getMember(), | |
| 91 | "could not get the member for symbol " + toCOFFString(sym)); | |
| 92 | 92 | |
| 93 | 93 | // Return an empty buffer if we have already returned the same buffer. |
| 94 | 94 | if (!seen.insert(c.getChildOffset()).second) |
| 95 | 95 | return; |
| 96 | 96 | |
| 97 | driver->enqueueArchiveMember(c, sym->getName(), getName()); | |
| 97 | driver->enqueueArchiveMember(c, sym, getName()); | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | std::vector<MemoryBufferRef> getArchiveMembers(Archive *file) { |
deps/lld/COFF/InputFiles.h+1-1| ... | ... | @@ -96,7 +96,7 @@ public: |
| 96 | 96 | // Enqueues an archive member load for the given symbol. If we've already |
| 97 | 97 | // enqueued a load for the same archive member, this function does nothing, |
| 98 | 98 | // which ensures that we don't load the same member more than once. |
| 99 | void addMember(const Archive::Symbol *sym); | |
| 99 | void addMember(const Archive::Symbol &sym); | |
| 100 | 100 | |
| 101 | 101 | private: |
| 102 | 102 | std::unique_ptr<Archive> file; |
deps/lld/COFF/SymbolTable.cpp+16-4| ... | ... | @@ -179,7 +179,7 @@ void SymbolTable::loadMinGWAutomaticImports() { |
| 179 | 179 | log("Loading lazy " + l->getName() + " from " + l->file->getName() + |
| 180 | 180 | " for automatic import"); |
| 181 | 181 | l->pendingArchiveLoad = true; |
| 182 | l->file->addMember(&l->sym); | |
| 182 | l->file->addMember(l->sym); | |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| ... | ... | @@ -363,13 +363,13 @@ Symbol *SymbolTable::addUndefined(StringRef name, InputFile *f, |
| 363 | 363 | if (auto *l = dyn_cast<Lazy>(s)) { |
| 364 | 364 | if (!s->pendingArchiveLoad) { |
| 365 | 365 | s->pendingArchiveLoad = true; |
| 366 | l->file->addMember(&l->sym); | |
| 366 | l->file->addMember(l->sym); | |
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | return s; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | void SymbolTable::addLazy(ArchiveFile *f, const Archive::Symbol sym) { | |
| 372 | void SymbolTable::addLazy(ArchiveFile *f, const Archive::Symbol &sym) { | |
| 373 | 373 | StringRef name = sym.getName(); |
| 374 | 374 | Symbol *s; |
| 375 | 375 | bool wasInserted; |
| ... | ... | @@ -382,7 +382,7 @@ void SymbolTable::addLazy(ArchiveFile *f, const Archive::Symbol sym) { |
| 382 | 382 | if (!u || u->weakAlias || s->pendingArchiveLoad) |
| 383 | 383 | return; |
| 384 | 384 | s->pendingArchiveLoad = true; |
| 385 | f->addMember(&sym); | |
| 385 | f->addMember(sym); | |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | void SymbolTable::reportDuplicate(Symbol *existing, InputFile *newFile) { |
| ... | ... | @@ -505,6 +505,18 @@ Symbol *SymbolTable::addImportThunk(StringRef name, DefinedImportData *id, |
| 505 | 505 | return nullptr; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | void SymbolTable::addLibcall(StringRef name) { | |
| 509 | Symbol *sym = findUnderscore(name); | |
| 510 | if (!sym) | |
| 511 | return; | |
| 512 | ||
| 513 | if (Lazy *l = dyn_cast<Lazy>(sym)) { | |
| 514 | MemoryBufferRef mb = l->getMemberBuffer(); | |
| 515 | if (identify_magic(mb.getBuffer()) == llvm::file_magic::bitcode) | |
| 516 | addUndefined(sym->getName()); | |
| 517 | } | |
| 518 | } | |
| 519 | ||
| 508 | 520 | std::vector<Chunk *> SymbolTable::getChunks() { |
| 509 | 521 | std::vector<Chunk *> res; |
| 510 | 522 | for (ObjFile *file : ObjFile::instances) { |
deps/lld/COFF/SymbolTable.h+2-1| ... | ... | @@ -83,7 +83,7 @@ public: |
| 83 | 83 | Symbol *addAbsolute(StringRef n, uint64_t va); |
| 84 | 84 | |
| 85 | 85 | Symbol *addUndefined(StringRef name, InputFile *f, bool isWeakAlias); |
| 86 | void addLazy(ArchiveFile *f, const Archive::Symbol sym); | |
| 86 | void addLazy(ArchiveFile *f, const Archive::Symbol &sym); | |
| 87 | 87 | Symbol *addAbsolute(StringRef n, COFFSymbolRef s); |
| 88 | 88 | Symbol *addRegular(InputFile *f, StringRef n, |
| 89 | 89 | const llvm::object::coff_symbol_generic *s = nullptr, |
| ... | ... | @@ -97,6 +97,7 @@ public: |
| 97 | 97 | Symbol *addImportData(StringRef n, ImportFile *f); |
| 98 | 98 | Symbol *addImportThunk(StringRef name, DefinedImportData *s, |
| 99 | 99 | uint16_t machine); |
| 100 | void addLibcall(StringRef name); | |
| 100 | 101 | |
| 101 | 102 | void reportDuplicate(Symbol *existing, InputFile *newFile); |
| 102 | 103 |
deps/lld/COFF/Symbols.cpp+18-4| ... | ... | @@ -20,18 +20,23 @@ using namespace llvm::object; |
| 20 | 20 | |
| 21 | 21 | using namespace lld::coff; |
| 22 | 22 | |
| 23 | namespace lld { | |
| 24 | ||
| 23 | 25 | static_assert(sizeof(SymbolUnion) <= 48, |
| 24 | 26 | "symbols should be optimized for memory usage"); |
| 25 | 27 | |
| 26 | 28 | // Returns a symbol name for an error message. |
| 27 | std::string lld::toString(coff::Symbol &b) { | |
| 29 | static std::string demangle(StringRef symName) { | |
| 28 | 30 | if (config->demangle) |
| 29 | if (Optional<std::string> s = lld::demangleMSVC(b.getName())) | |
| 31 | if (Optional<std::string> s = demangleMSVC(symName)) | |
| 30 | 32 | return *s; |
| 31 | return b.getName(); | |
| 33 | return symName; | |
| 34 | } | |
| 35 | std::string toString(coff::Symbol &b) { return demangle(b.getName()); } | |
| 36 | std::string toCOFFString(const Archive::Symbol &b) { | |
| 37 | return demangle(b.getName()); | |
| 32 | 38 | } |
| 33 | 39 | |
| 34 | namespace lld { | |
| 35 | 40 | namespace coff { |
| 36 | 41 | |
| 37 | 42 | StringRef Symbol::getName() { |
| ... | ... | @@ -113,5 +118,14 @@ Defined *Undefined::getWeakAlias() { |
| 113 | 118 | return d; |
| 114 | 119 | return nullptr; |
| 115 | 120 | } |
| 121 | ||
| 122 | MemoryBufferRef Lazy::getMemberBuffer() { | |
| 123 | Archive::Child c = | |
| 124 | CHECK(sym.getMember(), | |
| 125 | "could not get the member for symbol " + toCOFFString(sym)); | |
| 126 | return CHECK(c.getMemoryBufferRef(), | |
| 127 | "could not get the buffer for the member defining symbol " + | |
| 128 | toCOFFString(sym)); | |
| 129 | } | |
| 116 | 130 | } // namespace coff |
| 117 | 131 | } // namespace lld |
deps/lld/COFF/Symbols.h+10-1| ... | ... | @@ -21,6 +21,14 @@ |
| 21 | 21 | #include <vector> |
| 22 | 22 | |
| 23 | 23 | namespace lld { |
| 24 | ||
| 25 | std::string toString(coff::Symbol &b); | |
| 26 | ||
| 27 | // There are two different ways to convert an Archive::Symbol to a string: | |
| 28 | // One for Microsoft name mangling and one for Itanium name mangling. | |
| 29 | // Call the functions toCOFFString and toELFString, not just toString. | |
| 30 | std::string toCOFFString(const coff::Archive::Symbol &b); | |
| 31 | ||
| 24 | 32 | namespace coff { |
| 25 | 33 | |
| 26 | 34 | using llvm::object::Archive; |
| ... | ... | @@ -257,6 +265,8 @@ public: |
| 257 | 265 | |
| 258 | 266 | static bool classof(const Symbol *s) { return s->kind() == LazyKind; } |
| 259 | 267 | |
| 268 | MemoryBufferRef getMemberBuffer(); | |
| 269 | ||
| 260 | 270 | ArchiveFile *file; |
| 261 | 271 | |
| 262 | 272 | private: |
| ... | ... | @@ -429,7 +439,6 @@ void replaceSymbol(Symbol *s, ArgT &&... arg) { |
| 429 | 439 | } |
| 430 | 440 | } // namespace coff |
| 431 | 441 | |
| 432 | std::string toString(coff::Symbol &b); | |
| 433 | 442 | } // namespace lld |
| 434 | 443 | |
| 435 | 444 | #endif |
deps/lld/COFF/Writer.cpp+9-4| ... | ... | @@ -626,6 +626,9 @@ void Writer::run() { |
| 626 | 626 | |
| 627 | 627 | writeMapFile(outputSections); |
| 628 | 628 | |
| 629 | if (errorCount()) | |
| 630 | return; | |
| 631 | ||
| 629 | 632 | ScopedTimer t2(diskCommitTimer); |
| 630 | 633 | if (auto e = buffer->commit()) |
| 631 | 634 | fatal("failed to write the output file: " + toString(std::move(e))); |
| ... | ... | @@ -1205,9 +1208,11 @@ void Writer::assignAddresses() { |
| 1205 | 1208 | sizeOfHeaders += |
| 1206 | 1209 | config->is64() ? sizeof(pe32plus_header) : sizeof(pe32_header); |
| 1207 | 1210 | sizeOfHeaders = alignTo(sizeOfHeaders, config->fileAlign); |
| 1208 | uint64_t rva = pageSize; // The first page is kept unmapped. | |
| 1209 | 1211 | fileSize = sizeOfHeaders; |
| 1210 | 1212 | |
| 1213 | // The first page is kept unmapped. | |
| 1214 | uint64_t rva = alignTo(sizeOfHeaders, config->align); | |
| 1215 | ||
| 1211 | 1216 | for (OutputSection *sec : outputSections) { |
| 1212 | 1217 | if (sec == relocSec) |
| 1213 | 1218 | addBaserels(); |
| ... | ... | @@ -1237,10 +1242,10 @@ void Writer::assignAddresses() { |
| 1237 | 1242 | sec->header.SizeOfRawData = rawSize; |
| 1238 | 1243 | if (rawSize != 0) |
| 1239 | 1244 | sec->header.PointerToRawData = fileSize; |
| 1240 | rva += alignTo(virtualSize, pageSize); | |
| 1245 | rva += alignTo(virtualSize, config->align); | |
| 1241 | 1246 | fileSize += alignTo(rawSize, config->fileAlign); |
| 1242 | 1247 | } |
| 1243 | sizeOfImage = alignTo(rva, pageSize); | |
| 1248 | sizeOfImage = alignTo(rva, config->align); | |
| 1244 | 1249 | |
| 1245 | 1250 | // Assign addresses to sections in MergeChunks. |
| 1246 | 1251 | for (MergeChunk *mc : MergeChunk::instances) |
| ... | ... | @@ -1309,7 +1314,7 @@ template <typename PEHeaderTy> void Writer::writeHeader() { |
| 1309 | 1314 | pe->MinorLinkerVersion = 0; |
| 1310 | 1315 | |
| 1311 | 1316 | pe->ImageBase = config->imageBase; |
| 1312 | pe->SectionAlignment = pageSize; | |
| 1317 | pe->SectionAlignment = config->align; | |
| 1313 | 1318 | pe->FileAlignment = config->fileAlign; |
| 1314 | 1319 | pe->MajorImageVersion = config->majorImageVersion; |
| 1315 | 1320 | pe->MinorImageVersion = config->minorImageVersion; |
deps/lld/ELF/Arch/PPC.cpp+11-2| ... | ... | @@ -190,6 +190,13 @@ bool PPC::inBranchRange(RelType type, uint64_t src, uint64_t dst) const { |
| 190 | 190 | RelExpr PPC::getRelExpr(RelType type, const Symbol &s, |
| 191 | 191 | const uint8_t *loc) const { |
| 192 | 192 | switch (type) { |
| 193 | case R_PPC_NONE: | |
| 194 | return R_NONE; | |
| 195 | case R_PPC_ADDR16_HA: | |
| 196 | case R_PPC_ADDR16_HI: | |
| 197 | case R_PPC_ADDR16_LO: | |
| 198 | case R_PPC_ADDR32: | |
| 199 | return R_ABS; | |
| 193 | 200 | case R_PPC_DTPREL16: |
| 194 | 201 | case R_PPC_DTPREL16_HA: |
| 195 | 202 | case R_PPC_DTPREL16_HI: |
| ... | ... | @@ -227,7 +234,9 @@ RelExpr PPC::getRelExpr(RelType type, const Symbol &s, |
| 227 | 234 | case R_PPC_TPREL16_HI: |
| 228 | 235 | return R_TLS; |
| 229 | 236 | default: |
| 230 | return R_ABS; | |
| 237 | error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) + | |
| 238 | ") against symbol " + toString(s)); | |
| 239 | return R_NONE; | |
| 231 | 240 | } |
| 232 | 241 | } |
| 233 | 242 | |
| ... | ... | @@ -319,7 +328,7 @@ void PPC::relocateOne(uint8_t *loc, RelType type, uint64_t val) const { |
| 319 | 328 | break; |
| 320 | 329 | } |
| 321 | 330 | default: |
| 322 | error(getErrorLocation(loc) + "unrecognized relocation " + toString(type)); | |
| 331 | llvm_unreachable("unknown relocation"); | |
| 323 | 332 | } |
| 324 | 333 | } |
| 325 | 334 |
deps/lld/ELF/Arch/PPC64.cpp+20-2| ... | ... | @@ -532,6 +532,21 @@ void PPC64::relaxTlsIeToLe(uint8_t *loc, RelType type, uint64_t val) const { |
| 532 | 532 | RelExpr PPC64::getRelExpr(RelType type, const Symbol &s, |
| 533 | 533 | const uint8_t *loc) const { |
| 534 | 534 | switch (type) { |
| 535 | case R_PPC64_NONE: | |
| 536 | return R_NONE; | |
| 537 | case R_PPC64_ADDR16: | |
| 538 | case R_PPC64_ADDR16_DS: | |
| 539 | case R_PPC64_ADDR16_HA: | |
| 540 | case R_PPC64_ADDR16_HI: | |
| 541 | case R_PPC64_ADDR16_HIGHER: | |
| 542 | case R_PPC64_ADDR16_HIGHERA: | |
| 543 | case R_PPC64_ADDR16_HIGHEST: | |
| 544 | case R_PPC64_ADDR16_HIGHESTA: | |
| 545 | case R_PPC64_ADDR16_LO: | |
| 546 | case R_PPC64_ADDR16_LO_DS: | |
| 547 | case R_PPC64_ADDR32: | |
| 548 | case R_PPC64_ADDR64: | |
| 549 | return R_ABS; | |
| 535 | 550 | case R_PPC64_GOT16: |
| 536 | 551 | case R_PPC64_GOT16_DS: |
| 537 | 552 | case R_PPC64_GOT16_HA: |
| ... | ... | @@ -554,6 +569,7 @@ RelExpr PPC64::getRelExpr(RelType type, const Symbol &s, |
| 554 | 569 | return R_PPC64_CALL_PLT; |
| 555 | 570 | case R_PPC64_REL16_LO: |
| 556 | 571 | case R_PPC64_REL16_HA: |
| 572 | case R_PPC64_REL16_HI: | |
| 557 | 573 | case R_PPC64_REL32: |
| 558 | 574 | case R_PPC64_REL64: |
| 559 | 575 | return R_PC; |
| ... | ... | @@ -607,7 +623,9 @@ RelExpr PPC64::getRelExpr(RelType type, const Symbol &s, |
| 607 | 623 | case R_PPC64_TLS: |
| 608 | 624 | return R_TLSIE_HINT; |
| 609 | 625 | default: |
| 610 | return R_ABS; | |
| 626 | error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) + | |
| 627 | ") against symbol " + toString(s)); | |
| 628 | return R_NONE; | |
| 611 | 629 | } |
| 612 | 630 | } |
| 613 | 631 | |
| ... | ... | @@ -870,7 +888,7 @@ void PPC64::relocateOne(uint8_t *loc, RelType type, uint64_t val) const { |
| 870 | 888 | write64(loc, val - dynamicThreadPointerOffset); |
| 871 | 889 | break; |
| 872 | 890 | default: |
| 873 | error(getErrorLocation(loc) + "unrecognized relocation " + toString(type)); | |
| 891 | llvm_unreachable("unknown relocation"); | |
| 874 | 892 | } |
| 875 | 893 | } |
| 876 | 894 |
deps/lld/ELF/InputFiles.cpp+2-2| ... | ... | @@ -1144,7 +1144,7 @@ void ArchiveFile::fetch(const Archive::Symbol &sym) { |
| 1144 | 1144 | Archive::Child c = |
| 1145 | 1145 | CHECK(sym.getMember(), toString(this) + |
| 1146 | 1146 | ": could not get the member for symbol " + |
| 1147 | sym.getName()); | |
| 1147 | toELFString(sym)); | |
| 1148 | 1148 | |
| 1149 | 1149 | if (!seen.insert(c.getChildOffset()).second) |
| 1150 | 1150 | return; |
| ... | ... | @@ -1153,7 +1153,7 @@ void ArchiveFile::fetch(const Archive::Symbol &sym) { |
| 1153 | 1153 | CHECK(c.getMemoryBufferRef(), |
| 1154 | 1154 | toString(this) + |
| 1155 | 1155 | ": could not get the buffer for the member defining symbol " + |
| 1156 | sym.getName()); | |
| 1156 | toELFString(sym)); | |
| 1157 | 1157 | |
| 1158 | 1158 | if (tar && c.getParent()->isThin()) |
| 1159 | 1159 | tar->append(relativeToRoot(CHECK(c.getFullName(), this)), mb.getBuffer()); |
deps/lld/ELF/Symbols.cpp+18-11| ... | ... | @@ -42,6 +42,20 @@ Defined *ElfSym::relaIpltEnd; |
| 42 | 42 | Defined *ElfSym::riscvGlobalPointer; |
| 43 | 43 | Defined *ElfSym::tlsModuleBase; |
| 44 | 44 | |
| 45 | // Returns a symbol for an error message. | |
| 46 | static std::string demangle(StringRef symName) { | |
| 47 | if (config->demangle) | |
| 48 | if (Optional<std::string> s = demangleItanium(symName)) | |
| 49 | return *s; | |
| 50 | return symName; | |
| 51 | } | |
| 52 | namespace lld { | |
| 53 | std::string toString(const Symbol &b) { return demangle(b.getName()); } | |
| 54 | std::string toELFString(const Archive::Symbol &b) { | |
| 55 | return demangle(b.getName()); | |
| 56 | } | |
| 57 | } // namespace lld | |
| 58 | ||
| 45 | 59 | static uint64_t getSymVA(const Symbol &sym, int64_t &addend) { |
| 46 | 60 | switch (sym.kind()) { |
| 47 | 61 | case Symbol::DefinedKind: { |
| ... | ... | @@ -250,12 +264,13 @@ void Symbol::fetch() const { |
| 250 | 264 | } |
| 251 | 265 | |
| 252 | 266 | MemoryBufferRef LazyArchive::getMemberBuffer() { |
| 253 | Archive::Child c = CHECK( | |
| 254 | sym.getMember(), "could not get the member for symbol " + sym.getName()); | |
| 267 | Archive::Child c = | |
| 268 | CHECK(sym.getMember(), | |
| 269 | "could not get the member for symbol " + toELFString(sym)); | |
| 255 | 270 | |
| 256 | 271 | return CHECK(c.getMemoryBufferRef(), |
| 257 | 272 | "could not get the buffer for the member defining symbol " + |
| 258 | sym.getName()); | |
| 273 | toELFString(sym)); | |
| 259 | 274 | } |
| 260 | 275 | |
| 261 | 276 | uint8_t Symbol::computeBinding() const { |
| ... | ... | @@ -331,14 +346,6 @@ void elf::maybeWarnUnorderableSymbol(const Symbol *sym) { |
| 331 | 346 | report(": unable to order discarded symbol: "); |
| 332 | 347 | } |
| 333 | 348 | |
| 334 | // Returns a symbol for an error message. | |
| 335 | std::string lld::toString(const Symbol &b) { | |
| 336 | if (config->demangle) | |
| 337 | if (Optional<std::string> s = demangleItanium(b.getName())) | |
| 338 | return *s; | |
| 339 | return b.getName(); | |
| 340 | } | |
| 341 | ||
| 342 | 349 | static uint8_t getMinVisibility(uint8_t va, uint8_t vb) { |
| 343 | 350 | if (va == STV_DEFAULT) |
| 344 | 351 | return vb; |
deps/lld/ELF/Symbols.h+5-1| ... | ... | @@ -33,7 +33,11 @@ class Undefined; |
| 33 | 33 | } // namespace elf |
| 34 | 34 | |
| 35 | 35 | std::string toString(const elf::Symbol &); |
| 36 | std::string toString(const elf::InputFile *); | |
| 36 | ||
| 37 | // There are two different ways to convert an Archive::Symbol to a string: | |
| 38 | // One for Microsoft name mangling and one for Itanium name mangling. | |
| 39 | // Call the functions toCOFFString and toELFString, not just toString. | |
| 40 | std::string toELFString(const elf::Archive::Symbol &); | |
| 37 | 41 | |
| 38 | 42 | namespace elf { |
| 39 | 43 |
deps/lld/ELF/Writer.cpp+14-12| ... | ... | @@ -2230,25 +2230,27 @@ template <class ELFT> void Writer<ELFT>::fixSectionAlignments() { |
| 2230 | 2230 | // same with its virtual address modulo the page size, so that the loader can |
| 2231 | 2231 | // load executables without any address adjustment. |
| 2232 | 2232 | static uint64_t computeFileOffset(OutputSection *os, uint64_t off) { |
| 2233 | // File offsets are not significant for .bss sections. By convention, we keep | |
| 2234 | // section offsets monotonically increasing rather than setting to zero. | |
| 2235 | if (os->type == SHT_NOBITS) | |
| 2236 | return off; | |
| 2237 | ||
| 2238 | // If the section is not in a PT_LOAD, we just have to align it. | |
| 2239 | if (!os->ptLoad) | |
| 2240 | return alignTo(off, os->alignment); | |
| 2241 | ||
| 2242 | 2233 | // The first section in a PT_LOAD has to have congruent offset and address |
| 2243 | 2234 | // module the page size. |
| 2244 | OutputSection *first = os->ptLoad->firstSec; | |
| 2245 | if (os == first) { | |
| 2246 | uint64_t alignment = std::max<uint64_t>(os->alignment, config->maxPageSize); | |
| 2235 | if (os->ptLoad && os->ptLoad->firstSec == os) { | |
| 2236 | uint64_t alignment = | |
| 2237 | std::max<uint64_t>(os->ptLoad->p_align, config->maxPageSize); | |
| 2247 | 2238 | return alignTo(off, alignment, os->addr); |
| 2248 | 2239 | } |
| 2249 | 2240 | |
| 2241 | // File offsets are not significant for .bss sections other than the first one | |
| 2242 | // in a PT_LOAD. By convention, we keep section offsets monotonically | |
| 2243 | // increasing rather than setting to zero. | |
| 2244 | if (os->type == SHT_NOBITS) | |
| 2245 | return off; | |
| 2246 | ||
| 2247 | // If the section is not in a PT_LOAD, we just have to align it. | |
| 2248 | if (!os->ptLoad) | |
| 2249 | return alignTo(off, os->alignment); | |
| 2250 | ||
| 2250 | 2251 | // If two sections share the same PT_LOAD the file offset is calculated |
| 2251 | 2252 | // using this formula: Off2 = Off1 + (VA2 - VA1). |
| 2253 | OutputSection *first = os->ptLoad->firstSec; | |
| 2252 | 2254 | return first->offset + os->addr - first->addr; |
| 2253 | 2255 | } |
| 2254 | 2256 |
deps/lld/docs/ReleaseNotes.rst+165-35| ... | ... | @@ -5,18 +5,15 @@ lld 9.0.0 Release Notes |
| 5 | 5 | .. contents:: |
| 6 | 6 | :local: |
| 7 | 7 | |
| 8 | .. warning:: | |
| 9 | These are in-progress notes for the upcoming LLVM 9.0.0 release. | |
| 10 | Release notes for previous releases can be found on | |
| 11 | `the Download Page <https://releases.llvm.org/download.html>`_. | |
| 12 | ||
| 13 | 8 | Introduction |
| 14 | 9 | ============ |
| 15 | 10 | |
| 16 | This document contains the release notes for the lld linker, release 9.0.0. | |
| 17 | Here we describe the status of lld, including major improvements | |
| 18 | from the previous release. All lld releases may be downloaded | |
| 19 | from the `LLVM releases web site <https://llvm.org/releases/>`_. | |
| 11 | lld is a high-performance linker that supports ELF (Unix), COFF | |
| 12 | (Windows), Mach-O (macOS), MinGW and WebAssembly. lld is | |
| 13 | command-line-compatible with GNU linkers and Microsoft link.exe and is | |
| 14 | significantly faster than the system default linkers. | |
| 15 | ||
| 16 | lld 9 has lots of feature improvements and bug fixes. | |
| 20 | 17 | |
| 21 | 18 | Non-comprehensive list of changes in this release |
| 22 | 19 | ================================================= |
| ... | ... | @@ -27,50 +24,187 @@ ELF Improvements |
| 27 | 24 | * ld.lld now has typo suggestions for flags: |
| 28 | 25 | ``$ ld.lld --call-shared`` now prints |
| 29 | 26 | ``unknown argument '--call-shared', did you mean '--call_shared'``. |
| 27 | (`r361518 <https://reviews.llvm.org/rL361518>`_) | |
| 28 | ||
| 29 | * ``--allow-shlib-undefined`` and ``--no-allow-shlib-undefined`` | |
| 30 | options are added. ``--no-allow-shlib-undefined`` is the default for | |
| 31 | executables. | |
| 32 | (`r352826 <https://reviews.llvm.org/rL352826>`_) | |
| 33 | ||
| 34 | * ``-nmagic`` and ``-omagic`` options are fully supported. | |
| 35 | (`r360593 <https://reviews.llvm.org/rL360593>`_) | |
| 36 | ||
| 37 | * Segment layout has changed. PT_GNU_RELRO, which was previously | |
| 38 | placed in the middle of readable/writable PT_LOAD segments, is now | |
| 39 | placed at the beginning of them. This change permits lld-produced | |
| 40 | ELF files to be read correctly by GNU strip older than 2.31, which | |
| 41 | has a bug to discard a PT_GNU_RELRO in the former layout. | |
| 42 | ||
| 43 | * ``-z common-page-size`` is supported. | |
| 44 | (`r360593 <https://reviews.llvm.org/rL360593>`_) | |
| 45 | ||
| 46 | * Diagnostics messages have improved. A new flag ``--vs-diagnostics`` | |
| 47 | alters the format of diagnostic output to enable source hyperlinks | |
| 48 | in Microsoft Visual Studio IDE. | |
| 49 | ||
| 50 | * Linker script compatibility with GNU BFD linker has generally improved. | |
| 51 | ||
| 52 | * The clang ``--dependent-library`` form of autolinking is supported. | |
| 53 | ||
| 54 | This feature is added to implement the Windows-style autolinking for | |
| 55 | Unix. On Unix, in order to use a library, you usually have to | |
| 56 | include a header file provided by the library and then explicitly | |
| 57 | link the library with the linker ``-l`` option. On Windows, header | |
| 58 | files usually contain pragmas that list needed libraries. Compilers | |
| 59 | copy that information to object files, so that linkers can | |
| 60 | automatically link needed libraries. ``--dependent-library`` is | |
| 61 | added for implementing that Windows semantics on Unix. | |
| 62 | (`r360984 <https://reviews.llvm.org/rL360984>`_) | |
| 63 | ||
| 64 | * AArch64 BTI and PAC are supported. | |
| 65 | (`r362793 <https://reviews.llvm.org/rL362793>`_) | |
| 30 | 66 | |
| 31 | 67 | * lld now supports replacing ``JAL`` with ``JALX`` instructions in case |
| 32 | of MIPS - microMIPS cross-mode jumps. | |
| 68 | of MIPS-microMIPS cross-mode jumps. | |
| 69 | (`r354311 <https://reviews.llvm.org/rL354311>`_) | |
| 33 | 70 | |
| 34 | 71 | * lld now creates LA25 thunks for MIPS R6 code. |
| 72 | (`r354312 <https://reviews.llvm.org/rL354312>`_) | |
| 35 | 73 | |
| 36 | 74 | * Put MIPS-specific .reginfo, .MIPS.options, and .MIPS.abiflags sections |
| 37 | 75 | into corresponding PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS |
| 38 | 76 | segments. |
| 39 | 77 | |
| 40 | * ... | |
| 78 | * The quality of RISC-V and PowerPC ports have greatly improved. Many | |
| 79 | applications can now be linked by lld. PowerPC64 is now almost | |
| 80 | production ready. | |
| 81 | ||
| 82 | * The Linux kernel for arm32_7, arm64, ppc64le and x86_64 can now be | |
| 83 | linked by lld. | |
| 84 | ||
| 85 | * x86-64 TLSDESC is supported. | |
| 86 | (`r361911 <https://reviews.llvm.org/rL361911>`_, | |
| 87 | `r362078 <https://reviews.llvm.org/rL362078>`_) | |
| 88 | ||
| 89 | * DF_STATIC_TLS flag is set for i386 and x86-64 when needed. | |
| 90 | (`r353293 <https://reviews.llvm.org/rL353293>`_, | |
| 91 | `r353378 <https://reviews.llvm.org/rL353378>`_) | |
| 92 | ||
| 93 | * The experimental partitioning feature is added to allow a program to | |
| 94 | be split into multiple pieces. | |
| 95 | ||
| 96 | The feature allows you to semi-automatically split a single program | |
| 97 | into multiple ELF files called "partitions". Since all partitions | |
| 98 | share the same memory address space and don't use PLT/GOT, split | |
| 99 | programs run as fast as regular programs. | |
| 100 | ||
| 101 | With the mechanism, you can start a program only with a "main" | |
| 102 | partition and load remaining partitions on-demand. For example, you | |
| 103 | can split a web browser into a main partition and a PDF reader | |
| 104 | sub-partition and load the PDF reader partition only when a user | |
| 105 | tries to open a PDF file. | |
| 106 | ||
| 107 | See `the documentation <Partitions.html>`_ for more information. | |
| 108 | ||
| 109 | * If "-" is given as an output filename, lld writes the final result | |
| 110 | to the standard output. Previously, it created a file "-" in the | |
| 111 | current directory. | |
| 112 | (`r351852 <https://reviews.llvm.org/rL351852>`_) | |
| 113 | ||
| 114 | * ``-z ifunc-noplt`` option is added to reduce IFunc function call | |
| 115 | overhead in a freestanding environment such as the OS kernel. | |
| 116 | ||
| 117 | Functions resolved by the IFunc mechanism are usually dispatched via | |
| 118 | PLT and thus slower than regular functions because of the cost of | |
| 119 | indirection. With ``-z ifunc-noplt``, you can eliminate it by doing | |
| 120 | text relocations at load-time. You need a special loader to utilize | |
| 121 | this feature. This feature is added for the FreeBSD kernel but can | |
| 122 | be used by any operating systems. | |
| 123 | (`r360685 <https://reviews.llvm.org/rL360685>`_) | |
| 124 | ||
| 125 | * ``--undefined-glob`` option is added. The new option is an extension | |
| 126 | to ``--undefined`` to take a glob pattern instead of a single symbol | |
| 127 | name. | |
| 128 | (`r363396 <https://reviews.llvm.org/rL363396>`_) | |
| 129 | ||
| 41 | 130 | |
| 42 | 131 | COFF Improvements |
| 43 | 132 | ----------------- |
| 44 | 133 | |
| 45 | 134 | * Like the ELF driver, lld-link now has typo suggestions for flags. |
| 135 | (`r361518 <https://reviews.llvm.org/rL361518>`_) | |
| 46 | 136 | |
| 47 | * lld-link now correctly reports duplicate symbol errors for obj files | |
| 48 | that were compiled with /Gy. | |
| 137 | * lld-link now correctly reports duplicate symbol errors for object | |
| 138 | files that were compiled with ``/Gy``. | |
| 139 | (`r352590 <https://reviews.llvm.org/rL352590>`_) | |
| 49 | 140 | |
| 50 | * lld-link now correctly reports duplicate symbol errors when several res | |
| 51 | input files define resources with the same type, name, and language. | |
| 52 | This can be demoted to a warning using ``/force:multipleres``. | |
| 141 | * lld-link now correctly reports duplicate symbol errors when several | |
| 142 | resource (.res) input files define resources with the same type, | |
| 143 | name and language. This can be demoted to a warning using | |
| 144 | ``/force:multipleres``. | |
| 145 | (`r359829 <https://reviews.llvm.org/rL359829>`_) | |
| 146 | ||
| 147 | * lld-link now rejects more than one resource object input files, | |
| 148 | matching link.exe. Previously, lld-link would silently ignore all | |
| 149 | but one. If you hit this: Don't pass resource object files to the | |
| 150 | linker, instead pass res files to the linker directly. Don't put | |
| 151 | resource files in static libraries, pass them on the command line. | |
| 152 | (`r359749 <https://reviews.llvm.org/rL359749>`_) | |
| 53 | 153 | |
| 54 | 154 | * Having more than two ``/natvis:`` now works correctly; it used to not |
| 55 | 155 | work for larger binaries before. |
| 156 | (`r327895 <https://reviews.llvm.org/rL327895>`_) | |
| 56 | 157 | |
| 57 | 158 | * Undefined symbols are now printed only in demangled form. Pass |
| 58 | 159 | ``/demangle:no`` to see raw symbol names instead. |
| 59 | ||
| 60 | * The following flags have been added: ``/functionpadmin``, ``/swaprun:``, | |
| 61 | ``/threads:no`` | |
| 160 | (`r355878 <https://reviews.llvm.org/rL355878>`_) | |
| 62 | 161 | |
| 63 | 162 | * Several speed and memory usage improvements. |
| 64 | 163 | |
| 65 | * Range extension thunks are now created for ARM64, if needed | |
| 66 | ||
| 67 | 164 | * lld-link now supports resource object files created by GNU windres and |
| 68 | MS cvtres, not only llvm-cvtres | |
| 165 | MS cvtres, not only llvm-cvtres. | |
| 69 | 166 | |
| 70 | 167 | * The generated thunks for delayimports now share the majority of code |
| 71 | among thunks, significantly reducing the overhead of using delayimport | |
| 168 | among thunks, significantly reducing the overhead of using delayimport. | |
| 169 | (`r365823 <https://reviews.llvm.org/rL365823>`_) | |
| 170 | ||
| 171 | * ``IMAGE_REL_ARM{,64}_REL32`` relocations are supported. | |
| 172 | (`r352325 <https://reviews.llvm.org/rL352325>`_) | |
| 173 | ||
| 174 | * Range extension thunks for AArch64 are now supported, so lld can | |
| 175 | create large executables for Windows/ARM64. | |
| 176 | (`r352929 <https://reviews.llvm.org/rL352929>`_) | |
| 177 | ||
| 178 | * The following flags have been added: | |
| 179 | ``/functionpadmin`` (`r354716 <https://reviews.llvm.org/rL354716>`_), | |
| 180 | ``/swaprun:`` (`r359192 <https://reviews.llvm.org/rL359192>`_), | |
| 181 | ``/threads:no`` (`r355029 <https://reviews.llvm.org/rL355029>`_), | |
| 182 | ``/filealign`` (`r361634 <https://reviews.llvm.org/rL361634>`_) | |
| 183 | ||
| 184 | WebAssembly Improvements | |
| 185 | ------------------------ | |
| 186 | ||
| 187 | * Imports from custom module names are supported. | |
| 188 | (`r352828 <https://reviews.llvm.org/rL352828>`_) | |
| 189 | ||
| 190 | * Symbols that are in llvm.used are now exported by default. | |
| 191 | (`r353364 <https://reviews.llvm.org/rL353364>`_) | |
| 192 | ||
| 193 | * Initial support for PIC and dynamic linking has landed. | |
| 194 | (`r357022 <https://reviews.llvm.org/rL357022>`_) | |
| 195 | ||
| 196 | * wasm-ld now add ``__start_``/``__stop_`` symbols for data sections. | |
| 197 | (`r361236 <https://reviews.llvm.org/rL361236>`_) | |
| 198 | ||
| 199 | * wasm-ld now doesn't report an error on archives without a symbol index. | |
| 200 | (`r364338 <https://reviews.llvm.org/rL364338>`_) | |
| 201 | ||
| 202 | * The following flags have been added: | |
| 203 | ``--emit-relocs`` (`r361635 <https://reviews.llvm.org/rL361635>`_), | |
| 204 | ``--wrap`` (`r361639 <https://reviews.llvm.org/rL361639>`_), | |
| 205 | ``--trace`` and ``--trace-symbol`` | |
| 206 | (`r353264 <https://reviews.llvm.org/rL353264>`_). | |
| 72 | 207 | |
| 73 | * ... | |
| 74 | 208 | |
| 75 | 209 | MinGW Improvements |
| 76 | 210 | ------------------ |
| ... | ... | @@ -80,22 +214,18 @@ MinGW Improvements |
| 80 | 214 | DWARF exception handling with libgcc and gcc's crtend.o. |
| 81 | 215 | |
| 82 | 216 | * lld now also handles DWARF unwind info generated by GCC, when linking |
| 83 | with libgcc | |
| 84 | ||
| 85 | * Many more GNU ld options are now supported, which e.g. allows the lld | |
| 86 | MinGW frontend to be called by GCC | |
| 217 | with libgcc. | |
| 87 | 218 | |
| 88 | 219 | * PDB output can be requested without manually specifying the PDB file |
| 89 | 220 | name, with the new option ``-pdb=`` with an empty value to the option. |
| 90 | 221 | (The old existing syntax ``-pdb <filename>`` was more cumbersome to use |
| 91 | 222 | with an empty parameter value.) |
| 92 | 223 | |
| 93 | MachO Improvements | |
| 94 | ------------------ | |
| 95 | ||
| 96 | * Item 1. | |
| 224 | * ``--no-insert-timestamp`` option is added as an alias to ``/timestamp:0``. | |
| 225 | (`r353145 <https://reviews.llvm.org/rL353145>`_) | |
| 97 | 226 | |
| 98 | WebAssembly Improvements | |
| 99 | ------------------------ | |
| 227 | * Many more GNU ld options are now supported, which e.g. allows the lld | |
| 228 | MinGW frontend to be called by GCC. | |
| 100 | 229 | |
| 101 | * ... | |
| 230 | * The following options are added: ``--exclude-all-symbols``, | |
| 231 | ``--appcontainer``, ``--undefined`` |
deps/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp+1| ... | ... | @@ -621,6 +621,7 @@ void ArchHandler_x86_64::applyFixupFinal( |
| 621 | 621 | // Fall into llvm_unreachable(). |
| 622 | 622 | break; |
| 623 | 623 | } |
| 624 | llvm_unreachable("invalid x86_64 Reference Kind"); | |
| 624 | 625 | } |
| 625 | 626 | |
| 626 | 627 | void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref, |
deps/lld/test/COFF/Inputs/libcall-archive.ll created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" | |
| 2 | target triple = "i686-unknown-windows" | |
| 3 | ||
| 4 | define void @memcpy() { | |
| 5 | ret void | |
| 6 | } |
deps/lld/test/COFF/Inputs/libcall-archive.s created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | .globl ___sync_val_compare_and_swap_8 | |
| 2 | ___sync_val_compare_and_swap_8: |
deps/lld/test/COFF/align.s created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | # RUN: yaml2obj < %s > %t.obj | |
| 2 | # RUN: lld-link /out:%t.exe /entry:main /align:32 %t.obj | |
| 3 | # RUN: llvm-readobj --file-headers %t.exe | FileCheck %s | |
| 4 | ||
| 5 | # CHECK: SectionAlignment: 32 | |
| 6 | ||
| 7 | --- !COFF | |
| 8 | header: | |
| 9 | Machine: IMAGE_FILE_MACHINE_AMD64 | |
| 10 | Characteristics: [] | |
| 11 | sections: | |
| 12 | - Name: .text | |
| 13 | Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] | |
| 14 | Alignment: 4096 | |
| 15 | SectionData: 0000000000000000 | |
| 16 | Relocations: | |
| 17 | - VirtualAddress: 0 | |
| 18 | SymbolName: __ImageBase | |
| 19 | Type: IMAGE_REL_AMD64_ADDR64 | |
| 20 | symbols: | |
| 21 | - Name: .text | |
| 22 | Value: 0 | |
| 23 | SectionNumber: 1 | |
| 24 | SimpleType: IMAGE_SYM_TYPE_NULL | |
| 25 | ComplexType: IMAGE_SYM_DTYPE_NULL | |
| 26 | StorageClass: IMAGE_SYM_CLASS_STATIC | |
| 27 | SectionDefinition: | |
| 28 | Length: 8 | |
| 29 | NumberOfRelocations: 1 | |
| 30 | NumberOfLinenumbers: 0 | |
| 31 | CheckSum: 0 | |
| 32 | Number: 0 | |
| 33 | - Name: main | |
| 34 | Value: 0 | |
| 35 | SectionNumber: 1 | |
| 36 | SimpleType: IMAGE_SYM_TYPE_NULL | |
| 37 | ComplexType: IMAGE_SYM_DTYPE_NULL | |
| 38 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | |
| 39 | - Name: __ImageBase | |
| 40 | Value: 0 | |
| 41 | SectionNumber: 0 | |
| 42 | SimpleType: IMAGE_SYM_TYPE_NULL | |
| 43 | ComplexType: IMAGE_SYM_DTYPE_NULL | |
| 44 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | |
| 45 | ... |
deps/lld/test/COFF/libcall-archive.ll created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | ; REQUIRES: x86 | |
| 2 | ; RUN: rm -f %t.a | |
| 3 | ; RUN: llvm-as -o %t.obj %s | |
| 4 | ; RUN: llvm-as -o %t2.obj %S/Inputs/libcall-archive.ll | |
| 5 | ; RUN: llvm-mc -filetype=obj -triple=i686-unknown-windows -o %t3.obj %S/Inputs/libcall-archive.s | |
| 6 | ; RUN: llvm-ar rcs %t.a %t2.obj %t3.obj | |
| 7 | ; RUN: lld-link -out:%t.exe -subsystem:console -entry:start -safeseh:no -lldmap:- %t.obj %t.a | FileCheck %s | |
| 8 | ||
| 9 | ; CHECK-NOT: ___sync_val_compare_and_swap_8 | |
| 10 | ; CHECK: _start | |
| 11 | ; CHECK: _memcpy | |
| 12 | ||
| 13 | target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" | |
| 14 | target triple = "i686-unknown-windows" | |
| 15 | ||
| 16 | define void @start(i8* %a, i8* %b) { | |
| 17 | entry: | |
| 18 | call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 1024, i1 false) | |
| 19 | ret void | |
| 20 | } | |
| 21 | ||
| 22 | declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) |
deps/lld/test/COFF/multiple-resource-objs.test+2| ... | ... | @@ -1,7 +1,9 @@ |
| 1 | 1 | # RUN: llvm-cvtres /out:%t_resource.obj %S/Inputs/resource.res |
| 2 | 2 | # RUN: llvm-cvtres /out:%t_id.obj %S/Inputs/id.res |
| 3 | # RUN: rm -f %t.exe | |
| 3 | 4 | # RUN: not lld-link /out:%t.exe /dll /noentry %t_id.obj %t_resource.obj 2>&1 | \ |
| 4 | 5 | # RUN: FileCheck --check-prefix=TWOOBJ %s |
| 6 | # RUN: not test -f %t.exe | |
| 5 | 7 | |
| 6 | 8 | TWOOBJ: error: {{.*}}_resource.obj: more than one resource obj file not allowed, already got {{.*}}_id.obj |
| 7 | 9 |
deps/lld/test/COFF/thin-archive.s+6-2| ... | ... | @@ -11,14 +11,18 @@ |
| 11 | 11 | # RUN: FileCheck --allow-empty %s |
| 12 | 12 | # RUN: lld-link /entry:main %t.main.obj %t_thin.lib /out:%t.exe 2>&1 | \ |
| 13 | 13 | # RUN: FileCheck --allow-empty %s |
| 14 | # RUN: lld-link /entry:main %t.main.obj /wholearchive:%t_thin.lib /out:%t.exe 2>&1 | \ | |
| 15 | # RUN: FileCheck --allow-empty %s | |
| 16 | 14 | |
| 17 | 15 | # RUN: rm %t.lib.obj |
| 18 | 16 | # RUN: lld-link /entry:main %t.main.obj %t.lib /out:%t.exe 2>&1 | \ |
| 19 | 17 | # RUN: FileCheck --allow-empty %s |
| 18 | # RUN: not lld-link /entry:main %t.main.obj %t_thin.lib /out:%t.exe 2>&1 | \ | |
| 19 | # RUN: FileCheck --check-prefix=NOOBJ %s | |
| 20 | # RUN: not lld-link /entry:main %t.main.obj %t_thin.lib /out:%t.exe \ | |
| 21 | # RUN: /demangle:no 2>&1 | FileCheck --check-prefix=NOOBJNODEMANGLE %s | |
| 20 | 22 | |
| 21 | 23 | # CHECK-NOT: error: could not get the buffer for the member defining |
| 24 | # NOOBJ: error: could not get the buffer for the member defining symbol int __cdecl f(void): {{.*}}.lib({{.*}}.lib.obj): | |
| 25 | # NOOBJNODEMANGLE: error: could not get the buffer for the member defining symbol ?f@@YAHXZ: {{.*}}.lib({{.*}}.lib.obj): | |
| 22 | 26 | |
| 23 | 27 | 	.text |
| 24 | 28 |
deps/lld/test/ELF/archive-thin-missing-member.s+8-6| ... | ... | @@ -8,17 +8,19 @@ |
| 8 | 8 | # RUN: rm %t.o |
| 9 | 9 | |
| 10 | 10 | # Test error when loading symbols from missing thin archive member. |
| 11 | # RUN: not ld.lld %t-no-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR1 | |
| 11 | # RUN: not ld.lld --entry=_Z1fi %t-no-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR1 | |
| 12 | 12 | # ERR1: {{.*}}-no-syms.a: could not get the buffer for a child of the archive: '{{.*}}.o': {{[Nn]}}o such file or directory |
| 13 | 13 | |
| 14 | 14 | # Test error when thin archive has symbol table but member is missing. |
| 15 | # RUN: not ld.lld -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2 | |
| 16 | # ERR2: {{.*}}-syms.a: could not get the buffer for the member defining symbol _start: '{{.*}}.o': {{[Nn]}}o such file or directory | |
| 15 | # RUN: not ld.lld --entry=_Z1fi -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2 | |
| 16 | # ERR2: {{.*}}-syms.a: could not get the buffer for the member defining symbol f(int): '{{.*}}.o': {{[Nn]}}o such file or directory | |
| 17 | # RUN: not ld.lld --entry=_Z1fi --no-demangle -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2MANGLE | |
| 18 | # ERR2MANGLE: {{.*}}-syms.a: could not get the buffer for the member defining symbol _Z1fi: '{{.*}}.o': {{[Nn]}}o such file or directory | |
| 17 | 19 | |
| 18 | 20 | # Test error when thin archive is linked using --whole-archive but member is missing. |
| 19 | # RUN: not ld.lld --whole-archive %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR3 | |
| 21 | # RUN: not ld.lld --entry=_Z1fi --whole-archive %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR3 | |
| 20 | 22 | # ERR3: {{.*}}-syms.a: could not get the buffer for a child of the archive: '{{.*}}.o': {{[Nn]}}o such file or directory |
| 21 | 23 | |
| 22 | .global _start | |
| 23 | _start: | |
| 24 | .global _Z1fi | |
| 25 | _Z1fi: | |
| 24 | 26 | nop |
deps/lld/test/ELF/basic-ppc64.s+6-6| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | // CHECK-NEXT: Version: 1 |
| 36 | 36 | // CHECK-NEXT: Entry: 0x10000 |
| 37 | 37 | // CHECK-NEXT: ProgramHeaderOffset: 0x40 |
| 38 | // CHECK-NEXT: SectionHeaderOffset: 0x200F8 | |
| 38 | // CHECK-NEXT: SectionHeaderOffset: 0x30098 | |
| 39 | 39 | // CHECK-NEXT: Flags [ (0x2) |
| 40 | 40 | // CHECK-NEXT: 0x2 |
| 41 | 41 | // CHECK-NEXT: ] |
| ... | ... | @@ -178,7 +178,7 @@ |
| 178 | 178 | // CHECK-NEXT: SHF_WRITE (0x1) |
| 179 | 179 | // CHECK-NEXT: ] |
| 180 | 180 | // CHECK-NEXT: Address: 0x30000 |
| 181 | // CHECK-NEXT: Offset: 0x20060 | |
| 181 | // CHECK-NEXT: Offset: 0x30000 | |
| 182 | 182 | // CHECK-NEXT: Size: 0 |
| 183 | 183 | // CHECK-NEXT: Link: 0 |
| 184 | 184 | // CHECK-NEXT: Info: 0 |
| ... | ... | @@ -194,7 +194,7 @@ |
| 194 | 194 | // CHECK-NEXT: SHF_STRINGS (0x20) |
| 195 | 195 | // CHECK-NEXT: ] |
| 196 | 196 | // CHECK-NEXT: Address: 0x0 |
| 197 | // CHECK-NEXT: Offset: 0x20060 | |
| 197 | // CHECK-NEXT: Offset: 0x30000 | |
| 198 | 198 | // CHECK-NEXT: Size: 8 |
| 199 | 199 | // CHECK-NEXT: Link: 0 |
| 200 | 200 | // CHECK-NEXT: Info: 0 |
| ... | ... | @@ -211,7 +211,7 @@ |
| 211 | 211 | // CHECK-NEXT: Flags [ (0x0) |
| 212 | 212 | // CHECK-NEXT: ] |
| 213 | 213 | // CHECK-NEXT: Address: 0x0 |
| 214 | // CHECK-NEXT: Offset: 0x20068 | |
| 214 | // CHECK-NEXT: Offset: 0x30008 | |
| 215 | 215 | // CHECK-NEXT: Size: 48 |
| 216 | 216 | // CHECK-NEXT: Link: 10 |
| 217 | 217 | // CHECK-NEXT: Info: 2 |
| ... | ... | @@ -233,7 +233,7 @@ |
| 233 | 233 | // CHECK-NEXT: Flags [ (0x0) |
| 234 | 234 | // CHECK-NEXT: ] |
| 235 | 235 | // CHECK-NEXT: Address: 0x0 |
| 236 | // CHECK-NEXT: Offset: 0x20098 | |
| 236 | // CHECK-NEXT: Offset: 0x30038 | |
| 237 | 237 | // CHECK-NEXT: Size: 84 |
| 238 | 238 | // CHECK-NEXT: Link: 0 |
| 239 | 239 | // CHECK-NEXT: Info: 0 |
| ... | ... | @@ -255,7 +255,7 @@ |
| 255 | 255 | // CHECK-NEXT: Flags [ (0x0) |
| 256 | 256 | // CHECK-NEXT: ] |
| 257 | 257 | // CHECK-NEXT: Address: 0x0 |
| 258 | // CHECK-NEXT: Offset: 0x200EC | |
| 258 | // CHECK-NEXT: Offset: 0x3008C | |
| 259 | 259 | // CHECK-NEXT: Size: 10 |
| 260 | 260 | // CHECK-NEXT: Link: 0 |
| 261 | 261 | // CHECK-NEXT: Info: 0 |
deps/lld/test/ELF/linkerscript/nobits-offset.s+16-9| ... | ... | @@ -2,17 +2,24 @@ |
| 2 | 2 | # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o |
| 3 | 3 | # RUN: echo "SECTIONS { \ |
| 4 | 4 | # RUN: .sec1 (NOLOAD) : { . += 1; } \ |
| 5 | # RUN: .text : { *(.text) } \ | |
| 5 | # RUN: .bss : { *(.bss) } \ | |
| 6 | 6 | # RUN: };" > %t.script |
| 7 | 7 | # RUN: ld.lld %t.o -T %t.script -o %t |
| 8 | # RUN: llvm-readelf --sections %t | FileCheck %s | |
| 8 | # RUN: llvm-readelf -S -l %t | FileCheck %s | |
| 9 | 9 | |
| 10 | # We used to misalign section offsets if the first section in a | |
| 11 | # PT_LOAD was SHT_NOBITS. | |
| 10 | ## If a SHT_NOBITS section is the only section of a PT_LOAD segment, | |
| 11 | ## p_offset will be set to the sh_offset field of the section. Check we align | |
| 12 | ## sh_offset to sh_addr modulo max-page-size, so that p_vaddr=p_offset (mod | |
| 13 | ## p_align). | |
| 12 | 14 | |
| 13 | # CHECK: [ 2] .text PROGBITS 0000000000000010 001010 000010 00 AX 0 0 16 | |
| 15 | # CHECK: Name Type Address Off Size ES Flg Lk Inf Al | |
| 16 | # CHECK: .bss NOBITS 0000000000000400 001400 000001 00 WA 0 0 1024 | |
| 14 | 17 | |
| 15 | .global _start | |
| 16 | _start: | |
| 17 | nop | |
| 18 | .p2align 4 | |
| 18 | # CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align | |
| 19 | # CHECK: LOAD 0x001400 0x0000000000000400 0x0000000000000400 0x000000 0x000001 RW 0x1000 | |
| 20 | ||
| 21 | # CHECK: 00 .bss | |
| 22 | ||
| 23 | .bss | |
| 24 | .p2align 10 | |
| 25 | .byte 0 |
deps/lld/test/ELF/nmagic.s created+23| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | # REQUIRES: x86 | |
| 2 | # Verify that .rodata is aligned to a 8 byte boundary. | |
| 3 | ||
| 4 | # RUN: llvm-mc -filetype=obj -triple=i386 %s -o %t.o | |
| 5 | # RUN: ld.lld %t.o -o %t.exe -n -Ttext 0 | |
| 6 | # RUN: llvm-readelf --section-headers %t.exe | FileCheck %s | |
| 7 | ||
| 8 | # CHECK: [ 0] NULL 00000000 000000 000000 00 0 0 0 | |
| 9 | # CHECK: [ 1] .text PROGBITS 00000000 0000d4 000001 00 AX 0 0 4 | |
| 10 | # CHECK: [ 2] .rodata PROGBITS 00000008 0000d8 000008 00 A 0 0 8 | |
| 11 | # CHECK: [ 3] .comment PROGBITS 00000000 0000e0 000008 01 MS 0 0 1 | |
| 12 | # CHECK: [ 4] .symtab SYMTAB 00000000 0000e8 000020 10 6 1 4 | |
| 13 | # CHECK: [ 5] .shstrtab STRTAB 00000000 000108 000032 00 0 0 1 | |
| 14 | # CHECK: [ 6] .strtab STRTAB 00000000 00013a 000008 00 0 0 1 | |
| 15 | ||
| 16 | .globl _start | |
| 17 | .text | |
| 18 | _start: | |
| 19 | ret | |
| 20 | ||
| 21 | .rodata | |
| 22 | .align 8 | |
| 23 | .quad 42 |
deps/lld/test/ELF/nobits-offset.s created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | # REQUIRES: aarch64 | |
| 2 | # RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o | |
| 3 | # RUN: ld.lld %t.o -o %t | |
| 4 | # RUN: llvm-readelf -S -l %t | FileCheck %s | |
| 5 | ||
| 6 | ## If a SHT_NOBITS section is the only section of a PT_LOAD segment, | |
| 7 | ## p_offset will be set to the sh_offset field of the section. Check we align | |
| 8 | ## sh_offset to sh_addr modulo max-page-size, so that p_vaddr=p_offset (mod | |
| 9 | ## p_align). | |
| 10 | ||
| 11 | # CHECK: Name Type Address Off Size ES Flg Lk Inf Al | |
| 12 | # CHECK: .bss NOBITS 0000000000210000 010000 000001 00 WA 0 0 4096 | |
| 13 | ||
| 14 | # CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align | |
| 15 | # CHECK: LOAD 0x010000 0x0000000000210000 0x0000000000210000 0x000000 0x000001 RW 0x10000 | |
| 16 | ||
| 17 | # CHECK: 02 .bss | |
| 18 | ||
| 19 | .bss | |
| 20 | .p2align 12 | |
| 21 | .byte 0 |
deps/lld/test/ELF/ppc64-reloc-rel.s created+58| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | # REQUIRES: ppc | |
| 2 | ||
| 3 | # RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o | |
| 4 | # RUN: ld.lld %t.o --defsym=foo=rel16+0x8000 -o %t | |
| 5 | # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s | |
| 6 | # RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=REL %s | |
| 7 | # RUN: llvm-readelf -S %t | FileCheck --check-prefix=SEC %s | |
| 8 | # RUN: llvm-readelf -x .eh_frame %t | FileCheck --check-prefix=HEX %s | |
| 9 | ||
| 10 | .section .R_PPC64_REL14,"ax",@progbits | |
| 11 | # FIXME This does not produce a relocation | |
| 12 | beq 1f | |
| 13 | 1: | |
| 14 | # CHECK-LABEL: Disassembly of section .R_PPC64_REL14: | |
| 15 | # CHECK: bt 2, .+4 | |
| 16 | ||
| 17 | .section .R_PPC64_REL16,"ax",@progbits | |
| 18 | .globl rel16 | |
| 19 | rel16: | |
| 20 | li 3, foo-rel16-1@ha # R_PPC64_REL16_HA | |
| 21 | li 3, foo-rel16@ha | |
| 22 | li 4, foo-rel16+0x7fff@h # R_PPC64_REL16_HI | |
| 23 | li 4, foo-rel16+0x8000@h | |
| 24 | li 5, foo-rel16-1@l # R_PPC64_REL16_LO | |
| 25 | li 5, foo-rel16@l | |
| 26 | # CHECK-LABEL: Disassembly of section .R_PPC64_REL16: | |
| 27 | # CHECK: li 3, 0 | |
| 28 | # CHECK-NEXT: li 3, 1 | |
| 29 | # CHECK-NEXT: li 4, 0 | |
| 30 | # CHECK-NEXT: li 4, 1 | |
| 31 | # CHECK-NEXT: li 5, 32767 | |
| 32 | # CHECK-NEXT: li 5, -32768 | |
| 33 | ||
| 34 | .section .R_PPC64_REL24,"ax",@progbits | |
| 35 | b rel16 | |
| 36 | # CHECK-LABEL: Disassembly of section .R_PPC64_REL24: | |
| 37 | # CHECK: b .+67108840 | |
| 38 | ||
| 39 | .section .REL32_AND_REL64,"ax",@progbits | |
| 40 | .cfi_startproc | |
| 41 | .cfi_personality 148, rel64 | |
| 42 | nop | |
| 43 | .cfi_endproc | |
| 44 | rel64: | |
| 45 | li 3, 0 | |
| 46 | # REL: .rela.eh_frame { | |
| 47 | # REL-NEXT: 0x12 R_PPC64_REL64 .REL32_AND_REL64 0x4 | |
| 48 | # REL-NEXT: 0x28 R_PPC64_REL32 .REL32_AND_REL64 0x0 | |
| 49 | # REL-NEXT: } | |
| 50 | ||
| 51 | # SEC: .REL32_AND_REL64 PROGBITS 0000000010010020 | |
| 52 | ||
| 53 | ## CIE Personality Address: 0x10010020-(0x10000168+2)+4 = 0xfeba | |
| 54 | ## FDE PC Begin: 0x10010020-(0x10000178+8) = 0xfea0 | |
| 55 | # HEX: section '.eh_frame': | |
| 56 | # HEX-NEXT: 0x10000158 | |
| 57 | # HEX-NEXT: 0x10000168 {{....}}bafe 00000000 | |
| 58 | # HEX-NEXT: 0x10000178 {{[0-9a-f]+}} {{[0-9a-f]+}} a0fe0000 |
deps/lld/test/ELF/ppc64-relocs.s+9-72| ... | ... | @@ -18,16 +18,9 @@ _start: |
| 18 | 18 | 	li 3,42 |
| 19 | 19 | 	sc |
| 20 | 20 | |
| 21 | .section .rodata,"a",@progbits | |
| 22 | .p2align 2 | |
| 23 | .LJTI0_0: | |
| 24 | .long .LBB0_2-.LJTI0_0 | |
| 25 | ||
| 26 | .section .toc,"aw",@progbits | |
| 21 | .section .toc,"aw",@progbits | |
| 27 | 22 | .L1: |
| 28 | .quad 22, 37, 89, 47 | |
| 29 | .LC0: | |
| 30 | .tc .LJTI0_0[TC],.LJTI0_0 | |
| 23 | .quad 22, 37, 89, 47 | |
| 31 | 24 | |
| 32 | 25 | .section .R_PPC64_TOC16_LO_DS,"ax",@progbits |
| 33 | 26 | ld 1, .L1@toc@l(2) |
| ... | ... | @@ -53,91 +46,47 @@ _start: |
| 53 | 46 | # CHECK-LABEL: Disassembly of section .R_PPC64_TOC16_HA: |
| 54 | 47 | # CHECK: 10010018: addis 1, 2, 0 |
| 55 | 48 | |
| 56 | .section .R_PPC64_REL24,"ax",@progbits | |
| 57 | b 1f | |
| 58 | 1: | |
| 59 | ||
| 60 | # CHECK-LABEL: Disassembly of section .R_PPC64_REL24: | |
| 61 | # CHECK: 1001001c: b .+4 | |
| 62 | ||
| 63 | .section .R_PPC64_REL14,"ax",@progbits | |
| 64 | beq 1f | |
| 65 | 1: | |
| 66 | ||
| 67 | # CHECK-LABEL: Disassembly of section .R_PPC64_REL14: | |
| 68 | # CHECK: 10010020: bt 2, .+4 | |
| 69 | ||
| 70 | 49 | .section .R_PPC64_ADDR16_LO,"ax",@progbits |
| 71 | 50 | li 1, .Lfoo@l |
| 72 | 51 | |
| 73 | 52 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_LO: |
| 74 | # CHECK: 10010024: li 1, 0 | |
| 53 | # CHECK: li 1, 0 | |
| 75 | 54 | |
| 76 | 55 | .section .R_PPC64_ADDR16_HI,"ax",@progbits |
| 77 | 56 | li 1, .Lfoo@h |
| 78 | 57 | |
| 79 | 58 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HI: |
| 80 | # CHECK: 10010028: li 1, 4097 | |
| 59 | # CHECK: li 1, 4097 | |
| 81 | 60 | |
| 82 | 61 | .section .R_PPC64_ADDR16_HA,"ax",@progbits |
| 83 | 62 | li 1, .Lfoo@ha |
| 84 | 63 | |
| 85 | 64 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HA: |
| 86 | # CHECK: 1001002c: li 1, 4097 | |
| 65 | # CHECK: li 1, 4097 | |
| 87 | 66 | |
| 88 | 67 | .section .R_PPC64_ADDR16_HIGHER,"ax",@progbits |
| 89 | 68 | li 1, .Lfoo@higher |
| 90 | 69 | |
| 91 | 70 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHER: |
| 92 | # CHECK: 10010030: li 1, 0 | |
| 71 | # CHECK: li 1, 0 | |
| 93 | 72 | |
| 94 | 73 | .section .R_PPC64_ADDR16_HIGHERA,"ax",@progbits |
| 95 | 74 | li 1, .Lfoo@highera |
| 96 | 75 | |
| 97 | 76 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHERA: |
| 98 | # CHECK: 10010034: li 1, 0 | |
| 77 | # CHECK: li 1, 0 | |
| 99 | 78 | |
| 100 | 79 | .section .R_PPC64_ADDR16_HIGHEST,"ax",@progbits |
| 101 | 80 | li 1, .Lfoo@highest |
| 102 | 81 | |
| 103 | 82 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHEST: |
| 104 | # CHECK: 10010038: li 1, 0 | |
| 83 | # CHECK: li 1, 0 | |
| 105 | 84 | |
| 106 | 85 | .section .R_PPC64_ADDR16_HIGHESTA,"ax",@progbits |
| 107 | 86 | li 1, .Lfoo@highesta |
| 108 | 87 | |
| 109 | 88 | # CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHESTA: |
| 110 | # CHECK: 1001003c: li 1, 0 | |
| 111 | ||
| 112 | .section .R_PPC64_REL32, "ax",@progbits | |
| 113 | addis 5, 2, .LC0@toc@ha | |
| 114 | ld 5, .LC0@toc@l(5) | |
| 115 | .LBB0_2: | |
| 116 | add 3, 3, 4 | |
| 117 | ||
| 118 | # DATALE: '.rodata': | |
| 119 | # DATALE: 0x100001c8 80fe0000 | |
| 120 | ||
| 121 | # DATABE: '.rodata': | |
| 122 | # DATABE: 0x100001c8 0000fe80 | |
| 123 | ||
| 124 | # Address of rodata + value stored at rodata entry | |
| 125 | # should equal address of LBB0_2. | |
| 126 | # 0x10000190 + 0xfeb4 = 0x10010044 | |
| 127 | # CHECK-LABEL: Disassembly of section .R_PPC64_REL32: | |
| 128 | # CHECK: 10010040: addis 5, 2, 0 | |
| 129 | # CHECK: 10010044: ld 5, -32736(5) | |
| 130 | # CHECK: 10010048: add 3, 3, 4 | |
| 131 | ||
| 132 | .section .R_PPC64_REL64, "ax",@progbits | |
| 133 | .cfi_startproc | |
| 134 | .cfi_personality 148, __foo | |
| 135 | li 0, 1 | |
| 136 | li 3, 55 | |
| 137 | sc | |
| 138 | .cfi_endproc | |
| 139 | __foo: | |
| 140 | li 3,0 | |
| 89 | # CHECK: li 1, 0 | |
| 141 | 90 | |
| 142 | 91 | .section .R_PPC64_TOC,"a",@progbits |
| 143 | 92 | .quad .TOC.@tocbase |
| ... | ... | @@ -150,15 +99,3 @@ __foo: |
| 150 | 99 | |
| 151 | 100 | # DATABE-LABEL: section '.R_PPC64_TOC': |
| 152 | 101 | # DATABE: 00000000 10028000 |
| 153 | ||
| 154 | # Check that the personality (relocated by R_PPC64_REL64) in the .eh_frame | |
| 155 | # equals the address of __foo. | |
| 156 | # 0x100001ea + 0xfe6e = 0x10010058 | |
| 157 | # DATALE: section '.eh_frame': | |
| 158 | # DATALE: 0x100001e8 {{....}}6efe | |
| 159 | ||
| 160 | # DATABE: section '.eh_frame': | |
| 161 | # DATABE: 0x100001e8 {{[0-9a-f]+ [0-9a-f]+}} fe6e{{....}} | |
| 162 | ||
| 163 | # CHECK: __foo | |
| 164 | # CHECK-NEXT: 10010058: li 3, 0 |
deps/lld/test/ELF/relocation-copy-align-common.s+1-1| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | # CHECK-NEXT: SHF_WRITE |
| 16 | 16 | # CHECK-NEXT: ] |
| 17 | 17 | # CHECK-NEXT: Address: 0x203000 |
| 18 | # CHECK-NEXT: Offset: 0x20B0 | |
| 18 | # CHECK-NEXT: Offset: 0x3000 | |
| 19 | 19 | # CHECK-NEXT: Size: 16 |
| 20 | 20 | # CHECK-NEXT: Link: 0 |
| 21 | 21 | # CHECK-NEXT: Info: 0 |