Bug 17729 - [gold] gold failed to build x32 libgo
Summary: [gold] gold failed to build x32 libgo
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: 2.26
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-18 17:11 UTC by H.J. Lu
Modified: 2015-01-07 00:52 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2014-12-18 17:11:16 UTC
When gold is used to build libgo for x32, I got many:

ld.gold: error: .libs/go-assert.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-caller.o: failed to match split-stack sequence at section 1 offset 330
ld.gold: error: .libs/go-caller.o: failed to match split-stack sequence at section 1 offset 400
ld.gold: error: .libs/go-caller.o: failed to match split-stack sequence at section 1 offset 560
ld.gold: error: .libs/go-callers.o: failed to match split-stack sequence at section 1 offset 40
ld.gold: error: .libs/go-callers.o: failed to match split-stack sequence at section 1 offset 280
ld.gold: error: .libs/go-cdiv.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-cdiv.o: failed to match split-stack sequence at section 1 offset 170
ld.gold: error: .libs/go-fieldtrack.o: failed to match split-stack sequence at section 1 offset 20
ld.gold: error: .libs/go-matherr.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-panic.o: failed to match split-stack sequence at section 1 offset 80
ld.gold: error: .libs/go-reflect-call.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-setenv.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-type-complex.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-type-float.o: failed to match split-stack sequence at section 1 offset 0
ld.gold: error: .libs/go-varargs.o: failed to match split-stack sequence at section 1 offset 0

The problem is Target_x86_64<size>::do_calls_non_split doesn't
handle x32 code sequence.
Comment 1 H.J. Lu 2014-12-18 19:15:21 UTC
A patch is posted at

https://sourceware.org/ml/binutils/2014-12/msg00183.html
Comment 2 Sourceware Commits 2014-12-18 20:40:23 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, hjl/pr17729 has been created
        at  24103bbaf7b52a22ae7fa04ec17aadc5d7445dac (commit)

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

commit 24103bbaf7b52a22ae7fa04ec17aadc5d7445dac
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 18 11:09:28 2014 -0800

    Handle stack split for x32
    
    X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
    instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
    This patch handles it.
    
    	PR gold/17729
    	* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
    	(DEFAULT_TARGET_X32): Set for x32.
    	* x86_64.cc (Target_x86_64<size>::do_calls_non_split): Handle
    	x32.
    	* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
    	(check_DATA): Add split_x32 files.
    	(split_x32_[1234n].o): New targets.
    	(split_x32_[124]): New targets.
    	(split_x32_[1234r].stdout): New targets.
    	* testsuite/split_x32.sh: New file.
    	* testsuite/split_x32_1.s: Likewise.
    	* testsuite/split_x32_2.s: Likewise.
    	* testsuite/split_x32_3.s: Likewise.
    	* testsuite/split_x32_4.s: Likewise.
    	* testsuite/split_x32_n.s: Likewise.
    	* configure: Regenerated.
    	* testsuite/Makefile.in: Likewise.

