From 1254df449eaf00f810bdb08fbd2f34b3d96115f1 Mon Sep 17 00:00:00 2001 From: brolley Date: Thu, 26 Feb 2004 16:44:40 +0000 Subject: [PATCH] 2004-02-26 Dave Brolley * elfload.c (textSectionNum): Now file level static. (readElfFile): Initialize textSections, textSectionNum and textSectionCount for each load. Set *section_table after all sections have been saved. --- sid/component/loader/ChangeLog | 7 +++++++ sid/component/loader/elfload.c | 16 +++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sid/component/loader/ChangeLog b/sid/component/loader/ChangeLog index c96e28d9e8..8ccbdbab34 100644 --- a/sid/component/loader/ChangeLog +++ b/sid/component/loader/ChangeLog @@ -1,3 +1,10 @@ +2004-02-26 Dave Brolley + + * elfload.c (textSectionNum): Now file level static. + (readElfFile): Initialize textSections, textSectionNum and + textSectionCount for each load. Set *section_table after all + sections have been saved. + 2004-02-23 Dave Brolley * elfload.c (readElfFile): Get address from offset 16 for 64 bit and diff --git a/sid/component/loader/elfload.c b/sid/component/loader/elfload.c index 67e496819c..a4eaf372b3 100644 --- a/sid/component/loader/elfload.c +++ b/sid/component/loader/elfload.c @@ -39,15 +39,14 @@ newLoadArea (int index) } } -/* The section table is kept for the duration of the simulation. - It is divided into sub tables, one for each loader in the system. */ -static int textSectionCount = 0; -static struct TextSection *textSections = 0; +/* A new section table is created for each loader in the system. */ +static struct TextSection *textSections; +static int textSectionCount; +static int textSectionNum; static void newTextSection (int index) { - static textSectionNum = 0; if (index >= textSectionNum) { textSectionNum = index + 10; @@ -204,8 +203,10 @@ readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struc /* Look in the section table in order to determine which sections contain code and which contain data. */ + textSections = 0; + textSectionNum = 0; + textSectionCount = 0; newTextSection (textSectionCount); - *section_table = textSections + textSectionCount; if (sixtyfourbit) { secOffset = fetchQuad (fileHeader+40, littleEndian); @@ -256,9 +257,10 @@ readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struc /* Terminate this portion of the section table. */ textSections[textSectionCount].lbound = 0; textSections[textSectionCount].hbound = 0; - textSectionCount++; *entry_point = entryPoint; *little_endian = littleEndian; + *section_table = textSections; + return 1; } -- 2.11.0