[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: need ld fix in assign_file_positions_for_segments
From: |
|
Subject: |
Re: need ld fix in assign_file_positions_for_segments |
Date: |
Tue, 05 Jun 2001 02:04:18 -0000 |
User-agent: |
slrn/0.9.6.2 (Linux) |
On Sun, 3 Jun 2001 18:17:37 +0000,
Don Lindsay <address@hidden> wrote:
> /* The section may have artificial alignment forced by a
> link script. Notice this case by the gap between the
> cumulative phdr vma and the section's vma. */
> if (p->p_vaddr + p->p_memsz < sec->vma)
> {
> bfd_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
>
> p->p_memsz += adjust;
> ---> off += adjust;
> voff += adjust;
> if ((flags & SEC_LOAD) != 0)
> p->p_filesz += adjust;
> }
>
>The trouble being that sec->vma is 0xf0000000. (I have a fancy link
>script: the code is for an embedded CPU.) So, "adjust" becomes huge
>(and negative)
Here's a Linux cutdown that shows the problem.
---------------< link script "j.link" >-----------------
PHDRS
{
noload PT_NULL;
load PT_LOAD;
}
SECTIONS
{
.bss ALIGN(4) (NOLOAD) :
{
_bbss = ABSOLUTE(.);
} :noload
.noload (0xF0000000) (NOLOAD) : { *(*); } :noload
}
-------------------< jbad.c >-----------------------------
static void foo (void) __attribute__(( section(".noload") ));
static void foo (void) {}
----------------------------------------------------------------------
Do this:
gcc -c jbad.c
ld -T j.link jbad.o
and on Red Hat Linux 7.0 it prints:
ld: a.out: warning: allocated section `.noload' not in segment
ld: final link failed: File truncated
But the full program links correctly, if I use a gcc that's a
few years old.
??
Don
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: need ld fix in assign_file_positions_for_segments,
<=