From: Reva Cuthbertson <reva@cup.hp.com>
To: Andreas Schwab <schwab@suse.de>
Cc: amodra@bigpond.net.au, sje@cup.hp.com, binutils@sources.redhat.com
Subject: Re: copy_private_bfd_data in bfd/elf.c question
Date: Mon, 08 Jul 2002 14:16:00 -0000 [thread overview]
Message-ID: <3D29FFD0.F3E81228@cup.hp.com> (raw)
In-Reply-To: <jewusi3sdj.fsf@sykes.suse.de>
Andreas,
Thanks for the response! I just got back into the office
today and had a chance to dig further. It appears that
in bfd, the flags for the .hash section contain both
SEC_ALLOC and SEC_LOAD. Unfortunately, this is a problem
in assign_file_positions_for_segments() because we check
for SEC_LOAD first and we only check for SEC_ALLOC IF
SEC_LOAD was not set:
for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
{
asection *sec;
flagword flags;
bfd_size_type align;
sec = *secpp;
flags = sec->flags;
align = 1 << bfd_get_section_alignment (abfd, sec);
.
.
.
if (p->p_type == PT_LOAD)
{
bfd_signed_vma adjust;
if ((flags & SEC_LOAD) != 0)
{
adjust = sec->lma - (p->p_paddr + p->p_memsz);
if (adjust < 0)
adjust = 0;
}
else if ((flags & SEC_ALLOC) != 0)
{
/* The section VMA must equal the file position
modulo the page size. FIXME: I'm not sure if
this adjustment is really necessary. We used to
not have the SEC_LOAD case just above, and then
this was necessary, but now I'm not sure. */
if ((abfd->flags & D_PAGED) != 0)
adjust = (sec->vma - voff) % bed->maxpagesize;
else
adjust = (sec->vma - voff) % align;
}
In this code, if the flags for the .hash section did not include SEC_LOAD,
we would have executed the "else" statement and taken alignment into
account. However, for some reason the flags did include SEC_LOAD so
we never took alignment into account. I don't know where the flags
for the .hash section get set in bfd. In particular, I do not know why
the .hash section flags contain SEC_LOAD. Does this look right? If so,
shouldn't we take always take alignment into account when calculating
"adjust"?
Thanks!
Reva Cuthbertson
reva@cup.hp.com
Andreas Schwab wrote:
> Reva Cuthbertson <reva@cup.hp.com> writes:
>
> |> A fix that we came up with is to disable the code
> |> that sets p_paddr in copy_private_bfd_data(). We did
> |> this and it worked fine. The other thing I noticed
> |> is that the alignment specification for .hash is 8.
> |> We never check this value when calculating file
> |> position because that is only done of the section's
> |> flags include SEC_ALLOC which is not the case with
> |> the .hash section.
>
> That looks odd. The secion flags of .hash include SHF_ALLOC, which
> should be translated to SEC_ALLOC in BFD. If .hash isn't SEC_ALLOC then
> something is wrong here.
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
> Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
next prev parent reply other threads:[~2002-07-08 21:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-28 16:06 Reva Cuthbertson
2002-06-29 10:30 ` Andreas Schwab
2002-07-08 14:16 ` Reva Cuthbertson [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-07-23 9:13 Steve Ellcey
2002-07-23 9:43 ` Daniel Jacobowitz
2002-07-23 11:00 ` Nick Clifton
2002-07-16 16:04 Reva Cuthbertson
[not found] ` <m3vg7cvz6j.fsf@north-pole.nickc.cambridge.redhat.com>
[not found] ` <3D3C766C.91969D78@cup.hp.com>
2002-07-23 5:13 ` Nick Clifton
2002-06-24 8:49 Steve Ellcey
2002-06-21 8:26 Steve Ellcey
2002-06-21 9:28 ` Andreas Schwab
2002-06-22 4:56 ` Alan Modra
2002-06-22 12:23 ` Andreas Schwab
2002-06-22 22:05 ` Alan Modra
2002-06-22 22:11 ` Alan Modra
2002-06-20 10:14 Steve Ellcey
2002-06-20 20:54 ` Alan Modra
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=3D29FFD0.F3E81228@cup.hp.com \
--to=reva@cup.hp.com \
--cc=amodra@bigpond.net.au \
--cc=binutils@sources.redhat.com \
--cc=schwab@suse.de \
--cc=sje@cup.hp.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).