chromium/base/debug/test_elf_image_builder.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "base/debug/test_elf_image_builder.h"

#include <cstring>
#include <string_view>
#include <type_traits>
#include <utility>

#include "base/bits.h"
#include "base/check.h"
#include "base/notreached.h"
#include "build/build_config.h"

#if __SIZEOF_POINTER__ == 4
using Dyn = Elf32_Dyn;
using Nhdr = Elf32_Nhdr;
using Shdr = Elf32_Shdr;
#else
Dyn;
Nhdr;
Shdr;
#endif

namespace base {

namespace {
// Sizes/alignments to use in the ELF image.
static constexpr size_t kPageSize =;
static constexpr size_t kPhdrAlign =;
static constexpr size_t kNoteAlign =;
static constexpr size_t kLoadAlign =;
static constexpr size_t kDynamicAlign =;
}  // namespace

struct TestElfImageBuilder::LoadSegment {};

TestElfImage::TestElfImage(std::vector<uint8_t> buffer, const void* elf_start)
    :{}

TestElfImage::~TestElfImage() = default;

TestElfImage::TestElfImage(TestElfImage&&) = default;

TestElfImage& TestElfImage::operator=(TestElfImage&&) = default;

TestElfImageBuilder::TestElfImageBuilder(MappingType mapping_type)
    :{}

TestElfImageBuilder::~TestElfImageBuilder() = default;

TestElfImageBuilder& TestElfImageBuilder::AddLoadSegment(Word flags,
                                                         size_t size) {}

TestElfImageBuilder& TestElfImageBuilder::AddNoteSegment(
    Word type,
    std::string_view name,
    span<const uint8_t> desc) {}

TestElfImageBuilder& TestElfImageBuilder::AddSoName(std::string_view soname) {}

struct TestElfImageBuilder::ImageMeasures {};

Addr TestElfImageBuilder::GetVirtualAddressForOffset(
    Off offset,
    const uint8_t* elf_start) const {}

TestElfImageBuilder::ImageMeasures TestElfImageBuilder::MeasureSizesAndOffsets()
    const {}

TestElfImage TestElfImageBuilder::Build() {}

// static
template <typename T>
uint8_t* TestElfImageBuilder::AppendHdr(const T& hdr, uint8_t* loc) {}

Ehdr TestElfImageBuilder::CreateEhdr(Half phnum) {}

Phdr TestElfImageBuilder::CreatePhdr(Word type,
                                     Word flags,
                                     size_t align,
                                     Off offset,
                                     Addr vaddr,
                                     size_t size) {}

}  // namespace base