1 //===- OutputSections.cpp -------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "OutputSections.h" 10 #include "Config.h" 11 #include "LinkerScript.h" 12 #include "SymbolTable.h" 13 #include "SyntheticSections.h" 14 #include "Target.h" 15 #include "lld/Common/Memory.h" 16 #include "lld/Common/Strings.h" 17 #include "llvm/BinaryFormat/Dwarf.h" 18 #include "llvm/Support/Compression.h" 19 #include "llvm/Support/MD5.h" 20 #include "llvm/Support/MathExtras.h" 21 #include "llvm/Support/Parallel.h" 22 #include "llvm/Support/SHA1.h" 23 #include "llvm/Support/TimeProfiler.h" 24 #include <regex> 25 #include <unordered_set> 26 27 using namespace llvm; 28 using namespace llvm::dwarf; 29 using namespace llvm::object; 30 using namespace llvm::support::endian; 31 using namespace llvm::ELF; 32 using namespace lld; 33 using namespace lld::elf; 34 35 uint8_t *Out::bufferStart; 36 uint8_t Out::first; 37 PhdrEntry *Out::tlsPhdr; 38 OutputSection *Out::elfHeader; 39 OutputSection *Out::programHeaders; 40 OutputSection *Out::preinitArray; 41 OutputSection *Out::initArray; 42 OutputSection *Out::finiArray; 43 44 std::vector<OutputSection *> elf::outputSections; 45 46 uint32_t OutputSection::getPhdrFlags() const { 47 uint32_t ret = 0; 48 if (config->emachine != EM_ARM || !(flags & SHF_ARM_PURECODE)) 49 ret |= PF_R; 50 if (flags & SHF_WRITE) 51 ret |= PF_W; 52 if (flags & SHF_EXECINSTR) 53 ret |= PF_X; 54 return ret; 55 } 56 57 template <class ELFT> 58 void OutputSection::writeHeaderTo(typename ELFT::Shdr *shdr) { 59 shdr->sh_entsize = entsize; 60 shdr->sh_addralign = alignment; 61 shdr->sh_type = type; 62 shdr->sh_offset = offset; 63 shdr->sh_flags = flags; 64 shdr->sh_info = info; 65 shdr->sh_link = link; 66 shdr->sh_addr = addr; 67 shdr->sh_size = size; 68 shdr->sh_name = shName; 69 } 70 71 OutputSection::OutputSection(StringRef name, uint32_t type, uint64_t flags) 72 : SectionCommand(OutputSectionKind), 73 SectionBase(Output, name, flags, /*Entsize*/ 0, /*Alignment*/ 1, type, 74 /*Info*/ 0, /*Link*/ 0) {} 75 76 // We allow sections of types listed below to merged into a 77 // single progbits section. This is typically done by linker 78 // scripts. Merging nobits and progbits will force disk space 79 // to be allocated for nobits sections. Other ones don't require 80 // any special treatment on top of progbits, so there doesn't 81 // seem to be a harm in merging them. 82 // 83 // NOTE: clang since rL252300 emits SHT_X86_64_UNWIND .eh_frame sections. Allow 84 // them to be merged into SHT_PROGBITS .eh_frame (GNU as .cfi_*). 85 static bool canMergeToProgbits(unsigned type) { 86 return type == SHT_NOBITS || type == SHT_PROGBITS || type == SHT_INIT_ARRAY || 87 type == SHT_PREINIT_ARRAY || type == SHT_FINI_ARRAY || 88 type == SHT_NOTE || 89 (type == SHT_X86_64_UNWIND && config->emachine == EM_X86_64); 90 } 91 92 // Record that isec will be placed in the OutputSection. isec does not become 93 // permanent until finalizeInputSections() is called. The function should not be 94 // used after finalizeInputSections() is called. If you need to add an 95 // InputSection post finalizeInputSections(), then you must do the following: 96 // 97 // 1. Find or create an InputSectionDescription to hold InputSection. 98 // 2. Add the InputSection to the InputSectionDescription::sections. 99 // 3. Call commitSection(isec). 100 void OutputSection::recordSection(InputSectionBase *isec) { 101 partition = isec->partition; 102 isec->parent = this; 103 if (commands.empty() || !isa<InputSectionDescription>(commands.back())) 104 commands.push_back(make<InputSectionDescription>("")); 105 auto *isd = cast<InputSectionDescription>(commands.back()); 106 isd->sectionBases.push_back(isec); 107 } 108 109 // Update fields (type, flags, alignment, etc) according to the InputSection 110 // isec. Also check whether the InputSection flags and type are consistent with 111 // other InputSections. 112 void OutputSection::commitSection(InputSection *isec) { 113 if (!hasInputSections) { 114 // If IS is the first section to be added to this section, 115 // initialize type, entsize and flags from isec. 116 hasInputSections = true; 117 type = isec->type; 118 entsize = isec->entsize; 119 flags = isec->flags; 120 } else { 121 // Otherwise, check if new type or flags are compatible with existing ones. 122 if ((flags ^ isec->flags) & SHF_TLS) 123 error("incompatible section flags for " + name + "\n>>> " + toString(isec) + 124 ": 0x" + utohexstr(isec->flags) + "\n>>> output section " + name + 125 ": 0x" + utohexstr(flags)); 126 127 if (type != isec->type) { 128 if (!canMergeToProgbits(type) || !canMergeToProgbits(isec->type)) 129 error("section type mismatch for " + isec->name + "\n>>> " + 130 toString(isec) + ": " + 131 getELFSectionTypeName(config->emachine, isec->type) + 132 "\n>>> output section " + name + ": " + 133 getELFSectionTypeName(config->emachine, type)); 134 type = SHT_PROGBITS; 135 } 136 } 137 if (noload) 138 type = SHT_NOBITS; 139 140 isec->parent = this; 141 uint64_t andMask = 142 config->emachine == EM_ARM ? (uint64_t)SHF_ARM_PURECODE : 0; 143 uint64_t orMask = ~andMask; 144 uint64_t andFlags = (flags & isec->flags) & andMask; 145 uint64_t orFlags = (flags | isec->flags) & orMask; 146 flags = andFlags | orFlags; 147 if (nonAlloc) 148 flags &= ~(uint64_t)SHF_ALLOC; 149 150 alignment = std::max(alignment, isec->alignment); 151 152 // If this section contains a table of fixed-size entries, sh_entsize 153 // holds the element size. If it contains elements of different size we 154 // set sh_entsize to 0. 155 if (entsize != isec->entsize) 156 entsize = 0; 157 } 158 159 // This function scans over the InputSectionBase list sectionBases to create 160 // InputSectionDescription::sections. 161 // 162 // It removes MergeInputSections from the input section array and adds 163 // new synthetic sections at the location of the first input section 164 // that it replaces. It then finalizes each synthetic section in order 165 // to compute an output offset for each piece of each input section. 166 void OutputSection::finalizeInputSections() { 167 std::vector<MergeSyntheticSection *> mergeSections; 168 for (SectionCommand *cmd : commands) { 169 auto *isd = dyn_cast<InputSectionDescription>(cmd); 170 if (!isd) 171 continue; 172 isd->sections.reserve(isd->sectionBases.size()); 173 for (InputSectionBase *s : isd->sectionBases) { 174 MergeInputSection *ms = dyn_cast<MergeInputSection>(s); 175 if (!ms) { 176 isd->sections.push_back(cast<InputSection>(s)); 177 continue; 178 } 179 180 // We do not want to handle sections that are not alive, so just remove 181 // them instead of trying to merge. 182 if (!ms->isLive()) 183 continue; 184 185 auto i = llvm::find_if(mergeSections, [=](MergeSyntheticSection *sec) { 186 // While we could create a single synthetic section for two different 187 // values of Entsize, it is better to take Entsize into consideration. 188 // 189 // With a single synthetic section no two pieces with different Entsize 190 // could be equal, so we may as well have two sections. 191 // 192 // Using Entsize in here also allows us to propagate it to the synthetic 193 // section. 194 // 195 // SHF_STRINGS section with different alignments should not be merged. 196 return sec->flags == ms->flags && sec->entsize == ms->entsize && 197 (sec->alignment == ms->alignment || !(sec->flags & SHF_STRINGS)); 198 }); 199 if (i == mergeSections.end()) { 200 MergeSyntheticSection *syn = 201 createMergeSynthetic(name, ms->type, ms->flags, ms->alignment); 202 mergeSections.push_back(syn); 203 i = std::prev(mergeSections.end()); 204 syn->entsize = ms->entsize; 205 isd->sections.push_back(syn); 206 } 207 (*i)->addSection(ms); 208 } 209 210 // sectionBases should not be used from this point onwards. Clear it to 211 // catch misuses. 212 isd->sectionBases.clear(); 213 214 // Some input sections may be removed from the list after ICF. 215 for (InputSection *s : isd->sections) 216 commitSection(s); 217 } 218 for (auto *ms : mergeSections) 219 ms->finalizeContents(); 220 } 221 222 static void sortByOrder(MutableArrayRef<InputSection *> in, 223 llvm::function_ref<int(InputSectionBase *s)> order) { 224 std::vector<std::pair<int, InputSection *>> v; 225 for (InputSection *s : in) 226 v.push_back({order(s), s}); 227 llvm::stable_sort(v, less_first()); 228 229 for (size_t i = 0; i < v.size(); ++i) 230 in[i] = v[i].second; 231 } 232 233 uint64_t elf::getHeaderSize() { 234 if (config->oFormatBinary) 235 return 0; 236 return Out::elfHeader->size + Out::programHeaders->size; 237 } 238 239 bool OutputSection::classof(const SectionCommand *c) { 240 return c->kind == OutputSectionKind; 241 } 242 243 void OutputSection::sort(llvm::function_ref<int(InputSectionBase *s)> order) { 244 assert(isLive()); 245 for (SectionCommand *b : commands) 246 if (auto *isd = dyn_cast<InputSectionDescription>(b)) 247 sortByOrder(isd->sections, order); 248 } 249 250 static void nopInstrFill(uint8_t *buf, size_t size) { 251 if (size == 0) 252 return; 253 unsigned i = 0; 254 if (size == 0) 255 return; 256 std::vector<std::vector<uint8_t>> nopFiller = *target->nopInstrs; 257 unsigned num = size / nopFiller.back().size(); 258 for (unsigned c = 0; c < num; ++c) { 259 memcpy(buf + i, nopFiller.back().data(), nopFiller.back().size()); 260 i += nopFiller.back().size(); 261 } 262 unsigned remaining = size - i; 263 if (!remaining) 264 return; 265 assert(nopFiller[remaining - 1].size() == remaining); 266 memcpy(buf + i, nopFiller[remaining - 1].data(), remaining); 267 } 268 269 // Fill [Buf, Buf + Size) with Filler. 270 // This is used for linker script "=fillexp" command. 271 static void fill(uint8_t *buf, size_t size, 272 const std::array<uint8_t, 4> &filler) { 273 size_t i = 0; 274 for (; i + 4 < size; i += 4) 275 memcpy(buf + i, filler.data(), 4); 276 memcpy(buf + i, filler.data(), size - i); 277 } 278 279 // Compress section contents if this section contains debug info. 280 template <class ELFT> void OutputSection::maybeCompress() { 281 using Elf_Chdr = typename ELFT::Chdr; 282 283 // Compress only DWARF debug sections. 284 if (!config->compressDebugSections || (flags & SHF_ALLOC) || 285 !name.startswith(".debug_")) 286 return; 287 288 llvm::TimeTraceScope timeScope("Compress debug sections"); 289 290 // Create a section header. 291 zDebugHeader.resize(sizeof(Elf_Chdr)); 292 auto *hdr = reinterpret_cast<Elf_Chdr *>(zDebugHeader.data()); 293 hdr->ch_type = ELFCOMPRESS_ZLIB; 294 hdr->ch_size = size; 295 hdr->ch_addralign = alignment; 296 297 // Write section contents to a temporary buffer and compress it. 298 std::vector<uint8_t> buf(size); 299 writeTo<ELFT>(buf.data()); 300 // We chose 1 as the default compression level because it is the fastest. If 301 // -O2 is given, we use level 6 to compress debug info more by ~15%. We found 302 // that level 7 to 9 doesn't make much difference (~1% more compression) while 303 // they take significant amount of time (~2x), so level 6 seems enough. 304 if (Error e = zlib::compress(toStringRef(buf), compressedData, 305 config->optimize >= 2 ? 6 : 1)) 306 fatal("compress failed: " + llvm::toString(std::move(e))); 307 308 // Update section headers. 309 size = sizeof(Elf_Chdr) + compressedData.size(); 310 flags |= SHF_COMPRESSED; 311 } 312 313 static void writeInt(uint8_t *buf, uint64_t data, uint64_t size) { 314 if (size == 1) 315 *buf = data; 316 else if (size == 2) 317 write16(buf, data); 318 else if (size == 4) 319 write32(buf, data); 320 else if (size == 8) 321 write64(buf, data); 322 else 323 llvm_unreachable("unsupported Size argument"); 324 } 325 326 template <class ELFT> void OutputSection::writeTo(uint8_t *buf) { 327 if (type == SHT_NOBITS) 328 return; 329 330 // If --compress-debug-section is specified and if this is a debug section, 331 // we've already compressed section contents. If that's the case, 332 // just write it down. 333 if (!compressedData.empty()) { 334 memcpy(buf, zDebugHeader.data(), zDebugHeader.size()); 335 memcpy(buf + zDebugHeader.size(), compressedData.data(), 336 compressedData.size()); 337 return; 338 } 339 340 // Write leading padding. 341 std::vector<InputSection *> sections = getInputSections(this); 342 std::array<uint8_t, 4> filler = getFiller(); 343 bool nonZeroFiller = read32(filler.data()) != 0; 344 if (nonZeroFiller) 345 fill(buf, sections.empty() ? size : sections[0]->outSecOff, filler); 346 347 parallelForEachN(0, sections.size(), [&](size_t i) { 348 InputSection *isec = sections[i]; 349 isec->writeTo<ELFT>(buf); 350 351 // Fill gaps between sections. 352 if (nonZeroFiller) { 353 uint8_t *start = buf + isec->outSecOff + isec->getSize(); 354 uint8_t *end; 355 if (i + 1 == sections.size()) 356 end = buf + size; 357 else 358 end = buf + sections[i + 1]->outSecOff; 359 if (isec->nopFiller) { 360 assert(target->nopInstrs); 361 nopInstrFill(start, end - start); 362 } else 363 fill(start, end - start, filler); 364 } 365 }); 366 367 // Linker scripts may have BYTE()-family commands with which you 368 // can write arbitrary bytes to the output. Process them if any. 369 for (SectionCommand *cmd : commands) 370 if (auto *data = dyn_cast<ByteCommand>(cmd)) 371 writeInt(buf + data->offset, data->expression().getValue(), data->size); 372 } 373 374 static void finalizeShtGroup(OutputSection *os, 375 InputSection *section) { 376 assert(config->relocatable); 377 378 // sh_link field for SHT_GROUP sections should contain the section index of 379 // the symbol table. 380 os->link = in.symTab->getParent()->sectionIndex; 381 382 // sh_info then contain index of an entry in symbol table section which 383 // provides signature of the section group. 384 ArrayRef<Symbol *> symbols = section->file->getSymbols(); 385 os->info = in.symTab->getSymbolIndex(symbols[section->info]); 386 387 // Some group members may be combined or discarded, so we need to compute the 388 // new size. The content will be rewritten in InputSection::copyShtGroup. 389 std::unordered_set<uint32_t> seen; 390 ArrayRef<InputSectionBase *> sections = section->file->getSections(); 391 for (const uint32_t &idx : section->getDataAs<uint32_t>().slice(1)) 392 if (OutputSection *osec = sections[read32(&idx)]->getOutputSection()) 393 seen.insert(osec->sectionIndex); 394 os->size = (1 + seen.size()) * sizeof(uint32_t); 395 } 396 397 void OutputSection::finalize() { 398 InputSection *first = getFirstInputSection(this); 399 400 if (flags & SHF_LINK_ORDER) { 401 // We must preserve the link order dependency of sections with the 402 // SHF_LINK_ORDER flag. The dependency is indicated by the sh_link field. We 403 // need to translate the InputSection sh_link to the OutputSection sh_link, 404 // all InputSections in the OutputSection have the same dependency. 405 if (auto *ex = dyn_cast<ARMExidxSyntheticSection>(first)) 406 link = ex->getLinkOrderDep()->getParent()->sectionIndex; 407 else if (first->flags & SHF_LINK_ORDER) 408 if (auto *d = first->getLinkOrderDep()) 409 link = d->getParent()->sectionIndex; 410 } 411 412 if (type == SHT_GROUP) { 413 finalizeShtGroup(this, first); 414 return; 415 } 416 417 if (!config->copyRelocs || (type != SHT_RELA && type != SHT_REL)) 418 return; 419 420 // Skip if 'first' is synthetic, i.e. not a section created by --emit-relocs. 421 // Normally 'type' was changed by 'first' so 'first' should be non-null. 422 // However, if the output section is .rela.dyn, 'type' can be set by the empty 423 // synthetic .rela.plt and first can be null. 424 if (!first || isa<SyntheticSection>(first)) 425 return; 426 427 link = in.symTab->getParent()->sectionIndex; 428 // sh_info for SHT_REL[A] sections should contain the section header index of 429 // the section to which the relocation applies. 430 InputSectionBase *s = first->getRelocatedSection(); 431 info = s->getOutputSection()->sectionIndex; 432 flags |= SHF_INFO_LINK; 433 } 434 435 // Returns true if S is in one of the many forms the compiler driver may pass 436 // crtbegin files. 437 // 438 // Gcc uses any of crtbegin[<empty>|S|T].o. 439 // Clang uses Gcc's plus clang_rt.crtbegin[<empty>|S|T][-<arch>|<empty>].o. 440 441 static bool isCrtbegin(StringRef s) { 442 static std::regex re(R"((clang_rt\.)?crtbegin[ST]?(-.*)?\.o)"); 443 s = sys::path::filename(s); 444 return std::regex_match(s.begin(), s.end(), re); 445 } 446 447 static bool isCrtend(StringRef s) { 448 static std::regex re(R"((clang_rt\.)?crtend[ST]?(-.*)?\.o)"); 449 s = sys::path::filename(s); 450 return std::regex_match(s.begin(), s.end(), re); 451 } 452 453 // .ctors and .dtors are sorted by this order: 454 // 455 // 1. .ctors/.dtors in crtbegin (which contains a sentinel value -1). 456 // 2. The section is named ".ctors" or ".dtors" (priority: 65536). 457 // 3. The section has an optional priority value in the form of ".ctors.N" or 458 // ".dtors.N" where N is a number in the form of %05u (priority: 65535-N). 459 // 4. .ctors/.dtors in crtend (which contains a sentinel value 0). 460 // 461 // For 2 and 3, the sections are sorted by priority from high to low, e.g. 462 // .ctors (65536), .ctors.00100 (65436), .ctors.00200 (65336). In GNU ld's 463 // internal linker scripts, the sorting is by string comparison which can 464 // achieve the same goal given the optional priority values are of the same 465 // length. 466 // 467 // In an ideal world, we don't need this function because .init_array and 468 // .ctors are duplicate features (and .init_array is newer.) However, there 469 // are too many real-world use cases of .ctors, so we had no choice to 470 // support that with this rather ad-hoc semantics. 471 static bool compCtors(const InputSection *a, const InputSection *b) { 472 bool beginA = isCrtbegin(a->file->getName()); 473 bool beginB = isCrtbegin(b->file->getName()); 474 if (beginA != beginB) 475 return beginA; 476 bool endA = isCrtend(a->file->getName()); 477 bool endB = isCrtend(b->file->getName()); 478 if (endA != endB) 479 return endB; 480 return getPriority(a->name) > getPriority(b->name); 481 } 482 483 // Sorts input sections by the special rules for .ctors and .dtors. 484 // Unfortunately, the rules are different from the one for .{init,fini}_array. 485 // Read the comment above. 486 void OutputSection::sortCtorsDtors() { 487 assert(commands.size() == 1); 488 auto *isd = cast<InputSectionDescription>(commands[0]); 489 llvm::stable_sort(isd->sections, compCtors); 490 } 491 492 // If an input string is in the form of "foo.N" where N is a number, return N 493 // (65535-N if .ctors.N or .dtors.N). Otherwise, returns 65536, which is one 494 // greater than the lowest priority. 495 int elf::getPriority(StringRef s) { 496 size_t pos = s.rfind('.'); 497 if (pos == StringRef::npos) 498 return 65536; 499 int v = 65536; 500 if (to_integer(s.substr(pos + 1), v, 10) && 501 (pos == 6 && (s.startswith(".ctors") || s.startswith(".dtors")))) 502 v = 65535 - v; 503 return v; 504 } 505 506 InputSection *elf::getFirstInputSection(const OutputSection *os) { 507 for (SectionCommand *cmd : os->commands) 508 if (auto *isd = dyn_cast<InputSectionDescription>(cmd)) 509 if (!isd->sections.empty()) 510 return isd->sections[0]; 511 return nullptr; 512 } 513 514 std::vector<InputSection *> elf::getInputSections(const OutputSection *os) { 515 std::vector<InputSection *> ret; 516 for (SectionCommand *cmd : os->commands) 517 if (auto *isd = dyn_cast<InputSectionDescription>(cmd)) 518 ret.insert(ret.end(), isd->sections.begin(), isd->sections.end()); 519 return ret; 520 } 521 522 // Sorts input sections by section name suffixes, so that .foo.N comes 523 // before .foo.M if N < M. Used to sort .{init,fini}_array.N sections. 524 // We want to keep the original order if the priorities are the same 525 // because the compiler keeps the original initialization order in a 526 // translation unit and we need to respect that. 527 // For more detail, read the section of the GCC's manual about init_priority. 528 void OutputSection::sortInitFini() { 529 // Sort sections by priority. 530 sort([](InputSectionBase *s) { return getPriority(s->name); }); 531 } 532 533 std::array<uint8_t, 4> OutputSection::getFiller() { 534 if (filler) 535 return *filler; 536 if (flags & SHF_EXECINSTR) 537 return target->trapInstr; 538 return {0, 0, 0, 0}; 539 } 540 541 void OutputSection::checkDynRelAddends(const uint8_t *bufStart) { 542 assert(config->writeAddends && config->checkDynamicRelocs); 543 assert(type == SHT_REL || type == SHT_RELA); 544 std::vector<InputSection *> sections = getInputSections(this); 545 parallelForEachN(0, sections.size(), [&](size_t i) { 546 // When linking with -r or --emit-relocs we might also call this function 547 // for input .rel[a].<sec> sections which we simply pass through to the 548 // output. We skip over those and only look at the synthetic relocation 549 // sections created during linking. 550 const auto *sec = dyn_cast<RelocationBaseSection>(sections[i]); 551 if (!sec) 552 return; 553 for (const DynamicReloc &rel : sec->relocs) { 554 int64_t addend = rel.computeAddend(); 555 const OutputSection *relOsec = rel.inputSec->getOutputSection(); 556 assert(relOsec != nullptr && "missing output section for relocation"); 557 const uint8_t *relocTarget = 558 bufStart + relOsec->offset + rel.inputSec->getOffset(rel.offsetInSec); 559 // For SHT_NOBITS the written addend is always zero. 560 int64_t writtenAddend = 561 relOsec->type == SHT_NOBITS 562 ? 0 563 : target->getImplicitAddend(relocTarget, rel.type); 564 if (addend != writtenAddend) 565 internalLinkerError( 566 getErrorLocation(relocTarget), 567 "wrote incorrect addend value 0x" + utohexstr(writtenAddend) + 568 " instead of 0x" + utohexstr(addend) + 569 " for dynamic relocation " + toString(rel.type) + 570 " at offset 0x" + utohexstr(rel.getOffset()) + 571 (rel.sym ? " against symbol " + toString(*rel.sym) : "")); 572 } 573 }); 574 } 575 576 template void OutputSection::writeHeaderTo<ELF32LE>(ELF32LE::Shdr *Shdr); 577 template void OutputSection::writeHeaderTo<ELF32BE>(ELF32BE::Shdr *Shdr); 578 template void OutputSection::writeHeaderTo<ELF64LE>(ELF64LE::Shdr *Shdr); 579 template void OutputSection::writeHeaderTo<ELF64BE>(ELF64BE::Shdr *Shdr); 580 581 template void OutputSection::writeTo<ELF32LE>(uint8_t *Buf); 582 template void OutputSection::writeTo<ELF32BE>(uint8_t *Buf); 583 template void OutputSection::writeTo<ELF64LE>(uint8_t *Buf); 584 template void OutputSection::writeTo<ELF64BE>(uint8_t *Buf); 585 586 template void OutputSection::maybeCompress<ELF32LE>(); 587 template void OutputSection::maybeCompress<ELF32BE>(); 588 template void OutputSection::maybeCompress<ELF64LE>(); 589 template void OutputSection::maybeCompress<ELF64BE>(); 590