This is the mail archive of the 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]
Other format: [Raw text]

NOLOAD section attribute results in incorrect debug information


We have built toolchains for H8/SH targets using 
binutils-2.17.90 (20070806), gcc-4.2.1 and newlib-1.15.0 sources.

During our internal testing we found a problem in the GNU Linker.
When a user defined section with NOLOAD attribute is used in the 
application, the debugging information generated is not correct. 
The ".debug_info" section is incomplete and incorrect. 
Hence it is not possible to debug the application properly.

The test case below, demonstrates the problem:

//////////// C Program - t.c ////////////
int j __attribute__((section ("dont_load")));

int main(void)
  return 0;

////////////// Linker script ///////////////
	.text 0x00000800 :

	.dont_load 0x00FFF000 (NOLOAD) :

Commands used:
sh-elf-gcc t.c -Tscript -g -g2 -nostartfiles 
sh-elf-readelf -w a.out > dmp

The "dmp" file shows that ".debug_info" section is incomplete 
and incorrect.

//////////// .debug_info section //////////
  Compilation Unit @ offset 0x0:
   Length:        168
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
  < c>     DW_AT_producer   : GNU C 4.2-GNUSH_v0703	
  <22>     DW_AT_language  : 1	(ANSI C)
  <23>     DW_AT_name       : t.c	
  <27>     DW_AT_comp_dir  : 	               <- Missing
  <28>     DW_AT_low_pc     : 0x72	   <- Incorrect-should be 0x800
  <2c>     DW_AT_high_pc    : 0x6f677261  <- Incorrect-should be 0x810
  <30>     DW_AT_stmt_list   : 0x6d204669 <- Incorrect-should be 0	
 <1><34>: Abbrev Number: 108

The following debugging information entries are also missing:
	1. DW_TAG_subprogram
	2. DW_TAG_base_type
	3. DW_TAG_variable

Please note that correct debug information is present in the 
object file. After linking, the information generated
is incorrect.

Please note that this problem was not present in 

After investigating further, we found that reverting the 
following patch from binutils, solves the problem. 

However, to revert the above mentioned patch, we had to revert 
the patches mentioned below as well,

The problem exists in binutils 2.18 as well.

Any help on this will be appreciated.

Ina Pandit

KPIT Cummins InfoSystems Ltd.
Pune, India
Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C
and M32C Series. The following site also offers free technical support
to its users. Visit for details.
Latest versions of KPIT GNU tools were released on October 1, 2007.

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