bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: pitchumani.s at atmel dot com
Subject: [Bug ld/12161] Unconforming ELF file causes SIGSEGV in avr-ld
Date: Wed, 04 Jan 2012 12:49:51 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12161

Pitchumani <pitchumani.s at atmel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pitchumani.s at atmel dot
                   |                            |com

--- Comment #8 from Pitchumani <pitchumani.s at atmel dot com> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]