Bug 12915 - mips64-linux-as aborts with assertion error building a Linux/MIPS kernel
Summary: mips64-linux-as aborts with assertion error building a Linux/MIPS kernel
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: 2.23
Assignee: rsandifo@nildram.co.uk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 16:21 UTC by Ralf Baechle
Modified: 2018-07-02 20:29 UTC (History)
3 users (show)

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


Attachments
Test case extracted from kernel code. (83 bytes, text/plain)
2011-06-21 16:21 UTC, Ralf Baechle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Baechle 2011-06-21 16:21:38 UTC
Created attachment 5810 [details]
Test case extracted from kernel code.

A minimal test case extracted from the kernel code is attached as genex.s.  Failure sympthom is the following assertion:

genex.s: Assembler messages:
genex.s:5: Internal error!
Assertion failure in append_insn at ../../gas/config/tc-mips.c line 2867.

To reproduce:

 o Using binutils with target mips64-linux, mipsel-linux, mips64el-linux or
   mips-linux:
   mips{,64}{,el}-linux-as -mabi=32 -o genex.o genex.s

 o Using mips-linux or mipsel-linux no -mabi=32 is needed:
   mips-linux-as -o genex.o genex.s
   mipsel-linux-as -o genex.o genex.s
   mips64-linux and mips64el-linux will not trigger the issue without -mabi=32.

The destination register being used in the last two lines has to be the same for both lines to trigger the bug, that is $28 here.  If both lines to not use the same destination register, as will not throw the assertion.
Comment 1 rsandifo@nildram.co.uk 2011-06-22 19:20:31 UTC
Thanks for the report.

The problem is caused by a thinko in the code that
looks for a hazard between the pre-noreorder code
and the post-noreorder code.
Comment 2 Sourceware Commits 2011-06-23 20:21:41 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	rsandifo@sourceware.org	2011-06-23 20:21:38

Modified files:
	gas/config     : tc-mips.c 
	gas/testsuite/gas/mips: mips.exp 
	gas/testsuite  : ChangeLog 
	gas            : ChangeLog 
Added files:
	gas/testsuite/gas/mips: pr12915.s pr12915.d 

Log message:
	gas/
	PR gas/12915
	* config/tc-mips.c (append_insn): Only consider hazards between the
	pre-noreorder block and ip.
	
	gas/testsuite/
	* gas/mips/pr12915.s, gas/mips/pr12915.d: New test.
	* gas/mips/mips.exp: Run it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-mips.c.diff?cvsroot=src&r1=1.462&r2=1.463
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/mips/pr12915.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/mips/pr12915.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/mips/mips.exp.diff?cvsroot=src&r1=1.184&r2=1.185
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1917&r2=1.1918
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4514&r2=1.4515
Comment 3 Ralf Baechle 2011-06-24 09:14:06 UTC
Thanks, Richard!

I just backported the patch on top of a vanilla binutils 2.21 and the previously failing kernel file now seems to be assembled correctly so I think this bug can now be closed.
Comment 4 Sourceware Commits 2011-06-25 10:11:50 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	rsandifo@sourceware.org	2011-06-25 10:11:47

Modified files:
	gas/config     : tc-mips.c 
	gas/testsuite/gas/mips: vr4130.s vr4130.d 
	gas/testsuite  : ChangeLog 
	gas            : ChangeLog 

Log message:
	gas/
	PR gas/12915
	* config/tc-mips.c (nops_for_vr4130, nops_for_24k, nops_for_insn)
	(nops_for_sequence, nops_for_insn_or_target): Add ignore parameters.
	(mips_emit_delays, start_noreorder): Update accordingly.
	(append_insn): Likewise.  Revert original fix for this PR
	and use the ignore parameter instead.
	
	gas/testsuite/
	* gas/mips/vr4130.s: Add some more ".set noreorder" tests.
	* gas/mips/vr4130.d: Update accordingly.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-mips.c.diff?cvsroot=src&r1=1.463&r2=1.464
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/mips/vr4130.s.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/mips/vr4130.d.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1918&r2=1.1919
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4517&r2=1.4518
Comment 5 Maciej W. Rozycki 2018-07-02 20:29:04 UTC
Closing old bug that has been resolved in 2.22.