Bug 14788 - trying to link simple ifunc test causes the linker to segfault with s390x targets
Summary: trying to link simple ifunc test causes the linker to segfault with s390x tar...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.23
: P2 normal
Target Milestone: ---
Assignee: Andreas Krebbel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-30 22:01 UTC by Mike Frysinger
Modified: 2014-02-25 08:04 UTC (History)
3 users (show)

See Also:
Host:
Target: s390x-linux-gnu
Build:
Last reconfirmed:


Attachments
Proposed fix (295 bytes, patch)
2012-11-05 09:38 UTC, Andreas Krebbel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2012-10-30 22:01:51 UTC
$ cat test.s 
.type foo,%gnu_indirect_function
foo:
.globl _start
_start:
.data
.quad foo

$ ./gas/as-new test.s -o test.o
$ gdb --args ./ld/ld-new test.o -o test
(gdb) r
Starting program: /usr/local/gentoo/src/patchsets/binutils/binutils-2.23/build/ld/ld-new test.o -o test

Program received signal SIGSEGV, Segmentation fault.
s390_elf_create_ifunc_sections (abfd=0x0, info=info@entry=0x709ac0 <link_info>) at ../../bfd/elf-s390-common.c:41
41        const struct elf_backend_data *bed = get_elf_backend_data (abfd);

this is vanilla binutils-2.23 built with `./configure --target=s390x-linux-gnu`
Comment 1 Andreas Krebbel 2012-11-05 09:38:06 UTC
Created attachment 6716 [details]
Proposed fix

This fixes the problem for me. I'll commit it to mainline asap.
Comment 2 Sourceware Commits 2012-11-05 12:31:27 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	krebbel@sourceware.org	2012-11-05 12:31:09

Modified files:
	bfd            : ChangeLog elf32-s390.c elf64-s390.c 

Log message:
	2012-11-05  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
	
	PR target/14788
	* elf32-s390.c (elf_s390_relocate_section): Set elf.dynobj for
	local ifunc symbols.
	* elf64-s390.c (elf_s390_relocate_section): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5839&r2=1.5840
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-s390.c.diff?cvsroot=src&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-s390.c.diff?cvsroot=src&r1=1.123&r2=1.124
Comment 3 Mike Frysinger 2012-11-10 05:54:02 UTC
could you commit it to the 2.23 branch too ?
Comment 4 Sourceware Commits 2012-11-12 09:04:19 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_23-branch
Changes by:	gingold@sourceware.org	2012-11-12 09:04:13

Modified files:
	bfd            : ChangeLog elf32-s390.c elf64-s390.c 

Log message:
	bfd/
	2012-11-05  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
	
	PR target/14788
	* elf32-s390.c (elf_s390_relocate_section): Set elf.dynobj for
	local ifunc symbols.
	* elf64-s390.c (elf_s390_relocate_section): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.5758.2.23&r2=1.5758.2.24
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-s390.c.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.122&r2=1.122.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-s390.c.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.121&r2=1.121.4.1
Comment 5 gingold@adacore.com 2012-11-12 09:05:51 UTC
Done.

On Nov 10, 2012, at 6:54 AM, vapier at gentoo dot org wrote:

> http://sourceware.org/bugzilla/show_bug.cgi?id=14788
> 
> Mike Frysinger <vapier at gentoo dot org> changed:
> 
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |gingold at adacore dot com
> 
> --- Comment #3 from Mike Frysinger <vapier at gentoo dot org> 2012-11-10 05:54:02 UTC ---
> could you commit it to the 2.23 branch too ?
> 
> -- 
> 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.
Comment 6 Andreas Krebbel 2014-02-25 08:04:48 UTC
Fixed with comment 4.