From e66db1307b3ac63f5adbacb3ec1465f74e6cdb55 Mon Sep 17 00:00:00 2001 From: tyfkda Date: Fri, 26 Apr 2024 11:10:01 +0900 Subject: [PATCH] Include config --- src/ld/ld.c | 2 ++ src/util/elfutil.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ld/ld.c b/src/ld/ld.c index 66a2c2830..af324d14f 100644 --- a/src/ld/ld.c +++ b/src/ld/ld.c @@ -1,3 +1,5 @@ +#include "../config.h" + #include #include #include diff --git a/src/util/elfutil.c b/src/util/elfutil.c index 9fd4ca4ef..5a7c65146 100644 --- a/src/util/elfutil.c +++ b/src/util/elfutil.c @@ -84,11 +84,11 @@ void out_elf_header(FILE *fp, uintptr_t entry, int phnum, int shnum, int flags) .e_shoff = 0, // dummy .e_flags = flags, .e_ehsize = sizeof(Elf64_Ehdr), - .e_phentsize = phnum > 0 ? sizeof(Elf64_Phdr) : 0, + .e_phentsize = sizeof(Elf64_Phdr), .e_phnum = phnum, - .e_shentsize = shnum > 0 ? sizeof(Elf64_Shdr) : 0, + .e_shentsize = sizeof(Elf64_Shdr), .e_shnum = shnum, - .e_shstrndx = shnum > 0 ? shnum - 1 : 0, + .e_shstrndx = shnum > 0 ? shnum - 1 : SHN_UNDEF, }; fwrite(&ehdr, sizeof(Elf64_Ehdr), 1, fp);