RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1261016 - When building a cross-gcc, ld SEGV's when creating the ppc32 BE shared libgcc
Summary: When building a cross-gcc, ld SEGV's when creating the ppc32 BE shared libgcc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: binutils
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Nick Clifton
QA Contact: Miloš Prchlík
URL:
Whiteboard:
Depends On:
Blocks: 1297579 1313485
TreeView+ depends on / blocked
 
Reported: 2015-09-08 12:33 UTC by David Howells
Modified: 2016-11-04 01:53 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Attempting to link big-endian PowerPC binaries using a cross-hosted linker would fail due to the linker generating a segmentation fault. Consequence: Unable to link big-endian PPC binaries if not using a native PPC toolchain. Fix: Update a PowerPC patch that was being applied to the linker sources so that it would work even when building a cross toolchain. Result: Big-endian PowerPC binaries (both 32-bit and 64-bit) can now be linked using a cross-hosted toolchain.
Clone Of:
Environment:
Last Closed: 2016-11-04 01:53:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Objects to install in /tmp/objects/ for failing command to process (1018.30 KB, application/octet-stream)
2015-09-08 12:37 UTC, David Howells
no flags Details
Specfile for building RHEL-7.2 cross compilers (23.83 KB, text/plain)
2015-09-08 13:17 UTC, David Howells
no flags Details
Altered version of bfd-ppc64le.patch (4.94 KB, patch)
2015-09-08 14:48 UTC, Nick Clifton
no flags Details | Diff
Updated spec file (23.98 KB, text/plain)
2015-09-08 14:49 UTC, Nick Clifton
no flags Details
Objects to install in /tmp/objects2/ for failing ppc64 BE command to process (1015.55 KB, application/octet-stream)
2015-09-09 15:19 UTC, David Howells
no flags Details
Revised additional patch (5.64 KB, patch)
2015-09-10 08:15 UTC, Nick Clifton
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2265 0 normal SHIPPED_LIVE binutils bug fix update 2016-11-03 13:33:42 UTC

Description David Howells 2015-09-08 12:33:14 UTC
Description of problem:

I'm using the sources from the RHEL-7.2 binutils and gcc to build cross-toolchains that can be hosted on non-RHEL-7 platforms to target the RHEL-7.2 environment.

The linker, however, SEGVs when building the shared libgcc for ppc32 BE and at least one other time according to the log.

Version-Release number of selected component (if applicable):

gcc-4.8.5-20150702
binutils-2.23.52.0.1-54

How reproducible:

100%

Steps to Reproduce:
1. Unpack the object tarball in /tmp/objects
2. Run:

