Bug 20520 - ld terminated with signal 11 [Segmentation fault]
Summary: ld terminated with signal 11 [Segmentation fault]
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: 2.28
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-26 09:05 UTC by Richard Biener
Modified: 2024-06-27 13:04 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
object file (1.80 KB, application/x-object)
2016-08-26 09:05 UTC, Richard Biener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2016-08-26 09:05:51 UTC
Created attachment 9478 [details]
object file

I get

/home/abuild/rguenther/obj-early-lto-debug-g/gcc/testsuite/g++/../../xg++ -B /home/abuild/rguenther/obj-early-lto-debug-g/gcc/testsuite/g++/../../ -B /home/abuild/rguenther/obj-early-lto-debug-g/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs -B /home/abuild/rguenther/obj-early-lto-debug-g/x86_64-pc-linux-gnu/./libitm/ -mtune=generic -march=x86-64 -r -nostdlib -o /tmp/ccdeKWVsdebugobj /tmp/cc5vbUMkdebugobjtem
collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
compilation terminated.

on arguably invalid input (a GROUP section referencing SHT_NULL sections).

I expect a diagnostic instead.  Object file attached.
Comment 1 Sourceware Commits 2016-08-27 01:02:41 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=53720c495c7c25f9b0f4bfce3269c6c8a7696522

commit 53720c495c7c25f9b0f4bfce3269c6c8a7696522
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Aug 27 09:43:42 2016 +0930

    Lack of SHF_GROUP sections result in ld segfault
    
    	PR 20520
    	* elf.c (_bfd_elf_setup_sections): Check that SHT_GROUP sections
    	have corresponding SHF_GROUP sections.
    	(bfd_elf_set_group_contents): Comment.
Comment 2 Alan Modra 2016-08-27 01:35:42 UTC
Fixed
Comment 3 Fangrui Song 2024-06-06 00:39:56 UTC
A section group without any member is valid and should ideally be supported. ld before 53720c495c7c25f9b0f4bfce3269c6c8a7696522 crashed while ld versions after the commit report: `file not recognized: file format not recognized`
Comment 4 Alan Modra 2024-06-27 13:04:00 UTC
(In reply to Fangrui Song from comment #3)
> A section group without any member is valid and should ideally be supported.
As of commit f67619822044 that should be supported.