Skip to content

Commit 0875d4b

Browse files
committed
elf: use 64bit elf headers when building in 64bit mode
1 parent 0af9ab2 commit 0875d4b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

include/elf.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ struct elfhdr {
99
ushort type;
1010
ushort machine;
1111
uint version;
12-
uint entry;
13-
uint phoff;
14-
uint shoff;
12+
uintp entry;
13+
uintp phoff;
14+
uintp shoff;
1515
uint flags;
1616
ushort ehsize;
1717
ushort phentsize;
@@ -22,6 +22,18 @@ struct elfhdr {
2222
};
2323

2424
// Program section header
25+
#if X64
26+
struct proghdr {
27+
uint32 type;
28+
uint32 flags;
29+
uint64 off;
30+
uint64 vaddr;
31+
uint64 paddr;
32+
uint64 filesz;
33+
uint64 memsz;
34+
uint64 align;
35+
};
36+
#else
2537
struct proghdr {
2638
uint type;
2739
uint off;
@@ -32,6 +44,7 @@ struct proghdr {
3244
uint flags;
3345
uint align;
3446
};
47+
#endif
3548

3649
// Values for Proghdr type
3750
#define ELF_PROG_LOAD 1

0 commit comments

Comments
 (0)