/usr/bin/powerpc64-rhel72-linux-gnu-ld \
    --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -V -shared \
    -m elf32ppclinux -o /tmp/libgcc_s.so.1.tmp \
    crti.o crtbeginS.o \
    -L/tmp/objects \
    --soname=libgcc_s.so.1 \
    --version-script=libgcc.map \
    _muldi3_s.o \
    _negdi2_s.o \
    _lshrdi3_s.o \
    _ashldi3_s.o \
    _ashrdi3_s.o \
    _cmpdi2_s.o \
    _ucmpdi2_s.o \
    _clear_cache_s.o \
    _trampoline_s.o \
    __main_s.o \
    _absvsi2_s.o \
    _absvdi2_s.o \
    _addvsi3_s.o \
    _addvdi3_s.o \
    _subvsi3_s.o \
    _subvdi3_s.o \
    _mulvsi3_s.o \
    _mulvdi3_s.o \
    _negvsi2_s.o \
    _negvdi2_s.o \
    _ctors_s.o \
    _ffssi2_s.o \
    _ffsdi2_s.o \
    _clz_s.o \
    _clzsi2_s.o \
    _clzdi2_s.o \
    _ctzsi2_s.o \
    _ctzdi2_s.o \
    _popcount_tab_s.o \
    _popcountsi2_s.o \
    _popcountdi2_s.o \
    _paritysi2_s.o \
    _paritydi2_s.o \
    _powisf2_s.o \
    _powidf2_s.o \
    _powixf2_s.o \
    _powitf2_s.o \
    _mulsc3_s.o \
    _muldc3_s.o \
    _mulxc3_s.o \
    _multc3_s.o \
    _divsc3_s.o \
    _divdc3_s.o \
    _divxc3_s.o \
    _divtc3_s.o \
    _bswapsi2_s.o \
    _bswapdi2_s.o \
    _clrsbsi2_s.o \
    _clrsbdi2_s.o \
    _fixunssfsi_s.o \
    _fixunsdfsi_s.o \
    _fixunsxfsi_s.o \
    _fixsfdi_s.o \
    _fixdfdi_s.o \
    _fixxfdi_s.o \
    _fixtfdi_s.o \
    _fixunssfdi_s.o \
    _fixunsdfdi_s.o \
    _fixunsxfdi_s.o \
    _fixunstfdi_s.o \
    _floatdisf_s.o \
    _floatdidf_s.o \
    _floatdixf_s.o \
    _floatditf_s.o \
    _floatundisf_s.o \
    _floatundidf_s.o \
    _floatundixf_s.o \
    _floatunditf_s.o \
    _divdi3_s.o \
    _moddi3_s.o \
    _udivdi3_s.o \
    _umoddi3_s.o \
    _udiv_w_sdiv_s.o \
    _udivmoddi4_s.o \
    ibm-ldouble_s.o \
    tramp_s.o \
    ppc64-fp_s.o \
    addsf3_s.o \
    divsf3_s.o \
    eqsf2_s.o \
    gesf2_s.o \
    lesf2_s.o \
    mulsf3_s.o \
    negsf2_s.o \
    subsf3_s.o \
    unordsf2_s.o \
    fixsfsi_s.o \
    floatsisf_s.o \
    floatunsisf_s.o \
    adddf3_s.o \
    divdf3_s.o \
    eqdf2_s.o \
    gedf2_s.o \
    ledf2_s.o \
    muldf3_s.o \
    negdf2_s.o \
    subdf3_s.o \
    unorddf2_s.o \
    fixdfsi_s.o \
    floatsidf_s.o \
    floatunsidf_s.o \
    extendsfdf2_s.o \
    truncdfsf2_s.o \
    enable-execute-stack_s.o \
    unwind-dw2_s.o \
    unwind-dw2-fde-dip_s.o \
    unwind-sjlj_s.o \
    unwind-c_s.o \
    emutls_s.o \
    libgcc.a \
    ./libc-2.17.so \
    crtendS.o \
    crtn.o

Actual results:


Expected results:


Additional info:

Comment 2 David Howells 2015-09-08 12:37:34 UTC
Created attachment 1071335 [details]
Objects to install in /tmp/objects/ for failing command to process

Comment 3 David Howells 2015-09-08 12:41:13 UTC
Here's a backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x000000000048c074 in ppc_elf_reloc_type_class (info=0xc89c60, rel_sec=0x7ce1d8, rela=0x80000000) at ../../binutils-2.23.52.0.1/bfd/elf32-ppc.c:9356
9356      struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
Missing separate debuginfos, use: debuginfo-install zlib-1.2.8-7.fc21.x86_64
(gdb) bt
#0  0x000000000048c074 in ppc_elf_reloc_type_class (info=0xc89c60, rel_sec=0x7ce1d8, rela=0x80000000) at ../../binutils-2.23.52.0.1/bfd/elf32-ppc.c:9356
#1  0x00000000004849ea in elf_link_sort_relocs (psec=<synthetic pointer>, info=0x78ad00 <link_info>, abfd=0x7ac5c0)
    at ../../binutils-2.23.52.0.1/bfd/elflink.c:8502
#2  bfd_elf_final_link (abfd=0x7ac5c0, info=0x78ad00 <link_info>) at ../../binutils-2.23.52.0.1/bfd/elflink.c:11394
#3  0x000000000041952e in ldwrite () at ../../binutils-2.23.52.0.1/ld/ldwrite.c:582
#4  0x00000000004037f5 in main (argc=129, argv=0x7fffffffdda8) at ../../binutils-2.23.52.0.1/ld/ldmain.c:400

