mips .bss lma broken

Catherine Moore clm@redhat.com
Fri Mar 22 07:25:00 GMT 2002


Richard,

This patch seems to have caused some trouble for some
mips platforms:

http://sources.redhat.com/ml/binutils/2001-10/msg00541.html

<date>  Richard Earnshaw (rearnsha@arm.com)

        * elf.c (_bfd_elf_make_section_from_shdr): Set the LMA based on the
        p_paddr of the segment that contains it.

In particular, the lma for the bss section should be the same value as
the vma.  In this example, it is not, and gdb relies on a correct lma
for this particular port.

 8 .eh_frame     00000350  0001ad30  0001ad30  0000bd30  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  9 .jcr          00000004  0001b080  0001b080  0000c080  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 10 .sbss         00000010  0001b090  0001b090  0000c090  2**3
                  ALLOC
 11 .bss          000001d0  0001b0a0  0001b090  0000c090  2**4
                  ALLOC
 12 .reginfo      00000018  00000000  00000000  0000c090  2**2
                  CONTENTS, READONLY, LINK_ONCE_SAME_SIZE
 13 .mdebug       00027f04  00000000  00000000  0000c0a8  2**2
                  CONTENTS, READONLY, DEBUGGING

I'm not sure if any other targets have more than one section 
that has its type set to SHT_NOBITS.  In this case, the .sbss and
the .bss section have that type.  Maybe the lma calculation needs
to take that into account?

In any case, I don't understand the problem that you were trying
to fix with this patch.  If you would elaborate, then maybe we
could come up with a correct lma calculation for both cases.

This is the source code, used to generate the executable:

#include <stdio.h>
static int x[2];
static char astring[128];
int main ()
{
  int i;
  char *ptr;

  ptr = astring;
  for (i = ' '; i < 'Z'; i++)
    *ptr++ = i;
  *ptr = 0;

  printf ("astring=0x%llx\n", (long long)astring);
  printf ("astring=%s\n", astring);
}


Thanks,
Catherine




More information about the Binutils mailing list