[Bug ld/12161] Unconforming ELF file causes SIGSEGV in avr-ld

2012-01-04 Thread pitchumani.s at atmel dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=12161

--- Comment #11 from Pitchumani  2012-01-05 
07:21:02 UTC ---
(In reply to comment #10)
> Hi Pitchumani,
> 
>   Please try out the uploaded patch ("Load relocs if necessary") and let me
> know if you have any problems with it.
> 
> Cheers
>   Nick

This change solves the issue.

Thanks
Pitchumani

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13561] New: AIX link failure: RLD address not contained in section

2012-01-04 Thread ka5427-536 at online dot de
http://sourceware.org/bugzilla/show_bug.cgi?id=13561

 Bug #: 13561
   Summary: AIX link failure: RLD address not contained in section
   Product: binutils
   Version: 2.22
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: ka5427-...@online.de
Classification: Unclassified


Created attachment 6146
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6146
Objects, Sources, Makefile

We are trying to use 'partial linking' to reduce the size of the resulting
binary. But it seems that the
object file produced by the partial link step is somehow corrupted. The AIX
linker complains with


  ld: 0711-547 SEVERE ERROR: Object partial.o cannot be processed.
 RLD address 0x1364 for section 2 (.data) is
 not contained in the section.
  collect2: ld returned 12 exit status


Source files:

   sandbox@rs6k>  cat main.cpp

 int main() {
   return 0;
 }


   sandbox@rs6k>  cat foo.cpp

 #include 

 void foo() {
   std::auto_ptr p1(new int);
 }


   sandbox@rs6k>  cat bar.cpp

 #include 

 void bar() {
   std::auto_ptr p1(new int);
 }


build steps:

  g++ -fPIC -o foo.o -c foo.cpp
  g++ -fPIC -o bar.o -c bar.cpp

  # now the partial link step ...
  gnu-ld -r -o partial.o foo.o bar.o

  g++-c -o main.o main.cpp

  # now the final link step fails ...
  g++ -o demo main.o partial.o

  # ...  fails with an error message from the AIX linker:

  ld: 0711-547 SEVERE ERROR: Object partial.o cannot be processed.
 RLD address 0x1364 for section 2 (.data) is
 not contained in the section.
  collect2: ld returned 12 exit status


version information:

  g++ --version

g++ (GCC) 4.5.3

  gnu-ld --version

GNU ld (GNU Binutils) 2.22.51.20111212

  AIX Linker:  ld -V

ld: LD 1.65.2.6 (2/24/09)

  AIX OS: oslevel -s

5300-03-CSP-

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/12161] Unconforming ELF file causes SIGSEGV in avr-ld

2012-01-04 Thread nickc at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=12161

Nick Clifton  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |

--- Comment #10 from Nick Clifton  2012-01-04 17:09:07 
UTC ---
Hi Pitchumani,

  Please try out the uploaded patch ("Load relocs if necessary") and let me
know if you have any problems with it.

Cheers
  Nick

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/12161] Unconforming ELF file causes SIGSEGV in avr-ld

2012-01-04 Thread nickc at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=12161

--- Comment #9 from Nick Clifton  2012-01-04 17:08:05 
UTC ---
Created attachment 6145
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6145
Load relocs if necessary

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/13560] New: DWARF2 .debug_info section not found if placed after .debug_line and .debug_abbrev sections

2012-01-04 Thread lionel.amann at cegetel dot net
http://sourceware.org/bugzilla/show_bug.cgi?id=13560

 Bug #: 13560
   Summary: DWARF2 .debug_info section not found if placed after
.debug_line and .debug_abbrev sections
   Product: binutils
   Version: 2.22
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassig...@sourceware.org
ReportedBy: lionel.am...@cegetel.net
Classification: Unclassified


Created attachment 6144
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6144
dcc DWARF2 object file

Hi,

I am generating powerpc code with dcc (aka Wind River diab compiler) version
5.6.1.0.
Resulting sections list is like this one :

readelfppc -S toto.o

There are 12 section headers, starting at offset 0x1a98:

Section Headers:
  [Nr] Name  TypeAddr OffSize   ES Flg Lk Inf
Al
  [ 0]   NULL 00 00 00  0   0 
0
  [ 1] .text PROGBITS 38 00037c 00  AX  0   0 
4
  [ 2] .debug_line   NOTE 0003b8 ed 00  0   0 
1
  [ 3] .debug_abbrev NOTE 0004a8 a9 00  0   0 
1
  [ 4] .debug_info   NOTE 000558 0007a4 00  0   0 
