Bug 17493 - [gas] internal error in bfd_elf64_swap_symbol_out
Summary: [gas] internal error in bfd_elf64_swap_symbol_out
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.25
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-16 09:51 UTC by Matthias Klose
Modified: 2014-10-28 06:43 UTC (History)
1 user (show)

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


Attachments
test case (552 bytes, text/x-csrc)
2014-10-16 09:51 UTC, Matthias Klose
Details
fix (733 bytes, patch)
2014-10-16 12:52 UTC, Alan Modra
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2014-10-16 09:51:26 UTC
Created attachment 7836 [details]
test case

$ gcc -c 173930.c 
as: BFD (GNU Binutils for Ubuntu) 2.24.90.20141014 assertion fail ../../bfd/elf.c:6879
as: BFD (GNU Binutils for Ubuntu) 2.24.90.20141014 internal error, aborting at ../../bfd/elfcode.h line 224 in bfd_elf64_swap_symbol_out

as: Please report this bug.
Comment 1 Alan Modra 2014-10-16 12:27:25 UTC
Reduced testcase

	movl $(%ebx+4), %eax
Comment 2 Alan Modra 2014-10-16 12:52:19 UTC
Created attachment 7837 [details]
fix

I think this tc-i386.c is the right fix for this bug, but I'll leave that up to HJ to judge.

I intend to make the write.c change as well, to stop any register symbols being reduced to the register section symbol, but it seems this requires testsuite tweaking.
Comment 3 cvs-commit@gcc.gnu.org 2014-10-18 12:40:26 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  a841bdf5d3bfb9c687f938be7388597db2e461de (commit)
      from  998a69f46a3770d0f26aec080fcac4865c689739 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit a841bdf5d3bfb9c687f938be7388597db2e461de
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Oct 18 11:10:53 2014 +1030

    Fix PR17493, attempted output of *GAS `reg' section* symbol
    
    The write.c change is to make gas report an error if reg_section
    symbols should leak in future.  The tc-i386.c change is the real fix.
    
    Note that the error isn't the most helpful, "redefined symbol cannot
    be used on reloc", but I'm not inclined to improve what is really an
    internal gas error.  reg_section symbols shouldn't leak..
    
    gas/
    	PR 17493
    	* write.c (adjust_reloc_syms): Don't allow symbols in reg_section
    	to be reduced to reg_section section symbol.
    	* gas/config/tc-i386.c (i386_finalize_immediate): Reject all
    	reg_section immediates.
    gas/testsuite/
    	* gas/i386/inval-equ-2.l: Adjust.

-----------------------------------------------------------------------

Summary of changes:
 gas/ChangeLog                        |    8 ++++++++
 gas/config/tc-i386.c                 |    2 +-
 gas/testsuite/ChangeLog              |    4 ++++
 gas/testsuite/gas/i386/inval-equ-2.l |   12 ++++++------
 gas/write.c                          |    3 ++-
 5 files changed, 21 insertions(+), 8 deletions(-)
Comment 4 Alan Modra 2014-10-18 21:54:52 UTC
Fixed
Comment 5 cvs-commit@gcc.gnu.org 2014-10-28 06:43:08 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, binutils-2_25-branch has been updated
       via  7cc2a6b6a4c63cba363836475052a71e0387e621 (commit)
      from  04253f276b48227728cac3e4c6df614e161f1e9c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7cc2a6b6a4c63cba363836475052a71e0387e621

commit 7cc2a6b6a4c63cba363836475052a71e0387e621
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Oct 18 11:10:53 2014 +1030

    Fix PR17493, attempted output of *GAS `reg' section* symbol
    
    The write.c change is to make gas report an error if reg_section
    symbols should leak in future.  The tc-i386.c change is the real fix.
    
    Note that the error isn't the most helpful, "redefined symbol cannot
    be used on reloc", but I'm not inclined to improve what is really an
    internal gas error.  reg_section symbols shouldn't leak..
    
    gas/
    	PR 17493
    	* write.c (adjust_reloc_syms): Don't allow symbols in reg_section
    	to be reduced to reg_section section symbol.
    	* gas/config/tc-i386.c (i386_finalize_immediate): Reject all
    	reg_section immediates.
    gas/testsuite/
    	* gas/i386/inval-equ-2.l: Adjust.

-----------------------------------------------------------------------

Summary of changes:
 gas/ChangeLog                        |    7 +++++++
 gas/config/tc-i386.c                 |    2 +-
 gas/testsuite/ChangeLog              |    6 ++++++
 gas/testsuite/gas/i386/inval-equ-2.l |   12 ++++++------
 gas/write.c                          |    3 ++-
 5 files changed, 22 insertions(+), 8 deletions(-)