From a3d2a9ec92ad4406ccf51ff45a4a1d2aa16eaa69 Mon Sep 17 00:00:00 2001
From: Gabe Black <gabeblack@google.com>
Date: Tue, 1 Oct 2019 01:25:53 -0700
Subject: 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>
---
 src/base/loader/raw_object.hh | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src/base/loader/raw_object.hh')

diff --git a/src/base/loader/raw_object.hh b/src/base/loader/raw_object.hh
index 6931a1321..9eb929107 100644
--- a/src/base/loader/raw_object.hh
+++ b/src/base/loader/raw_object.hh
@@ -38,6 +38,9 @@ class RawObject: public ObjectFile
   protected:
     RawObject(const std::string &_filename, size_t _len,
               uint8_t *_data, Arch _arch, OpSys _opSys);
+
+    Segment *data;
+
   public:
     virtual ~RawObject() {}
 
-- 
cgit v1.2.3