1
  [ 5] .debug_frame  PROGBITS 000d00 2c 00  0   0 
1
  [ 6] .strtab   STRTAB   000d30 000346 00  0   0 
1
  [ 7] .symtab   SYMTAB   001078 0001c0 10  6  10 
1
  [ 8] .rela.textRELA 001238 0004ec 0c  7   1 
1
  [ 9] .rela.debug_info  RELA 001728 00033c 0c  7   4 
1
  [10] .rela.debug_frame RELA 001a68 18 0c  7   5 
1
  [11] .rela.debug_line  RELA 001a80 18 0c  7   2 
1

I cannot strip debug information from it (recompiled binutils 2.22 package on
cygwin) :
strip-new -v -S toto.o
copy from `toto.o' [elf32-powerpc] to `st3A03Ru' [elf32-powerpc]
BFD: st3A03Ru: symbol `.debug_info' required but not present

This message comes from : 
./bfd/elf.c:5324:   (_("%B: symbol `%s' required but not present"),

If I list sections from one gcc 4.0.4 sun/solaris object (also a DWARF2
object), I get these list/order of sections :

readelfppc -S asc2bin.o
There are 18 section headers, starting at offset 0xe0c:

Section Headers:
  [Nr] Name  TypeAddr OffSize   ES Flg Lk Inf
Al
  [ 0]   NULL 00 00 00  0   0 
0
  [ 1] .shstrtab STRTAB   34 da 00  0   0 
1
  [ 2] .text PROGBITS 000110 0003c8 00  AX  0   0 
4
  [ 3] .rodata   PROGBITS 0004d8 28 00   A  0   0 
8
  [ 4] .compcom  PROGBITS 000500 22 00  0   0 
8
  [ 5] .debug_info   PROGBITS 000522 000358 01  0   0 
1
  [ 6] .debug_line   PROGBITS 00087a ba 01  0   0 
1
  [ 7] .debug_abbrev PROGBITS 000934 b4 01  0   0 
1
  [ 8] .debug_pubnames   PROGBITS 0009e8 1c 01  0   0 
1
  [ 9] .debug_typenames  PROGBITS 000a04 34 01  0   0 
1
  [10] .symtab   SYMTAB   000a38 000160 10   A 11  12 
4
  [11] .strtab   STRTAB   000b98 55 00   A  0   0 
1
  [12] .rela.textRELA 000bf0 f0 0c   A 10   2 
4
  [13] .rela.debug_info  RELA 000ce0 30 0c   A 10   5 
4
  [14] .rela.debug_line  RELA 000d10 0c 0c   A 10   6 
4
  [15] .rela.debug_pubna RELA 000d1c 0c 0c   A 10   8 
4
  [16] .rela.debug_typen RELA 000d28 0c 0c   A 10   9 
4
  [17] .comment  PROGBITS 000d34 d8 00  0   0 
1

I suspect that dcc objects not having .debug_info section as the first .debug*
one are preventing binutils from finding it correctly.

I cannot try my 'compiled' strip-new.exe command on it as my exe does not
handle elf32-sparc files type.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/12161] Unconforming ELF file causes SIGSEGV in avr-ld

2012-01-04 Thread pitchumani.s at atmel dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=12161

Pitchumani  changed:

   What|Removed |Added

 CC||pitchumani.s at atmel dot
   ||com

--- Comment #8 from Pitchumani  2012-01-04 
12:49:51 UTC ---
(In reply to comment #7)
> Hi Guys,
> 
>   I have decided to go ahead and check this patch in.  Please reopen this PR 
> if
> the problem resurfaces.
> 
> Cheers
>   Nick

Hi Nick,

Function 'elf32_avr_check_relocs(elf32-avr.c)' is referred in elflink.c:4801

(-- snip from elflink.c --)
 4799   if (! dynamic
 4800   && is_elf_hash_table (htab)
 4801   && bed->check_relocs != NULL
 4802   && elf_object_id (abfd) == elf_hash_table_id (htab)
 4803   && (*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
(-- snip end --)

As 'bed->check_relocs' is NULL in 2.22, code that follows this check not
executed.
This caused a segmentation fault (NULL pointer access) in elf32-avr.c:1528.

Test case:
-- c source --
void func2(int a) { }

void func1(void)
{
  func2(10);
}

int main(void)
{
  func1();
}
-- c source --

command line options:
avr-gcc segfault.c -ffunction-sections -mmcu=atmega128 -c -o segfault.o
avr-ld segfault.o -m avr51 -relax

Please correct if I am missing something.

Thanks,
Pitchumani

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils