1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 17:17:40 +03:00
This commit is contained in:
Rui Ueyama 2024-03-29 15:50:37 +09:00
parent 9d8b243e39
commit 6fe9bdc3db
5 changed files with 7 additions and 9 deletions

View File

@ -914,8 +914,6 @@ public:
void append(std::string path, std::string_view data);
private:
static constexpr i64 BLOCK_SIZE = 512;
TarWriter(FILE *out, std::string basedir) : out(out), basedir(basedir) {}
FILE *out = nullptr;

View File

@ -1,4 +1,4 @@
#define MOLD_VERSION "@mold_VERSION@"
#define MOLD_LIBDIR "@CMAKE_INSTALL_FULL_LIBDIR@"
#cmakedefine HAVE_MADVISE
#cmakedefine HAVE_MADVISE 1

View File

@ -6,6 +6,8 @@
namespace mold {
static constexpr i64 BLOCK_SIZE = 512;
// A tar file consists of one or more Ustar header followed by data.
// Each Ustar header represents a single file in an archive.
//
@ -34,7 +36,7 @@ struct UstarHeader {
char pad[12];
};
static_assert(sizeof(UstarHeader) == 512);
static_assert(sizeof(UstarHeader) == BLOCK_SIZE);
static void finalize(UstarHeader &hdr) {
memset(hdr.checksum, ' ', sizeof(hdr.checksum));
@ -79,7 +81,6 @@ TarWriter::~TarWriter() {
void TarWriter::append(std::string path, std::string_view data) {
// Write PAX header
static_assert(sizeof(UstarHeader) == BLOCK_SIZE);
UstarHeader pax = {};
std::string attr = encode_path(basedir, path);

View File

@ -143,9 +143,8 @@ read_output_format(Context<E> &ctx, std::span<std::string_view> tok) {
template <typename E>
static bool is_in_sysroot(Context<E> &ctx, std::string path) {
std::string rel = to_abs_path(path)
.lexically_relative(to_abs_path(ctx.arg.sysroot))
.string();
std::filesystem::path sysroot = to_abs_path(ctx.arg.sysroot);
std::string rel = to_abs_path(path).lexically_relative(sysroot).string();
return rel != "." && !rel.starts_with("../");
}

View File

@ -721,7 +721,7 @@ std::vector<ObjectFile<E> *> do_lto(Context<E> &ctx) {
// given to the LTO backend. Such sections contains code and data for
// peripherails (typically GPUs).
for (ObjectFile<E> *file : ctx.objs) {
if (!file->is_lto_obj && file->is_gcc_offload_obj) {
if (file->is_alive && !file->is_lto_obj && file->is_gcc_offload_obj) {
PluginInputFile pfile = create_plugin_input_file(ctx, file->mf);
int claimed = false;
claim_file_hook(&pfile, &claimed);