base: replace ELF flags bitfield with booleans

Instead of using a bitfield for storing rwx and skip boolean value,
take a boolean instead. This fixes a note giv]en by GCC 9.1 about
changes semantics of bitfields given as parameter by value on ARM.

Ref #4344
This commit is contained in:
Stefan Kalkowski 2021-12-13 11:07:56 +01:00 committed by Norman Feske
parent b11731d6b2
commit 2c569953d0
2 changed files with 9 additions and 9 deletions

View File

@ -42,10 +42,10 @@ class Genode::Elf_binary
/* special types */ /* special types */
struct Flags { struct Flags {
unsigned r:1; bool r { false };
unsigned w:1; bool w { false };
unsigned x:1; bool x { false };
unsigned skip:1; bool skip { false };
}; };
/** /**

View File

@ -78,7 +78,7 @@ Elf_segment Elf_binary::get_segment(unsigned num)
{ {
void *start; void *start;
size_t offset, filesz, memsz; size_t offset, filesz, memsz;
Elf_binary::Flags flags = { 0, 0, 0, 0 }; Elf_binary::Flags flags;
if (!valid()) return Elf_segment(); if (!valid()) return Elf_segment();
@ -91,16 +91,16 @@ Elf_segment Elf_binary::get_segment(unsigned num)
filesz = phdr->p_filesz; filesz = phdr->p_filesz;
memsz = phdr->p_memsz; memsz = phdr->p_memsz;
flags.r = (phdr->p_flags & PF_R) ? 1 : 0; flags.r = (phdr->p_flags & PF_R) ? true : false;
flags.w = (phdr->p_flags & PF_W) ? 1 : 0; flags.w = (phdr->p_flags & PF_W) ? true : false;
flags.x = (phdr->p_flags & PF_X) ? 1 : 0; flags.x = (phdr->p_flags & PF_X) ? true : false;
/* /*
* Skip loading of ELF segments that are not PT_LOAD or have no memory * Skip loading of ELF segments that are not PT_LOAD or have no memory
* size. * size.
*/ */
if (phdr->p_type != PT_LOAD || !memsz) if (phdr->p_type != PT_LOAD || !memsz)
flags.skip = 1; flags.skip = true;
return Elf_segment(this, start, offset, filesz, memsz, flags); return Elf_segment(this, start, offset, filesz, memsz, flags);
} }