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