Print this page
8509 ld has a trouble linking c++ code built by GCC 7.1


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  *      Copyright (c) 1988 AT&T
  24  *        All Rights Reserved
  25  *
  26  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.

  27  */
  28 
  29 /*
  30  * set-up for relocations
  31  */
  32 
  33 #define ELF_TARGET_AMD64
  34 #define ELF_TARGET_SPARC
  35 
  36 #include        <string.h>
  37 #include        <stdio.h>
  38 #include        <alloca.h>
  39 #include        <debug.h>
  40 #include        "msg.h"
  41 #include        "_libld.h"
  42 
  43 /*
  44  * Set up the relocation table flag test macros so that they use the
  45  * relocation table for the current target machine.
  46  */


1996                          */
1997                         if ((ofl->ofl_flags1 & FLG_OF1_RLXREL) &&
1998                             sdp->sd_isc->is_osdesc &&
1999                             (sdp->sd_isc->is_flags & FLG_IS_COMDAT) &&
2000                             ((nsdp = sloppy_comdat_reloc(ofl, reld,
2001                             sdp, &reject)) == NULL)) {
2002                                 Shdr    *is_shdr = reld->rel_isdesc->is_shdr;
2003 
2004                                 /*
2005                                  * A matching symbol was not found. We will
2006                                  * ignore this relocation.  Determine whether
2007                                  * or not to issue a warning.
2008                                  * Warnings are always issued under -z verbose,
2009                                  * but otherwise, we will follow the lead of
2010                                  * the GNU ld and suppress them for certain
2011                                  * cases:
2012                                  *
2013                                  *  -   It is a non-allocable debug section.
2014                                  *      The GNU ld tests for these by name,
2015                                  *      but we are willing to extend it to
2016                                  *      any non-allocable section.
2017                                  *  -   The target section is excluded from
2018                                  *      sloppy relocations by policy.
2019                                  */
2020                                 if (((ofl->ofl_flags & FLG_OF_VERBOSE) != 0) ||
2021                                     ((is_shdr->sh_flags & SHF_ALLOC) &&

2022                                     (reject != RLXREL_REJ_TARGET)))
2023                                         ld_eprintf(ofl, ERR_WARNING,
2024                                             MSG_INTL(MSG_REL_SLOPCDATNOSYM),
2025                                             conv_reloc_type(
2026                                             ifl->ifl_ehdr->e_machine,
2027                                             reld->rel_rtype, 0, &inv_buf),
2028                                             ifl->ifl_name,
2029                                             EC_WORD(isp->is_scnndx),
2030                                             isp->is_name,
2031                                             ld_reloc_sym_name(reld),
2032                                             EC_WORD(sdp->sd_isc->is_scnndx),
2033                                             sdp->sd_isc->is_name);
2034                                 return (1);
2035                         }
2036                 } else if ((sdp != NULL) && sdp->sd_name && *sdp->sd_name)
2037                         nsdp = ld_sym_find(sdp->sd_name, SYM_NOHASH, NULL, ofl);
2038 
2039                 if (nsdp == NULL) {
2040                         ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_REL_SYMDISC),
2041                             conv_reloc_type(ifl->ifl_ehdr->e_machine,




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  *      Copyright (c) 1988 AT&T
  24  *        All Rights Reserved
  25  *
  26  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  27  * Copyright 2017 RackTop Systems.
  28  */
  29 
  30 /*
  31  * set-up for relocations
  32  */
  33 
  34 #define ELF_TARGET_AMD64
  35 #define ELF_TARGET_SPARC
  36 
  37 #include        <string.h>
  38 #include        <stdio.h>
  39 #include        <alloca.h>
  40 #include        <debug.h>
  41 #include        "msg.h"
  42 #include        "_libld.h"
  43 
  44 /*
  45  * Set up the relocation table flag test macros so that they use the
  46  * relocation table for the current target machine.
  47  */


1997                          */
1998                         if ((ofl->ofl_flags1 & FLG_OF1_RLXREL) &&
1999                             sdp->sd_isc->is_osdesc &&
2000                             (sdp->sd_isc->is_flags & FLG_IS_COMDAT) &&
2001                             ((nsdp = sloppy_comdat_reloc(ofl, reld,
2002                             sdp, &reject)) == NULL)) {
2003                                 Shdr    *is_shdr = reld->rel_isdesc->is_shdr;
2004 
2005                                 /*
2006                                  * A matching symbol was not found. We will
2007                                  * ignore this relocation.  Determine whether
2008                                  * or not to issue a warning.
2009                                  * Warnings are always issued under -z verbose,
2010                                  * but otherwise, we will follow the lead of
2011                                  * the GNU ld and suppress them for certain
2012                                  * cases:
2013                                  *
2014                                  *  -   It is a non-allocable debug section.
2015                                  *      The GNU ld tests for these by name,
2016                                  *      but we are willing to extend it to
2017                                  *      any non-allocable/read-only section.
2018                                  *  -   The target section is excluded from
2019                                  *      sloppy relocations by policy.
2020                                  */
2021                                 if (((ofl->ofl_flags & FLG_OF_VERBOSE) != 0) ||
2022                                     ((is_shdr->sh_flags & SHF_ALLOC) &&
2023                                     (is_shdr->sh_flags & SHF_WRITE) &&
2024                                     (reject != RLXREL_REJ_TARGET)))
2025                                         ld_eprintf(ofl, ERR_WARNING,
2026                                             MSG_INTL(MSG_REL_SLOPCDATNOSYM),
2027                                             conv_reloc_type(
2028                                             ifl->ifl_ehdr->e_machine,
2029                                             reld->rel_rtype, 0, &inv_buf),
2030                                             ifl->ifl_name,
2031                                             EC_WORD(isp->is_scnndx),
2032                                             isp->is_name,
2033                                             ld_reloc_sym_name(reld),
2034                                             EC_WORD(sdp->sd_isc->is_scnndx),
2035                                             sdp->sd_isc->is_name);
2036                                 return (1);
2037                         }
2038                 } else if ((sdp != NULL) && sdp->sd_name && *sdp->sd_name)
2039                         nsdp = ld_sym_find(sdp->sd_name, SYM_NOHASH, NULL, ofl);
2040 
2041                 if (nsdp == NULL) {
2042                         ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_REL_SYMDISC),
2043                             conv_reloc_type(ifl->ifl_ehdr->e_machine,