Skip to content

Commit 16494b3

Browse files
authored
Fix clang 32bit builds (#261)
As already reported on the discord, 32bit with clang currently fail compiling: ![image](https://github.com/user-attachments/assets/2d486740-0430-4fc2-965d-01fb0ccc5b24) This is my attempt to fix this issue, without blindly static-casting to the target type.
1 parent c53fbb7 commit 16494b3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/binary/elf.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
CPPTRACE_BEGIN_NAMESPACE
1717
namespace detail {
18+
using Elf_Addr = std::uintptr_t;
19+
using Elf_Off = std::uintptr_t;
20+
using Elf_Xword = std::size_t;
21+
1822
// TODO: make methods const and a bunch of members mutable
1923
class elf {
2024
std::unique_ptr<base_file> file;
@@ -36,10 +40,10 @@ namespace detail {
3640
struct section_info {
3741
uint32_t sh_name;
3842
uint32_t sh_type;
39-
uint64_t sh_addr;
40-
uint64_t sh_offset;
41-
uint64_t sh_size;
42-
uint64_t sh_entsize;
43+
Elf_Addr sh_addr;
44+
Elf_Off sh_offset;
45+
Elf_Xword sh_size;
46+
Elf_Xword sh_entsize;
4347
uint32_t sh_link;
4448
};
4549
bool tried_to_load_sections = false;

0 commit comments

Comments
 (0)