1 //===- OutputSections.cpp -------------------------------------------------===// 2 // 3 // The LLVM Linker 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "OutputSections.h" 11 #include "Config.h" 12 #include "LinkerScript.h" 13 #include "Memory.h" 14 #include "Strings.h" 15 #include "SymbolTable.h" 16 #include "SyntheticSections.h" 17 #include "Target.h" 18 #include "Threads.h" 19 #include "llvm/BinaryFormat/Dwarf.h" 20 #include "llvm/Support/Compression.h" 21 #include "llvm/Support/MD5.h" 22 #include "llvm/Support/MathExtras.h" 23 #include "llvm/Support/SHA1.h" 24 25 using namespace llvm; 26 using namespace llvm::dwarf; 27 using namespace llvm::object; 28 using namespace llvm::support::endian; 29 using namespace llvm::ELF; 30 31 using namespace lld; 32 using namespace lld::elf; 33 34 uint8_t Out::First; 35 OutputSection *Out::Opd; 36 uint8_t *Out::OpdBuf; 37 PhdrEntry *Out::TlsPhdr; 38 OutputSection *Out::DebugInfo; 39 OutputSection *Out::ElfHeader; 40 OutputSection *Out::ProgramHeaders; 41 OutputSection *Out::PreinitArray; 42 OutputSection *Out::InitArray; 43 OutputSection *Out::FiniArray; 44 45 std::vector<OutputSection *> elf::OutputSections; 46 47 uint32_t OutputSection::getPhdrFlags() const { 48 uint32_t Ret = PF_R; 49 if (Flags & SHF_WRITE) 50 Ret |= PF_W; 51 if (Flags & SHF_EXECINSTR) 52 Ret |= PF_X; 53 return Ret; 54 } 55 56 template <class ELFT> 57 void OutputSection::writeHeaderTo(typename ELFT::Shdr *Shdr) { 58 Shdr->sh_entsize = Entsize; 59 Shdr->sh_addralign = Alignment; 60 Shdr->sh_type = Type; 61 Shdr->sh_offset = Offset; 62 Shdr->sh_flags = Flags; 63 Shdr->sh_info = Info; 64 Shdr->sh_link = Link; 65 Shdr->sh_addr = Addr; 66 Shdr->sh_size = Size; 67 Shdr->sh_name = ShName; 68 } 69 70 OutputSection::OutputSection(StringRef Name, uint32_t Type, uint64_t Flags) 71 : BaseCommand(OutputSectionKind), 72 SectionBase(Output, Name, Flags, /*Entsize*/ 0, /*Alignment*/ 1, Type, 73 /*Info*/ 0, 74 /*Link*/ 0), 75 SectionIndex(INT_MAX) { 76 Live = false; 77 } 78 79 static uint64_t updateOffset(uint64_t Off, InputSection *S) { 80 Off = alignTo(Off, S->Alignment); 81 S->OutSecOff = Off; 82 return Off + S->getSize(); 83 } 84 85 void OutputSection::addSection(InputSection *S) { 86 assert(S->Live); 87 Live = true; 88 S->Parent = this; 89 this->updateAlignment(S->Alignment); 90 91 // The actual offsets will be computed by assignAddresses. For now, use 92 // crude approximation so that it is at least easy for other code to know the 93 // section order. It is also used to calculate the output section size early 94 // for compressed debug sections. 95 this->Size = updateOffset(Size, S); 96 97 // If this section contains a table of fixed-size entries, sh_entsize 98 // holds the element size. Consequently, if this contains two or more 99 // input sections, all of them must have the same sh_entsize. However, 100 // you can put different types of input sections into one output 101 // sectin by using linker scripts. I don't know what to do here. 102 // Probably we sholuld handle that as an error. But for now we just 103 // pick the largest sh_entsize. 104 this->Entsize = std::max(this->Entsize, S->Entsize); 105 106 if (!S->Assigned) { 107 S->Assigned = true; 108 if (Commands.empty() || !isa<InputSectionDescription>(Commands.back())) 109 Commands.push_back(make<InputSectionDescription>("")); 110 auto *ISD = cast<InputSectionDescription>(Commands.back()); 111 ISD->Sections.push_back(S); 112 } 113 } 114 115 static SectionKey createKey(InputSectionBase *C, StringRef OutsecName) { 116 // The ELF spec just says 117 // ---------------------------------------------------------------- 118 // In the first phase, input sections that match in name, type and 119 // attribute flags should be concatenated into single sections. 120 // ---------------------------------------------------------------- 121 // 122 // However, it is clear that at least some flags have to be ignored for 123 // section merging. At the very least SHF_GROUP and SHF_COMPRESSED have to be 124 // ignored. We should not have two output .text sections just because one was 125 // in a group and another was not for example. 126 // 127 // It also seems that that wording was a late addition and didn't get the 128 // necessary scrutiny. 129 // 130 // Merging sections with different flags is expected by some users. One 131 // reason is that if one file has 132 // 133 // int *const bar __attribute__((section(".foo"))) = (int *)0; 134 // 135 // gcc with -fPIC will produce a read only .foo section. But if another 136 // file has 137 // 138 // int zed; 139 // int *const bar __attribute__((section(".foo"))) = (int *)&zed; 140 // 141 // gcc with -fPIC will produce a read write section. 142 // 143 // Last but not least, when using linker script the merge rules are forced by 144 // the script. Unfortunately, linker scripts are name based. This means that 145 // expressions like *(.foo*) can refer to multiple input sections with 146 // different flags. We cannot put them in different output sections or we 147 // would produce wrong results for 148 // 149 // start = .; *(.foo.*) end = .; *(.bar) 150 // 151 // and a mapping of .foo1 and .bar1 to one section and .foo2 and .bar2 to 152 // another. The problem is that there is no way to layout those output 153 // sections such that the .foo sections are the only thing between the start 154 // and end symbols. 155 // 156 // Given the above issues, we instead merge sections by name and error on 157 // incompatible types and flags. 158 159 uint32_t Alignment = 0; 160 uint64_t Flags = 0; 161 if (Config->Relocatable && (C->Flags & SHF_MERGE)) { 162 Alignment = std::max<uint64_t>(C->Alignment, C->Entsize); 163 Flags = C->Flags & (SHF_MERGE | SHF_STRINGS); 164 } 165 166 return SectionKey{OutsecName, Flags, Alignment}; 167 } 168 169 OutputSectionFactory::OutputSectionFactory() {} 170 171 static uint64_t getIncompatibleFlags(uint64_t Flags) { 172 return Flags & (SHF_ALLOC | SHF_TLS); 173 } 174 175 // We allow sections of types listed below to merged into a 176 // single progbits section. This is typically done by linker 177 // scripts. Merging nobits and progbits will force disk space 178 // to be allocated for nobits sections. Other ones don't require 179 // any special treatment on top of progbits, so there doesn't 180 // seem to be a harm in merging them. 181 static bool canMergeToProgbits(unsigned Type) { 182 return Type == SHT_NOBITS || Type == SHT_PROGBITS || Type == SHT_INIT_ARRAY || 183 Type == SHT_PREINIT_ARRAY || Type == SHT_FINI_ARRAY || 184 Type == SHT_NOTE; 185 } 186 187 void elf::sortByOrder(MutableArrayRef<InputSection *> In, 188 std::function<int(InputSectionBase *S)> Order) { 189 typedef std::pair<int, InputSection *> Pair; 190 auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; }; 191 192 std::vector<Pair> V; 193 for (InputSection *S : In) 194 V.push_back({Order(S), S}); 195 std::stable_sort(V.begin(), V.end(), Comp); 196 197 for (size_t I = 0; I < V.size(); ++I) 198 In[I] = V[I].second; 199 } 200 201 void elf::reportDiscarded(InputSectionBase *IS) { 202 if (!Config->PrintGcSections) 203 return; 204 message("removing unused section from '" + IS->Name + "' in file '" + 205 IS->File->getName() + "'"); 206 } 207 208 void OutputSectionFactory::addInputSec(InputSectionBase *IS, 209 StringRef OutsecName) { 210 // Sections with the SHT_GROUP attribute reach here only when the - r option 211 // is given. Such sections define "section groups", and InputFiles.cpp has 212 // dedup'ed section groups by their signatures. For the -r, we want to pass 213 // through all SHT_GROUP sections without merging them because merging them 214 // creates broken section contents. 215 if (IS->Type == SHT_GROUP) { 216 OutputSection *Out = nullptr; 217 addInputSec(IS, OutsecName, Out); 218 return; 219 } 220 221 // Imagine .zed : { *(.foo) *(.bar) } script. Both foo and bar may have 222 // relocation sections .rela.foo and .rela.bar for example. Most tools do 223 // not allow multiple REL[A] sections for output section. Hence we 224 // should combine these relocation sections into single output. 225 // We skip synthetic sections because it can be .rela.dyn/.rela.plt or any 226 // other REL[A] sections created by linker itself. 227 if (!isa<SyntheticSection>(IS) && 228 (IS->Type == SHT_REL || IS->Type == SHT_RELA)) { 229 auto *Sec = cast<InputSection>(IS); 230 OutputSection *Out = Sec->getRelocatedSection()->getOutputSection(); 231 addInputSec(IS, OutsecName, Out->RelocationSection); 232 return; 233 } 234 235 SectionKey Key = createKey(IS, OutsecName); 236 OutputSection *&Sec = Map[Key]; 237 addInputSec(IS, OutsecName, Sec); 238 } 239 240 void OutputSectionFactory::addInputSec(InputSectionBase *IS, 241 StringRef OutsecName, 242 OutputSection *&Sec) { 243 if (!IS->Live) { 244 reportDiscarded(IS); 245 return; 246 } 247 248 if (Sec && Sec->Live) { 249 if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(IS->Flags)) 250 error("incompatible section flags for " + Sec->Name + "\n>>> " + 251 toString(IS) + ": 0x" + utohexstr(IS->Flags) + 252 "\n>>> output section " + Sec->Name + ": 0x" + 253 utohexstr(Sec->Flags)); 254 if (Sec->Type != IS->Type) { 255 if (canMergeToProgbits(Sec->Type) && canMergeToProgbits(IS->Type)) 256 Sec->Type = SHT_PROGBITS; 257 else 258 error("section type mismatch for " + IS->Name + "\n>>> " + 259 toString(IS) + ": " + 260 getELFSectionTypeName(Config->EMachine, IS->Type) + 261 "\n>>> output section " + Sec->Name + ": " + 262 getELFSectionTypeName(Config->EMachine, Sec->Type)); 263 } 264 Sec->Flags |= IS->Flags; 265 } else { 266 if (!Sec) { 267 Sec = Script->createOutputSection(OutsecName, "<internal>"); 268 Script->Opt.Commands.push_back(Sec); 269 } 270 Sec->Type = IS->Type; 271 Sec->Flags = IS->Flags; 272 } 273 274 Sec->addSection(cast<InputSection>(IS)); 275 } 276 277 OutputSectionFactory::~OutputSectionFactory() {} 278 279 SectionKey DenseMapInfo<SectionKey>::getEmptyKey() { 280 return SectionKey{DenseMapInfo<StringRef>::getEmptyKey(), 0, 0}; 281 } 282 283 SectionKey DenseMapInfo<SectionKey>::getTombstoneKey() { 284 return SectionKey{DenseMapInfo<StringRef>::getTombstoneKey(), 0, 0}; 285 } 286 287 unsigned DenseMapInfo<SectionKey>::getHashValue(const SectionKey &Val) { 288 return hash_combine(Val.Name, Val.Flags, Val.Alignment); 289 } 290 291 bool DenseMapInfo<SectionKey>::isEqual(const SectionKey &LHS, 292 const SectionKey &RHS) { 293 return DenseMapInfo<StringRef>::isEqual(LHS.Name, RHS.Name) && 294 LHS.Flags == RHS.Flags && LHS.Alignment == RHS.Alignment; 295 } 296 297 uint64_t elf::getHeaderSize() { 298 if (Config->OFormatBinary) 299 return 0; 300 return Out::ElfHeader->Size + Out::ProgramHeaders->Size; 301 } 302 303 bool OutputSection::classof(const BaseCommand *C) { 304 return C->Kind == OutputSectionKind; 305 } 306 307 void OutputSection::sort(std::function<int(InputSectionBase *S)> Order) { 308 assert(Commands.size() == 1); 309 sortByOrder(cast<InputSectionDescription>(Commands[0])->Sections, Order); 310 } 311 312 // Fill [Buf, Buf + Size) with Filler. 313 // This is used for linker script "=fillexp" command. 314 static void fill(uint8_t *Buf, size_t Size, uint32_t Filler) { 315 size_t I = 0; 316 for (; I + 4 < Size; I += 4) 317 memcpy(Buf + I, &Filler, 4); 318 memcpy(Buf + I, &Filler, Size - I); 319 } 320 321 // Compress section contents if this section contains debug info. 322 template <class ELFT> void OutputSection::maybeCompress() { 323 typedef typename ELFT::Chdr Elf_Chdr; 324 325 // Compress only DWARF debug sections. 326 if (!Config->CompressDebugSections || (Flags & SHF_ALLOC) || 327 !Name.startswith(".debug_")) 328 return; 329 330 // Create a section header. 331 ZDebugHeader.resize(sizeof(Elf_Chdr)); 332 auto *Hdr = reinterpret_cast<Elf_Chdr *>(ZDebugHeader.data()); 333 Hdr->ch_type = ELFCOMPRESS_ZLIB; 334 Hdr->ch_size = Size; 335 Hdr->ch_addralign = Alignment; 336 337 // Write section contents to a temporary buffer and compress it. 338 std::vector<uint8_t> Buf(Size); 339 writeTo<ELFT>(Buf.data()); 340 if (Error E = zlib::compress(toStringRef(Buf), CompressedData)) 341 fatal("compress failed: " + llvm::toString(std::move(E))); 342 343 // Update section headers. 344 Size = sizeof(Elf_Chdr) + CompressedData.size(); 345 Flags |= SHF_COMPRESSED; 346 } 347 348 static void writeInt(uint8_t *Buf, uint64_t Data, uint64_t Size) { 349 if (Size == 1) 350 *Buf = Data; 351 else if (Size == 2) 352 write16(Buf, Data, Config->Endianness); 353 else if (Size == 4) 354 write32(Buf, Data, Config->Endianness); 355 else if (Size == 8) 356 write64(Buf, Data, Config->Endianness); 357 else 358 llvm_unreachable("unsupported Size argument"); 359 } 360 361 template <class ELFT> void OutputSection::writeTo(uint8_t *Buf) { 362 if (Type == SHT_NOBITS) 363 return; 364 365 Loc = Buf; 366 367 // If -compress-debug-section is specified and if this is a debug seciton, 368 // we've already compressed section contents. If that's the case, 369 // just write it down. 370 if (!CompressedData.empty()) { 371 memcpy(Buf, ZDebugHeader.data(), ZDebugHeader.size()); 372 memcpy(Buf + ZDebugHeader.size(), CompressedData.data(), 373 CompressedData.size()); 374 return; 375 } 376 377 // Write leading padding. 378 std::vector<InputSection *> Sections; 379 for (BaseCommand *Cmd : Commands) 380 if (auto *ISD = dyn_cast<InputSectionDescription>(Cmd)) 381 for (InputSection *IS : ISD->Sections) 382 if (IS->Live) 383 Sections.push_back(IS); 384 uint32_t Filler = getFiller(); 385 if (Filler) 386 fill(Buf, Sections.empty() ? Size : Sections[0]->OutSecOff, Filler); 387 388 parallelForEachN(0, Sections.size(), [=](size_t I) { 389 InputSection *IS = Sections[I]; 390 IS->writeTo<ELFT>(Buf); 391 392 // Fill gaps between sections. 393 if (Filler) { 394 uint8_t *Start = Buf + IS->OutSecOff + IS->getSize(); 395 uint8_t *End; 396 if (I + 1 == Sections.size()) 397 End = Buf + Size; 398 else 399 End = Buf + Sections[I + 1]->OutSecOff; 400 fill(Start, End - Start, Filler); 401 } 402 }); 403 404 // Linker scripts may have BYTE()-family commands with which you 405 // can write arbitrary bytes to the output. Process them if any. 406 for (BaseCommand *Base : Commands) 407 if (auto *Data = dyn_cast<BytesDataCommand>(Base)) 408 writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size); 409 } 410 411 static bool compareByFilePosition(InputSection *A, InputSection *B) { 412 // Synthetic doesn't have link order dependecy, stable_sort will keep it last 413 if (A->kind() == InputSectionBase::Synthetic || 414 B->kind() == InputSectionBase::Synthetic) 415 return false; 416 InputSection *LA = A->getLinkOrderDep(); 417 InputSection *LB = B->getLinkOrderDep(); 418 OutputSection *AOut = LA->getParent(); 419 OutputSection *BOut = LB->getParent(); 420 if (AOut != BOut) 421 return AOut->SectionIndex < BOut->SectionIndex; 422 return LA->OutSecOff < LB->OutSecOff; 423 } 424 425 template <class ELFT> 426 static void finalizeShtGroup(OutputSection *OS, 427 ArrayRef<InputSection *> Sections) { 428 assert(Config->Relocatable && Sections.size() == 1); 429 430 // sh_link field for SHT_GROUP sections should contain the section index of 431 // the symbol table. 432 OS->Link = InX::SymTab->getParent()->SectionIndex; 433 434 // sh_info then contain index of an entry in symbol table section which 435 // provides signature of the section group. 436 ObjFile<ELFT> *Obj = Sections[0]->getFile<ELFT>(); 437 ArrayRef<SymbolBody *> Symbols = Obj->getSymbols(); 438 OS->Info = InX::SymTab->getSymbolIndex(Symbols[Sections[0]->Info]); 439 } 440 441 template <class ELFT> void OutputSection::finalize() { 442 // Link order may be distributed across several InputSectionDescriptions 443 // but sort must consider them all at once. 444 std::vector<InputSection **> ScriptSections; 445 std::vector<InputSection *> Sections; 446 for (BaseCommand *Base : Commands) 447 if (auto *ISD = dyn_cast<InputSectionDescription>(Base)) 448 for (InputSection *&IS : ISD->Sections) { 449 ScriptSections.push_back(&IS); 450 Sections.push_back(IS); 451 } 452 453 if ((Flags & SHF_LINK_ORDER)) { 454 std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition); 455 for (int I = 0, N = Sections.size(); I < N; ++I) 456 *ScriptSections[I] = Sections[I]; 457 458 // We must preserve the link order dependency of sections with the 459 // SHF_LINK_ORDER flag. The dependency is indicated by the sh_link field. We 460 // need to translate the InputSection sh_link to the OutputSection sh_link, 461 // all InputSections in the OutputSection have the same dependency. 462 if (auto *D = Sections.front()->getLinkOrderDep()) 463 Link = D->getParent()->SectionIndex; 464 } 465 466 if (Type == SHT_GROUP) { 467 finalizeShtGroup<ELFT>(this, Sections); 468 return; 469 } 470 471 if (!Config->CopyRelocs || (Type != SHT_RELA && Type != SHT_REL)) 472 return; 473 474 InputSection *First = Sections[0]; 475 if (isa<SyntheticSection>(First)) 476 return; 477 478 Link = InX::SymTab->getParent()->SectionIndex; 479 // sh_info for SHT_REL[A] sections should contain the section header index of 480 // the section to which the relocation applies. 481 InputSectionBase *S = First->getRelocatedSection(); 482 Info = S->getOutputSection()->SectionIndex; 483 Flags |= SHF_INFO_LINK; 484 } 485 486 // Returns true if S matches /Filename.?\.o$/. 487 static bool isCrtBeginEnd(StringRef S, StringRef Filename) { 488 if (!S.endswith(".o")) 489 return false; 490 S = S.drop_back(2); 491 if (S.endswith(Filename)) 492 return true; 493 return !S.empty() && S.drop_back().endswith(Filename); 494 } 495 496 static bool isCrtbegin(StringRef S) { return isCrtBeginEnd(S, "crtbegin"); } 497 static bool isCrtend(StringRef S) { return isCrtBeginEnd(S, "crtend"); } 498 499 // .ctors and .dtors are sorted by this priority from highest to lowest. 500 // 501 // 1. The section was contained in crtbegin (crtbegin contains 502 // some sentinel value in its .ctors and .dtors so that the runtime 503 // can find the beginning of the sections.) 504 // 505 // 2. The section has an optional priority value in the form of ".ctors.N" 506 // or ".dtors.N" where N is a number. Unlike .{init,fini}_array, 507 // they are compared as string rather than number. 508 // 509 // 3. The section is just ".ctors" or ".dtors". 510 // 511 // 4. The section was contained in crtend, which contains an end marker. 512 // 513 // In an ideal world, we don't need this function because .init_array and 514 // .ctors are duplicate features (and .init_array is newer.) However, there 515 // are too many real-world use cases of .ctors, so we had no choice to 516 // support that with this rather ad-hoc semantics. 517 static bool compCtors(const InputSection *A, const InputSection *B) { 518 bool BeginA = isCrtbegin(A->File->getName()); 519 bool BeginB = isCrtbegin(B->File->getName()); 520 if (BeginA != BeginB) 521 return BeginA; 522 bool EndA = isCrtend(A->File->getName()); 523 bool EndB = isCrtend(B->File->getName()); 524 if (EndA != EndB) 525 return EndB; 526 StringRef X = A->Name; 527 StringRef Y = B->Name; 528 assert(X.startswith(".ctors") || X.startswith(".dtors")); 529 assert(Y.startswith(".ctors") || Y.startswith(".dtors")); 530 X = X.substr(6); 531 Y = Y.substr(6); 532 if (X.empty() && Y.empty()) 533 return false; 534 return X < Y; 535 } 536 537 // Sorts input sections by the special rules for .ctors and .dtors. 538 // Unfortunately, the rules are different from the one for .{init,fini}_array. 539 // Read the comment above. 540 void OutputSection::sortCtorsDtors() { 541 assert(Commands.size() == 1); 542 auto *ISD = cast<InputSectionDescription>(Commands[0]); 543 std::stable_sort(ISD->Sections.begin(), ISD->Sections.end(), compCtors); 544 } 545 546 // If an input string is in the form of "foo.N" where N is a number, 547 // return N. Otherwise, returns 65536, which is one greater than the 548 // lowest priority. 549 int elf::getPriority(StringRef S) { 550 size_t Pos = S.rfind('.'); 551 if (Pos == StringRef::npos) 552 return 65536; 553 int V; 554 if (!to_integer(S.substr(Pos + 1), V, 10)) 555 return 65536; 556 return V; 557 } 558 559 // Sorts input sections by section name suffixes, so that .foo.N comes 560 // before .foo.M if N < M. Used to sort .{init,fini}_array.N sections. 561 // We want to keep the original order if the priorities are the same 562 // because the compiler keeps the original initialization order in a 563 // translation unit and we need to respect that. 564 // For more detail, read the section of the GCC's manual about init_priority. 565 void OutputSection::sortInitFini() { 566 // Sort sections by priority. 567 sort([](InputSectionBase *S) { return getPriority(S->Name); }); 568 } 569 570 uint32_t OutputSection::getFiller() { 571 if (Filler) 572 return *Filler; 573 if (Flags & SHF_EXECINSTR) 574 return Target->TrapInstr; 575 return 0; 576 } 577 578 template void OutputSection::writeHeaderTo<ELF32LE>(ELF32LE::Shdr *Shdr); 579 template void OutputSection::writeHeaderTo<ELF32BE>(ELF32BE::Shdr *Shdr); 580 template void OutputSection::writeHeaderTo<ELF64LE>(ELF64LE::Shdr *Shdr); 581 template void OutputSection::writeHeaderTo<ELF64BE>(ELF64BE::Shdr *Shdr); 582 583 template void OutputSection::writeTo<ELF32LE>(uint8_t *Buf); 584 template void OutputSection::writeTo<ELF32BE>(uint8_t *Buf); 585 template void OutputSection::writeTo<ELF64LE>(uint8_t *Buf); 586 template void OutputSection::writeTo<ELF64BE>(uint8_t *Buf); 587 588 template void OutputSection::maybeCompress<ELF32LE>(); 589 template void OutputSection::maybeCompress<ELF32BE>(); 590 template void OutputSection::maybeCompress<ELF64LE>(); 591 template void OutputSection::maybeCompress<ELF64BE>(); 592 593 template void OutputSection::finalize<ELF32LE>(); 594 template void OutputSection::finalize<ELF32BE>(); 595 template void OutputSection::finalize<ELF64LE>(); 596 template void OutputSection::finalize<ELF64BE>(); 597