Bug 86820 - [8 regression] gcc-8 miscompiles binutils on m68k
Summary: [8 regression] gcc-8 miscompiles binutils on m68k
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.2.0
: P4 normal
Target Milestone: 8.3
Assignee: Not yet assigned to anyone
URL: https://sourceware.org/bugzilla/show_...
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2018-08-01 14:59 UTC by John Paul Adrian Glaubitz
Modified: 2018-08-02 17:25 UTC (History)
1 user (show)

See Also:
Host:
Target: m68k-*-*
Build:
Known to work: 9.0
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Paul Adrian Glaubitz 2018-08-01 14:59:39 UTC
Building binutils from git master on m68k with gcc-8 results in utilities like strip or objcop failing with "memory exhausted":

For example, building wireshark on Debian m68k fails with:

dh_strip --ddeb-migration="wireshark-dbg (<< 2.0.1+g59ea380-12.0.1+g59ea380-2~)" || dh_strip
/usr/bin/objcopy:debian/libwireshark11/usr/lib/m68k-linux-gnu/libwireshark.so.11.1.2: memory exhausted
dh_strip: objcopy --only-keep-debug --compress-debug-sections debian/libwireshark11/usr/lib/m68k-linux-gnu/libwireshark.so.11.1.2 debian/.debhelper/libwireshark11/dbgsym-root/usr/lib/debug/.build-id/8d/574eed1bdf861517258e43eb7c77408493c40e.debug returned exit code 1
dh_strip: Aborting due to earlier error
/usr/bin/objcopy:debian/libwireshark11/usr/lib/m68k-linux-gnu/libwireshark.so.11.1.2: memory exhausted
dh_strip: objcopy --only-keep-debug --compress-debug-sections debian/libwireshark11/usr/lib/m68k-linux-gnu/libwireshark.so.11.1.2 debian/.debhelper/libwireshark11/dbgsym-root/usr/lib/debug/.build-id/8d/574eed1bdf861517258e43eb7c77408493c40e.debug returned exit code 1
dh_strip: Aborting due to earlier error

Full log: https://buildd.debian.org/status/fetch.php?pkg=wireshark&arch=m68k&ver=2.6.2-2&stamp=1533058050&raw=0

Building haskell-yaml on Debian m68k fails with:

debian/hlibrary.setup copy --builddir=dist-ghc --destdir=debian/tmp-inst-ghc
Installing library in debian/tmp-inst-ghc/usr/lib/haskell-packages/ghc/lib/m68k-linux-ghc-8.2.2/yaml-0.8.31.1-EX4SEGT1sRZ4D4BySsFjv1
Installing executable yaml2json in debian/tmp-inst-ghc/usr/bin
Warning: The directory debian/tmp-inst-ghc/usr/bin is not in the system search
path.
/usr/bin/strip:debian/tmp-inst-ghc/usr/bin/yaml2json: memory exhausted
make: *** [/usr/share/cdbs/1/class/hlibrary.mk:188: debian/tmp-inst-ghc] Error 1

Full log: https://buildd.debian.org/status/fetch.php?pkg=haskell-yaml&arch=m68k&ver=0.8.31.1-1&stamp=1533003205&raw=0

Building the same version of binutils with gcc-7 results in working strip and objcopy binaries which don't bail out with the above memory exhausted error.
Comment 1 John Paul Adrian Glaubitz 2018-08-01 15:00:30 UTC
Related (invalid) binutils bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=23471
Comment 2 Andreas Schwab 2018-08-01 15:10:18 UTC
Does this help <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=262835>?
Comment 3 John Paul Adrian Glaubitz 2018-08-01 15:32:51 UTC
(In reply to Andreas Schwab from comment #2)
> Does this help
> <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=262835>?

Thanks. Rebuilding gcc-8 with the patch applied now, will report back ASAP.
Comment 4 John Paul Adrian Glaubitz 2018-08-02 01:54:50 UTC
Yes, I can confirm that the patch from comment #2 fixes the problem for me.

(sid-m68k-sbuild)root@epyc:/binutils/binutils-gdb# ls -l /tmp/json2yaml 
-rwxr-xr-x 1 root root 43823968 Aug  2 01:53 /tmp/json2yaml
(sid-m68k-sbuild)root@epyc:/binutils/binutils-gdb# ./binutils/strip-new /tmp/json2yaml 
(sid-m68k-sbuild)root@epyc:/binutils/binutils-gdb# ls -l /tmp/json2yaml 
-rwxr-xr-x 1 root root 31372868 Aug  2 01:54 /tmp/json2yaml
(sid-m68k-sbuild)root@epyc:/binutils/binutils-gdb#

Andreas, can you backport the patch to the gcc-8 branch unless that has already happened?
Comment 5 Andreas Schwab 2018-08-02 17:23:45 UTC
Author: schwab
Date: Thu Aug  2 17:23:13 2018
New Revision: 263269

URL: https://gcc.gnu.org/viewcvs?rev=263269&root=gcc&view=rev
Log:
Fix invalid cc_status after [const_][us]mulsi3_highpart

	Backport from mainline
	PR target/86820
	* config/m68k/m68k.md (umulsi3_highpart+1, const_umulsi3_highpart)
	(smulsi3_highpart+1, const_smulsi3_highpart): Add CC_STATUS_INIT.

testsuite/:
	PR target/86820
	* gcc.target/m68k/mulsi_highpart.c: New test.

Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.target/m68k/mulsi_highpart.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/config/m68k/m68k.md
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
Comment 6 Andreas Schwab 2018-08-02 17:25:26 UTC
Fixed.