This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Possible problem debug sections default addresses on powerpc-linux-gnu


I hear the question.  I'll look into it as soon as
it makes sense... My normal build is a complete bootstrap
of gcc (2.9x), binutils and gcc (and the crowd of
supporting actors) in a 3-stage build of the whole
toolchain.  That build has been broken for over a
month now due to various gcc problems. (At least
gcc... there may be other problems hiding behind
that one.)  (It looks as if it's another uninit variable
or undetected array overrun... Interix is enough
different from most other Unix-like implementations that
if there is a bug in that regard that's silent
on other implementations, it shows up on Interix.)

I'll keep this on my "check it out" list for as soon
as I'm building again.

Donn

> -----Original Message-----
> From: Alan Modra [mailto:alan@linuxcare.com.au]
> Sent: Thursday, April 13, 2000 5:43 AM
> To: Franz Sirl
> Cc: Ian Lance Taylor; Donn Terry; binutils@sourceware.cygnus.com
> Subject: Re: Possible problem debug sections default addresses on
> powerpc-linux-gnu
> 
> 
> On Wed, 12 Apr 2000, Franz Sirl wrote:
> 
> > while loading a vmlinux kernel file with debugging 
> information, I got a warning
> > about some debug section addresses not being 0. I tracked 
> this down to the
> > linkerscript "vmlinux.lds" used during kernel builds, which 
> doesn't mention any
> > debug sections like .stab at all. After adding the debug 
> section entries from
> > elf.sc to vmlinux.lds the warning went away.
> 
> Try this patch, which implements Ian's suggestion about handling
> SEC_DEBUGGING & ~ (SEC_LOAD | SEC_ALLOC) sections.  Ian, why 
> not do this
> for all ~ (SEC_LOAD | SEC_ALLOC) sections?
> 
> Note the change in pe.em to set all relocateable section 
> start addresses.
> I don't know a great deal about pe, but this looks right to 
> me.  Someone
> who uses pe might like to check this patch out.  Donn?
> 
> -- 
> Linuxcare.  Support for the Revolution.
> 
> ld/ChangeLog
> 	* emultempl/elf32.em 
> (gld${EMULATION_NAME}_place_section): Process
> 	~SEC_ALLOC sections too.  Init start address of debug sections.
> 	* emultempl/armelf.em 
> (gld${EMULATION_NAME}_place_section): Ditto.
> 	* emultempl/pe.em (gld${EMULATION_NAME}_place_section): Ditto.
> 	Also set all relocateable section start addresses.
> 
> emultempl/armelf.em patch is identical to emultempl/elf32.em patch
> 
> Index: emultempl/elf32.em
> ===================================================================
> RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
> retrieving revision 1.13
> diff -u -p -r1.13 elf32.em
> --- elf32.em	2000/04/12 02:43:37	1.13
> +++ elf32.em	2000/04/13 11:35:29
> @@ -895,9 +895,6 @@ gld${EMULATION_NAME}_place_orphan (file,
>    const char *outsecname;
>    lang_output_section_statement_type *os;
>  
> -  if ((s->flags & SEC_ALLOC) == 0)
> -    return false;
> -
>    /* Look through the script to see where to place this section.  */
>    hold_section = s;
>    hold_use = NULL;
> @@ -951,7 +948,7 @@ gld${EMULATION_NAME}_place_orphan (file,
>  	   && hold_text.os != NULL)
>      place = &hold_text;
>    else
> -    return false;
> +    place = NULL;
>  
>    /* Choose a unique name for the section.  This will be 
> needed if the
>       same section name appears in the input file with different
> @@ -983,7 +980,7 @@ gld${EMULATION_NAME}_place_orphan (file,
>    if (snew == NULL)
>        einfo ("%P%F: output format %s cannot represent 
> section called %s\n",
>  	     output_bfd->xvec->name, outsecname);
> -  if (place->os->bfd_section != NULL)
> +  if (place && place->os->bfd_section)
>      {
>        /* Unlink it first.  */
>        for (pps = &output_bfd->sections; *pps != snew; pps = 
> &(*pps)->next)
> @@ -1018,10 +1015,11 @@ gld${EMULATION_NAME}_place_orphan (file,
>  							   << 
> s->alignment_power))));
>      }
>  
> -  if (! link_info.relocateable)
> -    address = NULL;
> -  else
> +  if (link_info.relocateable
> +      || (s->flags & (SEC_DEBUGGING | SEC_LOAD | SEC_ALLOC)) 
> == SEC_DEBUGGING)
>      address = exp_intop ((bfd_vma) 0);
> +  else
> +    address = NULL;
>  
>    lang_enter_output_section_statement (outsecname, address, 0,
>  				       (bfd_vma) 0,
> @@ -1047,20 +1045,22 @@ gld${EMULATION_NAME}_place_orphan (file,
>  				      exp_nameop (NAME, ".")));
>      }
>  
> -  if (! place->stmt)
> +  if (place)
>      {
> -      /* Put the new statement list right at the head.  */
> -      *add.tail = place->os->header.next;
> -      place->os->header.next = add.head;
> -    }
> -  else
> -    {
> -      /* Put it after the last orphan statement we added.  */
> -      *add.tail = *place->stmt;
> -      *place->stmt = add.head;
> +      if (! place->stmt)
> +	{
> +	  /* Put the new statement list right at the head.  */
> +	  *add.tail = place->os->header.next;
> +	  place->os->header.next = add.head;
> +	}
> +      else
> +	{
> +	  /* Put it after the last orphan statement we added.  */
> +	  *add.tail = *place->stmt;
> +	  *place->stmt = add.head;
> +	}
> +      place->stmt = add.tail;	/* Save the end of this 
> list.  */
>      }
> -  place->stmt = add.tail;	/* Save the end of this list.  */
> -
>    stat_ptr = old;
>  
>    return true;
> Index: emultempl/pe.em
> ===================================================================
> RCS file: /cvs/src/src/ld/emultempl/pe.em,v
> retrieving revision 1.21
> diff -u -p -r1.21 pe.em
> --- pe.em	2000/04/12 02:43:37	1.21
> +++ pe.em	2000/04/13 11:35:32
> @@ -1100,9 +1100,6 @@ gld_${EMULATION_NAME}_place_orphan (file
>    const char *secname;
>    char *dollar = NULL;
>  
> -  if ((s->flags & SEC_ALLOC) == 0)
> -    return false;
> -
>    secname = bfd_get_section_name (s->owner, s);
>  
>    /* Look through the script to see where to place this section.  */
> @@ -1181,7 +1178,7 @@ gld_${EMULATION_NAME}_place_orphan (file
>        if (snew == NULL)
>  	einfo ("%P%F: output format %s cannot represent section 
> called %s\n",
>  	       output_bfd->xvec->name, outsecname);
> -      if (place != NULL && place->os->bfd_section != NULL)
> +      if (place && place->os->bfd_section)
>  	{
>  	  /* Unlink it first.  */
>  	  for (pps = &output_bfd->sections; *pps != snew; pps = 
> &(*pps)->next)
> @@ -1199,8 +1196,10 @@ gld_${EMULATION_NAME}_place_orphan (file
>        stat_ptr = &add;
>        lang_list_init (stat_ptr);
>  
> -      if (link_info.relocateable)
> -	address = NULL;
> +      if (link_info.relocateable
> +	  || ((s->flags & (SEC_DEBUGGING | SEC_LOAD | SEC_ALLOC))
> +	      == SEC_DEBUGGING))
> +	address = exp_intop ((bfd_vma) 0);
>        else
>  	{
>  	  /* All sections in an executable must be aligned to a page
> 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]