bool ELFLinkingContext::validateImpl(raw_ostream &diagnostics) {
  switch (outputFileType()) {
  case LinkingContext::OutputFileType::YAML:
    _writer = createWriterYAML(*this);
    break;
  case LinkingContext::OutputFileType::Native:
    llvm_unreachable("Unimplemented");
    break;
  default:
    _writer = createWriterELF(this->targetHandler());
    break;
  }
  return true;
}
Example #2
0
bool ELFLinkingContext::validateImpl(raw_ostream &diagnostics) {
    switch (outputFileType()) {
    case LinkingContext::OutputFileType::YAML:
        _writer = createWriterYAML(*this);
        break;
    default:
        _writer = createWriterELF(*this);
        break;
    }

    // If -dead_strip, set up initial live symbols.
    if (deadStrip())
        addDeadStripRoot(entrySymbolName());
    return true;
}
Example #3
0
  llvm::Error writeFile(const lld::File &file, StringRef path) override {
    // Construct empty normalized file from atoms.
    llvm::Expected<std::unique_ptr<NormalizedFile>> nFile =
        normalized::normalizedFromAtoms(file, _ctx);
    if (auto ec = nFile.takeError())
      return ec;

    // For testing, write out yaml form of normalized file.
    if (_ctx.printAtoms()) {
      std::unique_ptr<Writer> yamlWriter = createWriterYAML(_ctx);
      if (auto ec = yamlWriter->writeFile(file, "-"))
        return ec;
    }

    // Write normalized file as mach-o binary.
    return writeBinary(*nFile->get(), path);
  }