From 6fd76f26199f5baf4b4dbbf7958cb12ecfd6acbf Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 16 Dec 2021 13:04:46 +0900 Subject: [PATCH] [Mach-O] Fix build breakage on Alpine by renaming PAGE_SIZE PAGE_SIZE is sometimes defined by a header file as macro. This change renames it COMMON_PAGE_SIZE. Fixes https://github.com/rui314/mold/issues/142 --- macho/mold.h | 2 +- macho/output-chunks.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/macho/mold.h b/macho/mold.h index e47d1fc3..46d3b0df 100644 --- a/macho/mold.h +++ b/macho/mold.h @@ -13,7 +13,7 @@ namespace mold::macho { -static constexpr i64 PAGE_SIZE = 0x4000; +static constexpr i64 COMMON_PAGE_SIZE = 0x4000; static constexpr i64 SHA256_SIZE = 32; template class Chunk; diff --git a/macho/output-chunks.cc b/macho/output-chunks.cc index cd28e377..b7cc395b 100644 --- a/macho/output-chunks.cc +++ b/macho/output-chunks.cc @@ -484,12 +484,12 @@ void OutputSegment::set_offset(Context &ctx, i64 fileoff, u64 vmaddr) { vmaddr += sec.hdr.size; } - cmd.vmsize = align_to(vmaddr - cmd.vmaddr, PAGE_SIZE); + cmd.vmsize = align_to(vmaddr - cmd.vmaddr, COMMON_PAGE_SIZE); if (this == ctx.segments.back().get()) cmd.filesize = fileoff - cmd.fileoff; else - cmd.filesize = align_to(fileoff - cmd.fileoff, PAGE_SIZE); + cmd.filesize = align_to(fileoff - cmd.fileoff, COMMON_PAGE_SIZE); } template