27 lines
980 B
C++
27 lines
980 B
C++
#pragma once
|
|
|
|
#include "reloc_lowering.hpp"
|
|
|
|
#include <string>
|
|
#include <variant>
|
|
#include <vector>
|
|
|
|
namespace voidlibc::voidlink {
|
|
|
|
// Merge N independently-lowered objects into a single LoweredText.
|
|
//
|
|
// Code blobs are concatenated (16-byte aligned between objects).
|
|
// Data blobs are concatenated (8-byte aligned between objects).
|
|
// Symbol tables are unified: named defined symbols are deduplicated by name;
|
|
// anonymous defined symbols (e.g. section symbols) each get their own entry.
|
|
// Imports that are defined in any of the input objects are resolved internally
|
|
// — their sym_ids map to the defining object's global symbol entry.
|
|
// Truly external imports (undefined in all input objects) are kept as imports.
|
|
//
|
|
// Reloc dst_offsets are adjusted by the owning object's code_start.
|
|
// Reloc sym_ids are remapped to global symbol table indices.
|
|
std::variant<LoweredText, std::string>
|
|
merge_lowered(std::vector<LoweredText> objects);
|
|
|
|
} // namespace voidlibc::voidlink
|