From: Dave Brolley <brolley@redhat.com>
To: sid@sources.redhat.com
Subject: [patch] Elf Loader Section Table
Date: Thu, 26 Feb 2004 16:50:00 -0000 [thread overview]
Message-ID: <403E23CB.2010700@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
I've committed this patch which corrects a problem with table
reallocation in the new section table implementation. readElfFile was
giving out addresses into textSections which gets realloc'ed when full.
The addresses previously handed out then become invalid.
This patch changes the algorithm to allocate a separate section table
for each load and to give out the address only after the table has been
completed.
Dave
[-- Attachment #2: elfload-2.ChangeLog --]
[-- Type: text/plain, Size: 252 bytes --]
2004-02-26 Dave Brolley <brolley@redhat.com>
* 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.
[-- Attachment #3: elfload-2.patch.txt --]
[-- Type: text/plain, Size: 2474 bytes --]
Index: sid/component/loader/elfload.c
===================================================================
RCS file: /cvs/src/src/sid/component/loader/elfload.c,v
retrieving revision 1.7
diff -c -p -r1.7 elfload.c
*** sid/component/loader/elfload.c 23 Feb 2004 20:08:53 -0000 1.7
--- sid/component/loader/elfload.c 26 Feb 2004 16:10:24 -0000
*************** newLoadArea (int index)
*** 39,53 ****
}
}
! /* 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;
static void
newTextSection (int index)
{
- static textSectionNum = 0;
if (index >= textSectionNum)
{
textSectionNum = index + 10;
--- 39,52 ----
}
}
! /* 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)
{
if (index >= textSectionNum)
{
textSectionNum = index + 10;
*************** readElfFile (PFLOAD func, unsigned* entr
*** 204,211 ****
/* Look in the section table in order to determine which sections contain
code and which contain data. */
newTextSection (textSectionCount);
- *section_table = textSections + textSectionCount;
if (sixtyfourbit)
{
secOffset = fetchQuad (fileHeader+40, littleEndian);
--- 203,212 ----
/* 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);
if (sixtyfourbit)
{
secOffset = fetchQuad (fileHeader+40, littleEndian);
*************** readElfFile (PFLOAD func, unsigned* entr
*** 256,264 ****
/* Terminate this portion of the section table. */
textSections[textSectionCount].lbound = 0;
textSections[textSectionCount].hbound = 0;
- textSectionCount++;
*entry_point = entryPoint;
*little_endian = littleEndian;
return 1;
}
--- 257,266 ----
/* Terminate this portion of the section table. */
textSections[textSectionCount].lbound = 0;
textSections[textSectionCount].hbound = 0;
*entry_point = entryPoint;
*little_endian = littleEndian;
+ *section_table = textSections;
+
return 1;
}
reply other threads:[~2004-02-26 16:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=403E23CB.2010700@redhat.com \
--to=brolley@redhat.com \
--cc=sid@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).