From f945916f4343a4e9b01d52ee1d9d9a5c7096b0fe Mon Sep 17 00:00:00 2001 From: Rich Mattes Date: Sun, 2 Aug 2020 17:41:59 -0400 Subject: [PATCH] Fix build and add 32bit compat patch. Fix the cmake macros to work with the new cmake changes. Add a patch to correct the handling of file sizes with 32 bit size_t on 32 bit architectures. --- bloaty-1.1-longlong.patch | 18 ++++++++++++++++++ bloaty.spec | 10 ++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 bloaty-1.1-longlong.patch diff --git a/bloaty-1.1-longlong.patch b/bloaty-1.1-longlong.patch new file mode 100644 index 0000000..c511bb8 --- /dev/null +++ b/bloaty-1.1-longlong.patch @@ -0,0 +1,18 @@ +diff -up ./src/elf.cc.2 ./src/elf.cc +--- ./src/elf.cc.2 2020-08-02 17:34:06.872636546 -0400 ++++ ./src/elf.cc 2020-08-02 17:34:26.293491457 -0400 +@@ -794,12 +794,12 @@ void ForEachElf(const InputFile& file, R + // + // - 24 bits for index (up to 16M symbols with -ffunction-sections) + // - 40 bits for address (up to 1TB section) +-static uint64_t ToVMAddr(size_t addr, long ndx, bool is_object) { ++static uint64_t ToVMAddr(uint64_t addr, int64_t ndx, bool is_object) { + if (is_object) { + if (ndx >= 1 << 24) { + THROW("ndx overflow: too many sections"); + } +- if (addr >= 1UL << 40) { ++ if (addr >= 1ULL << 40) { + THROW("address overflow: section too big"); + } + return (ndx << 40) | addr; diff --git a/bloaty.spec b/bloaty.spec index 8fafb8f..f9c8277 100644 --- a/bloaty.spec +++ b/bloaty.spec @@ -9,6 +9,8 @@ URL: https://github.com/google/bloaty Source0: https://github.com/google/bloaty/archive/v%{version}/%{name}-%{version}.tar.gz # Patch to use system versions of abseil, google-test and google-mock Patch0: bloaty-1.1-absl.patch +# Patch to fix size detection function to use 64 bit types on 32bit architectures +Patch1: bloaty-1.1-longlong.patch BuildRequires: abseil-cpp-devel BuildRequires: capstone-devel @@ -30,7 +32,7 @@ libraries. Bloaty supports the ELF and Mach-O formats, and has experimental support for WebAssembly. %prep -%autosetup -S gendiff +%autosetup -p0 -S gendiff %build @@ -39,14 +41,14 @@ support for WebAssembly. -DBUILD_SHARED_LIBS=OFF \ -DBLOATY_ENABLE_CMAKETARGETS=OFF \ -DBUILD_TESTING=ON -%make_build +%cmake_build %install -%make_install +%cmake_install %check -make test +%ctest --verbose %files %license LICENSE