Lines Matching +defs:buffer +defs:file +defs:name

47 // The writer writes a SymbolTable result to a file.
52 Writer(Ctx &ctx) : ctx(ctx), buffer(ctx.e.outputBuffer), tc(ctx) {}
84 std::unique_ptr<FileOutputBuffer> &buffer;
146 static Defined *addOptionalRegular(Ctx &ctx, StringRef name, SectionBase *sec,
148 Symbol *s = ctx.symtab->find(name);
164 auto addAbsolute = [&](StringRef name) {
166 ctx.symtab->addSymbol(Defined{ctx, ctx.internalFile, name, STB_GLOBAL,
210 ErrAlways(ctx) << s->file << " cannot redefine linker defined symbol '"
225 // __ehdr_start is the location of ELF file headers. Note that we define
263 for (auto [i, sec] : llvm::enumerate(sym.file->getSections()))
268 Undefined(sym.file, sym.getName(), binding, sym.stOther, sym.type,
290 demoteDefined(*d, sectionIndexMap[d->file]);
293 if (sym->isLazy() || (s && !cast<SharedFile>(s->file)->isNeeded)) {
309 static OutputSection *findSection(Ctx &ctx, StringRef name,
313 if (osd->osec.name == name && osd->osec.partition == partition)
351 // fails, for example, due to an erroneous file size.
361 // It does not make sense try to open the file if we have error already.
366 llvm::TimeTraceScope timeScope("Write output file");
367 // Write the result down to a file.
382 // because the content is usually a hash value of the entire output file.
388 if (auto e = buffer->commit())
389 Err(ctx) << "failed to write output '" << buffer->getPath()
399 static void markUsedLocalSymbolsImpl(ObjFile<ELFT> *file,
402 Symbol &sym = file->getRelocTargetSym(rel);
415 for (ELFFileBase *file : ctx.objectFiles) {
416 ObjFile<ELFT> *f = cast<ObjFile<ELFT>>(file);
429 Symbol &sym = file->getSymbol(r.r_symidx);
495 for (ELFFileBase *file : ctx.objectFiles) {
497 for (Symbol *b : file->getLocalSymbols()) {
550 ctx.in.symTab->addSymbol(makeDefined(ctx, isec->file, "", STB_LOCAL,
607 if (sec->name == ".toc")
623 if (sec->name == ".dynamic")
630 StringRef s = sec->name;
644 // section should be placed in the file. Instead of using simple
670 if (ctx.arg.sectionStartMap.count(osec.name))
683 // program headers at the start of the file.
708 else if (osec.name == ".interp")
711 // included in a truncate core file. In particular, .note.gnu.build-id, if
712 // available, can identify the object file.
757 StringRef name = osec.name;
758 if (name == ".got")
760 else if (name == ".toc")
765 if (osec.name != ".got")
776 StringRef name = osec.name;
777 if (name == ".sdata" || (osec.type == SHT_NOBITS && name != ".sbss"))
793 return ctx.arg.sectionStartMap.lookup(a->name) <
794 ctx.arg.sectionStartMap.lookup(b->name);
819 std::string name = ctx.arg.isRela ? "__rela_iplt_start" : "__rel_iplt_start";
821 addOptionalRegular(ctx, name, ctx.out.elfHeader.get(), 0, STV_HIDDEN);
822 name.replace(name.size() - 5, 5, "end");
824 addOptionalRegular(ctx, name, ctx.out.elfHeader.get(), 0, STV_HIDDEN);
950 return assign->name != ".";
960 // Place non-alloc orphan sections at the end. This matches how we assign file
1029 // specifies the start of the file, but doesn't care about the end (the non
1050 if (patAndSeed.first.match(sec->name))
1065 if (patAndSeed.first.match(sec->name))
1079 // If both --symbol-ordering-file and call graph profile are present, the order
1080 // file takes precedence, but the call graph profile is still used for symbols
1081 // that don't appear in the order file.
1096 // appear in the symbol ordering file have the lowest priority 0.
1126 for (ELFFileBase *file : ctx.objectFiles)
1127 for (Symbol *sym : file->getLocalSymbols())
1133 Warn(ctx) << "symbol ordering file: no such symbol: "
1217 StringRef name = osec.name;
1220 if (name == ".init" || name == ".fini")
1224 // --symbol-ordering-file or --shuffle-sections=. This is a least significant
1235 if (name == ".init_array" || name == ".fini_array") {
1237 } else if (name == ".ctors" || name == ".dtors") {
1239 } else if (ctx.arg.emachine == EM_PPC64 && name == ".toc") {
1249 return a->file->ppc64SmallCodeModelTocRelocs &&
1250 !b->file->ppc64SmallCodeModelTocRelocs;
1305 // not explicitly placed into the output file by the linker script.
1444 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name);
1450 StringRef s = sec->name;
1587 << ") of section '" << changes.first->name
1613 << ") of section " << osec->name
1692 numDeleted += ctx.target->deleteFallThruJmpInsn(sec, sec.file, next);
1771 // addresses of each section by section name. Add such symbols.
1895 for (SharedFile *file : ctx.sharedFiles) {
1897 llvm::all_of(file->dtNeeded, [&](StringRef needed) {
1902 for (Symbol *sym : file->requiredSymbols) {
1908 << file << " (disallowed by --no-allow-shlib-undefined)";
1912 << "non-exported symbol '" << sym << "' in '" << sym->file
1913 << "' is referenced by DSO '" << file << "'";
1936 if (auto *file = dyn_cast<SharedFile>(sym->file))
1937 if (file->isNeeded && !sym->isUndefined())
1976 osec->shName = ctx.in.shStrTab->addString(osec->name);
1981 auto i = ctx.arg.sectionStartMap.find(sec->name);
2118 // All information needed for OutputSection part of Map file is available.
2164 ErrAlways(ctx) << "cannot place " << isec << " into " << osec->name
2200 // If a section name is valid as a C identifier (which is rare because of
2207 StringRef s = osec.name;
2297 ErrAlways(ctx) << "section: " << sec->name
2335 // supposed-to-be-NOBITS section to the output file. (However, we cannot do
2470 // padding in the file contents.
2478 // sections will be extracted to a separate file. Align to the next
2526 // Compute an in-file position for a given section. The file offset must be the
2545 // If two sections share the same PT_LOAD the file offset is calculated
2576 // Assign file offsets to output sections.
2588 // will not occupy file offsets contained by a PT_LOAD.
2599 // following section to avoid loading non-segments parts of the file.
2616 // With use of linker scripts it is possible to violate this rule and get file
2623 // we want to prevent file size overflows because it would crash the linker.
2628 ErrAlways(ctx) << "unable to place section " << sec->name
2629 << " at file offset "
2636 // file offsets and VAs to all sections.
2687 // Check whether sections overlap for a specific address range (file offsets,
2689 static void checkOverlap(Ctx &ctx, StringRef name,
2709 Err(ctx) << "section " << a.sec->name << " " << name
2710 << " range overlaps with " << b.sec->name << "\n>>> "
2711 << a.sec->name << " range is "
2712 << rangeToString(a.offset, a.sec->size) << "\n>>> " << b.sec->name
2720 // file offsets. For SHF_ALLOC sections we also check that the load address
2727 Err(ctx) << "section " << os->name << " at 0x"
2732 // Check for overlapping file offsets. In this case we need to skip any
2734 // the file so Sec->Offset + Sec->Size can overlap with others. If --oformat
2736 // file so we skip any non-allocated sections in that case.
2742 checkOverlap(ctx, "file", fileOffs, false);
2754 // ranges in the file.
2844 // Open a result file.
2850 s << "output file too large: " << fileSize << " bytes\n"
2853 s << os->name << ' ' << os->size << "\n";
2872 buffer = std::move(*bufferOrErr);
2873 ctx.bufferStart = buffer->getBufferStart();
2906 // Round up the file size of the last segment to the page boundary iff it is
2908 // trim the instruction padding (e.g. when stripping the file).
2920 // Write section contents to a mmap'ed file.
2965 // Write to the final output buffer.
2979 // Compute a hash of all sections of the output file.