Comment 4 David Howells 2015-09-08 13:17:42 UTC
Created attachment 1071358 [details]
Specfile for building RHEL-7.2 cross compilers

Here's the specfile for building the RHEL-7.2 cross binutils. Just add the sources from the regular RHEL-7.2 binutils package.

If only the x86_64 and s390x cross-compilers aren't required, near the top of the specfile find this bit:

%define build_rhel		1
%define build_powerpc64 	%{build_rhel}
%define build_powerpc64le 	%{build_rhel}
%define build_s390x 		%{build_rhel}
%define build_x86_64 		%{build_rhel}

Change build_rhel to 0 and build_powerpc64 to 1.  Don't bother with build_powerpc64le as it's redundant.

Comment 5 Nick Clifton 2015-09-08 14:48:32 UTC
Created attachment 1071386 [details]
Altered version of bfd-ppc64le.patch

Comment 6 Nick Clifton 2015-09-08 14:49:04 UTC
Created attachment 1071387 [details]
Updated spec file

Comment 8 Nick Clifton 2015-09-08 15:06:55 UTC
Hi David,

  The problem is the bfd-ppc64le.patch file.  I tries to make powerpc64 specific changes to generic parts of the linker, but it was guarding these changes with a check for #ifdef __PPC__.  Unfortunately that symbol is only defined if the *host* compiler is a ppc64 compiler, ie only when building a native ppc64 linker.  If you are building a cross hosted ppc64 linker then __PPC__ is not defined, and the patches in bfd-ppc64le.patch do not work.

  I have uploaded a new patch file pfd-ppc64le.2.patch and a new spec file which includes it.  You will note that I have left the old bfd-ppc64le.patch file in the spec file.  This is just laziness on my part.  It was simpler to do this than to remove the bfd-pp64le.patch and create a new, replacement patch instead.

  Please try out the new patch and let me know how you get on.  Also please let me know if you would prefer it if I created a replacement patch for bfd-ppc64le.patch, rather than a supplemental patch.

Cheers
  Nick

Comment 13 David Howells 2015-09-09 15:17:10 UTC
Okay, I can build a ppc32 libgcc okay, but the ppc64 BE shared libgcc now fails with the linker SEGV'ing when called from collect2.  Using the following command upon a set of objects extracted into a directory from an archive I'll upload shortly:

