arch, base: Stop assuming object files have three segments.
authorGabe Black <gabeblack@google.com>
Tue, 1 Oct 2019 08:25:53 +0000 (01:25 -0700)
committerGabe Black <gabeblack@google.com>
Thu, 10 Oct 2019 01:25:17 +0000 (01:25 +0000)
commita3d2a9ec92ad4406ccf51ff45a4a1d2aa16eaa69
tree6ced63b62e070382a4c517bf63c0b4625a6aa433
parent70f66f77942872ace0af50170dcbb68ef2311095
arch, base: Stop assuming object files have three segments.

The ObjectFile class has hardcoded assumptions that there are three
segments, text, bss and data. There are some files which have one
"segment" like raw files, where the entire file's contents are
considered a single segment. There are also ELF files which can have
an arbitrary number of segments, and those segments can hold any
number of sections, including the text, data and/or bss sections.

Removing this assumption frees up some object file formats from having
to twist themselves to fit in that structure, possibly introducing
ambiguities when some segments may fulfill multiple roles.

Change-Id: I976e06a3a90ef852b17a6485e2595b006b2090d5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21463
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
23 files changed:
src/arch/alpha/process.cc
src/arch/alpha/system.cc
src/arch/arm/freebsd/system.cc
src/arch/arm/linux/system.cc
src/arch/arm/process.cc
src/arch/mips/process.cc
src/arch/power/process.cc
src/arch/riscv/process.cc
src/arch/sparc/process.hh
src/arch/sparc/system.cc
src/arch/x86/process.cc
src/base/loader/aout_object.cc
src/base/loader/dtb_object.cc
src/base/loader/dtb_object.hh
src/base/loader/ecoff_object.cc
src/base/loader/elf_object.cc
src/base/loader/elf_object.hh
src/base/loader/object_file.cc
src/base/loader/object_file.hh
src/base/loader/raw_object.cc
src/base/loader/raw_object.hh
src/sim/syscall_emul.hh
src/sim/system.cc