-----------------------------------------------------------------------
Comment 3 Sourceware Commits 2015-01-06 23:40:54 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  4fc1b9d43cbce7571264a0011c87258b78252750 (commit)
      from  e7287c7f647870093b8ab5ffea0732ffdb8c4d66 (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=4fc1b9d43cbce7571264a0011c87258b78252750

commit 4fc1b9d43cbce7571264a0011c87258b78252750
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 18 11:09:28 2014 -0800

    Handle stack split for x32
    
    X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
    instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
    This patch handles it.
    
    	PR gold/17729
    	* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
    	(DEFAULT_TARGET_X32): Set for x32.
    	* x86_64.cc (cmp_insn_32): New.
    	(lea_r10_insn_32): Likewise.
    	(lea_r11_insn_32): Likewise.
    	(cmp_insn_64): Likewise.
    	(lea_r10_insn_64): Likewise.
    	(lea_r11_insn_64): Likewise.
    	(Target_x86_64<size>::do_calls_non_split): Handle x32.
    	* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
    	(check_DATA): Add split_x32 files.
    	(split_x32_[1234n].o): New targets.
    	(split_x32_[124]): New targets.
    	(split_x32_[1234r].stdout): New targets.
    	* testsuite/split_x32.sh: New file.
    	* testsuite/split_x32_1.s: Likewise.
    	* testsuite/split_x32_2.s: Likewise.
    	* testsuite/split_x32_3.s: Likewise.
    	* testsuite/split_x32_4.s: Likewise.
    	* testsuite/split_x32_n.s: Likewise.
    	* configure: Regenerated.
    	* testsuite/Makefile.in: Likewise.

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

Summary of changes:
 gold/ChangeLog               |   27 ++++++++++++++++++++
 gold/configure               |   28 ++++++++++++++++++++-
 gold/configure.ac            |   15 ++++++++++-
 gold/testsuite/Makefile.am   |   37 ++++++++++++++++++++++++++++
 gold/testsuite/Makefile.in   |   55 +++++++++++++++++++++++++++++++++++-------
 gold/testsuite/split_x32.sh  |   55 ++++++++++++++++++++++++++++++++++++++++++
 gold/testsuite/split_x32_1.s |   33 +++++++++++++++++++++++++
 gold/testsuite/split_x32_2.s |   33 +++++++++++++++++++++++++
 gold/testsuite/split_x32_3.s |   22 ++++++++++++++++
 gold/testsuite/split_x32_4.s |   23 +++++++++++++++++
 gold/testsuite/split_x32_n.s |   12 +++++++++
 gold/x86_64.cc               |   33 +++++++++++++++++++++----
 12 files changed, 357 insertions(+), 16 deletions(-)
 create mode 100755 gold/testsuite/split_x32.sh
 create mode 100644 gold/testsuite/split_x32_1.s
 create mode 100644 gold/testsuite/split_x32_2.s
 create mode 100644 gold/testsuite/split_x32_3.s
 create mode 100644 gold/testsuite/split_x32_4.s
 create mode 100644 gold/testsuite/split_x32_n.s
Comment 4 H.J. Lu 2015-01-07 00:52:27 UTC
Fixed for 2.26 and the next 2.25 release.
Comment 5 Sourceware Commits 2015-01-07 00:52:38 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  10edae5c53dcbfa55b5e2e53028456a78602f1ca (commit)
      from  bc9f29556811fffefa06171993719a503f7b0c65 (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=10edae5c53dcbfa55b5e2e53028456a78602f1ca

commit 10edae5c53dcbfa55b5e2e53028456a78602f1ca
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 18 11:09:28 2014 -0800

    Handle stack split for x32
    
    X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
    instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
    This patch handles it.
    
    	PR gold/17729
    	* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
    	(DEFAULT_TARGET_X32): Set for x32.
    	* x86_64.cc (cmp_insn_32): New.
    	(lea_r10_insn_32): Likewise.
    	(lea_r11_insn_32): Likewise.
    	(cmp_insn_64): Likewise.
    	(lea_r10_insn_64): Likewise.
    	(lea_r11_insn_64): Likewise.
    	(Target_x86_64<size>::do_calls_non_split): Handle x32.
    	* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
    	(check_DATA): Add split_x32 files.
    	(split_x32_[1234n].o): New targets.
    	(split_x32_[124]): New targets.
    	(split_x32_[1234r].stdout): New targets.
    	* testsuite/split_x32.sh: New file.
    	* testsuite/split_x32_1.s: Likewise.
    	* testsuite/split_x32_2.s: Likewise.
    	* testsuite/split_x32_3.s: Likewise.
    	* testsuite/split_x32_4.s: Likewise.
    	* testsuite/split_x32_n.s: Likewise.
    	* configure: Regenerated.
    	* testsuite/Makefile.in: Likewise.

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

Summary of changes:
 gold/ChangeLog               |   27 ++++++++++++++++++++
 gold/configure               |   28 ++++++++++++++++++++-
 gold/configure.ac            |   15 ++++++++++-
 gold/testsuite/Makefile.am   |   37 ++++++++++++++++++++++++++++
 gold/testsuite/Makefile.in   |   55 +++++++++++++++++++++++++++++++++++-------
 gold/testsuite/split_x32.sh  |   55 ++++++++++++++++++++++++++++++++++++++++++
 gold/testsuite/split_x32_1.s |   33 +++++++++++++++++++++++++
 gold/testsuite/split_x32_2.s |   33 +++++++++++++++++++++++++
 gold/testsuite/split_x32_3.s |   22 ++++++++++++++++
 gold/testsuite/split_x32_4.s |   23 +++++++++++++++++
 gold/testsuite/split_x32_n.s |   12 +++++++++
 gold/x86_64.cc               |   33 +++++++++++++++++++++----
 12 files changed, 357 insertions(+), 16 deletions(-)
 create mode 100755 gold/testsuite/split_x32.sh
 create mode 100644 gold/testsuite/split_x32_1.s
 create mode 100644 gold/testsuite/split_x32_2.s
 create mode 100644 gold/testsuite/split_x32_3.s
 create mode 100644 gold/testsuite/split_x32_4.s
 create mode 100644 gold/testsuite/split_x32_n.s