/usr/bin/powerpc64-rhel72-linux-gnu-ld \
    --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu \
    -V -shared \
    -m elf64ppc \
    -o ./libgcc_s.so.1.tmp \
    crti.o \
    crtbeginS.o \
    -L. \
    --soname=libgcc_s.so.1 \
    --version-script=libgcc.map \
    _muldi3_s.o \
    _negdi2_s.o \
    _lshrdi3_s.o \
    _ashldi3_s.o \
    _ashrdi3_s.o \
    _cmpdi2_s.o \
    _ucmpdi2_s.o \
    _clear_cache_s.o \
    _trampoline_s.o \
    __main_s.o \
    _absvsi2_s.o \
    _absvdi2_s.o \
    _addvsi3_s.o \
    _addvdi3_s.o \
    _subvsi3_s.o \
    _subvdi3_s.o \
    _mulvsi3_s.o \
    _mulvdi3_s.o \
    _negvsi2_s.o \
    _negvdi2_s.o \
    _ctors_s.o \
    _ffssi2_s.o \
    _ffsdi2_s.o \
    _clz_s.o \
    _clzsi2_s.o \
    _clzdi2_s.o \
    _ctzsi2_s.o \
    _ctzdi2_s.o \
    _popcount_tab_s.o \
    _popcountsi2_s.o \
    _popcountdi2_s.o \
    _paritysi2_s.o \
    _paritydi2_s.o \
    _powisf2_s.o \
    _powidf2_s.o \
    _powixf2_s.o \
    _powitf2_s.o \
    _mulsc3_s.o \
    _muldc3_s.o \
    _mulxc3_s.o \
    _multc3_s.o \
    _divsc3_s.o \
    _divdc3_s.o \
    _divxc3_s.o \
    _divtc3_s.o \
    _bswapsi2_s.o \
    _bswapdi2_s.o \
    _clrsbsi2_s.o \
    _clrsbdi2_s.o \
    _fixunssfsi_s.o \
    _fixunsdfsi_s.o \
    _fixunsxfsi_s.o \
    _fixsfdi_s.o \
    _fixdfdi_s.o \
    _fixxfdi_s.o \
    _fixtfdi_s.o \
    _fixunssfdi_s.o \
    _fixunsdfdi_s.o \
    _fixunsxfdi_s.o \
    _fixunstfdi_s.o \
    _floatdisf_s.o \
    _floatdidf_s.o \
    _floatdixf_s.o \
    _floatditf_s.o \
    _floatundisf_s.o \
    _floatundidf_s.o \
    _floatundixf_s.o \
    _floatunditf_s.o \
    _divdi3_s.o \
    _moddi3_s.o \
    _udivdi3_s.o \
    _umoddi3_s.o \
    _udiv_w_sdiv_s.o \
    _udivmoddi4_s.o \
    ibm-ldouble_s.o \
    tramp_s.o \
    ppc64-fp_s.o \
    addsf3_s.o \
    divsf3_s.o \
    eqsf2_s.o \
    gesf2_s.o \
    lesf2_s.o \
    mulsf3_s.o \
    negsf2_s.o \
    subsf3_s.o \
    unordsf2_s.o \
    fixsfsi_s.o \
    floatsisf_s.o \
    floatunsisf_s.o \
    adddf3_s.o \
    divdf3_s.o \
    eqdf2_s.o \
    gedf2_s.o \
    ledf2_s.o \
    muldf3_s.o \
    negdf2_s.o \
    subdf3_s.o \
    unorddf2_s.o \
    fixdfsi_s.o \
    floatsidf_s.o \
    floatunsidf_s.o \
    extendsfdf2_s.o \
    truncdfsf2_s.o \
    enable-execute-stack_s.o \
    unwind-dw2_s.o \
    unwind-dw2-fde-dip_s.o \
    unwind-sjlj_s.o \
    unwind-c_s.o \
    emutls_s.o \
    libgcc.a \
    ./libc-2.17.so \
    crtendS.o \
    crtn.o

Comment 14 David Howells 2015-09-09 15:19:02 UTC
Created attachment 1071813 [details]
Objects to install in /tmp/objects2/ for failing ppc64 BE command to process

Comment 15 Ed Rosenbloom 2015-09-10 00:11:14 UTC
I applied the patch to the binutils src that is part of the RHEL7.2 beta build. The result was the same,  ld core dumps sigsegv when trying to link libgcc...

I am trying to create  a cross toolchain on RHEL6.3 x86_64 targeted at powerpc64le

Comment 16 Nick Clifton 2015-09-10 08:15:37 UTC
Created attachment 1072058 [details]
Revised additional patch

*sigh*  I forgot to check the 64-bit ppc case.  Sorry about that.  I have uploaded a revised version of the new patch which should make both 32-bit and 64-bit ppc work.

Cheers
  Nick

Comment 17 David Howells 2015-09-10 10:42:05 UTC
I can build the compiler now, thanks!

Comment 18 Ed Rosenbloom 2015-09-11 18:35:02 UTC
After applying this latest patch, I am now able to build the compiler for the ppc64le-redhat-linux target.  Thank you.

Comment 19 Nick Clifton 2016-01-29 11:40:43 UTC
The new 7.3 binutils should avoid the need for the patches uploaded here and instead just work.  Changing to MODIFIED so that QE can test/verify.

Comment 21 Miloš Prchlík 2016-06-27 14:51:39 UTC
Verified for build binutils-2.25.1-20.base.el7.

Comment 25 errata-xmlrpc 2016-11-04 01:53:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2265.html


Note You need to log in before you can comment on or make changes to this bug.