Print this page
7319 Need a way to turn off ld "multiple inclusion" warnings
Reviewed by: Martin Bochnig <opensxce@mail.ru>
Reviewed by: Kim Shrier <kshrier@racktopsystems.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


   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 (c) 2012, Joyent, Inc. All rights reserved.

  28  */
  29 
  30 /*
  31  * Processing of relocatable objects and shared objects.
  32  */
  33 
  34 #define ELF_TARGET_AMD64
  35 #define ELF_TARGET_SPARC
  36 
  37 #include        <stdio.h>
  38 #include        <string.h>
  39 #include        <fcntl.h>
  40 #include        <unistd.h>
  41 #include        <link.h>
  42 #include        <limits.h>
  43 #include        <sys/stat.h>
  44 #include        <sys/systeminfo.h>
  45 #include        <debug.h>
  46 #include        <msg.h>
  47 #include        <_libld.h>


3223 
3224                                 if ((ifl->ifl_stino != status.st_ino) ||
3225                                     (ifl->ifl_stdev != status.st_dev))
3226                                         continue;
3227 
3228                                 /*
3229                                  * Disregard (skip) this image.
3230                                  */
3231                                 DBG_CALL(Dbg_file_skip(ofl->ofl_lml,
3232                                     ifl->ifl_name, name));
3233                                 (void) elf_end(elf);
3234 
3235                                 /*
3236                                  * If the file was explicitly defined on the
3237                                  * command line (this is always the case for
3238                                  * relocatable objects, and is true for shared
3239                                  * objects when they weren't specified via -l or
3240                                  * were dragged in as an implicit dependency),
3241                                  * then warn the user.
3242                                  */
3243                                 if ((flags & FLG_IF_CMDLINE) ||
3244                                     (ifl->ifl_flags & FLG_IF_CMDLINE)) {

3245                                         const char      *errmsg;
3246 
3247                                         /*
3248                                          * Determine whether this is the same
3249                                          * file name as originally encountered
3250                                          * so as to provide the most
3251                                          * descriptive diagnostic.
3252                                          */
3253                                         errmsg =
3254                                             (strcmp(name, ifl->ifl_name) == 0) ?
3255                                             MSG_INTL(MSG_FIL_MULINC_1) :
3256                                             MSG_INTL(MSG_FIL_MULINC_2);
3257                                         ld_eprintf(ofl, ERR_WARNING,
3258                                             errmsg, name, ifl->ifl_name);
3259                                 }
3260                                 if (ifl_ret)
3261                                         *ifl_ret = ifl;
3262                                 return (1);
3263                         }
3264                 }




   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 (c) 2012, Joyent, Inc. All rights reserved.
  28  * Copyright 2016 RackTop Systems.
  29  */
  30 
  31 /*
  32  * Processing of relocatable objects and shared objects.
  33  */
  34 
  35 #define ELF_TARGET_AMD64
  36 #define ELF_TARGET_SPARC
  37 
  38 #include        <stdio.h>
  39 #include        <string.h>
  40 #include        <fcntl.h>
  41 #include        <unistd.h>
  42 #include        <link.h>
  43 #include        <limits.h>
  44 #include        <sys/stat.h>
  45 #include        <sys/systeminfo.h>
  46 #include        <debug.h>
  47 #include        <msg.h>
  48 #include        <_libld.h>


3224 
3225                                 if ((ifl->ifl_stino != status.st_ino) ||
3226                                     (ifl->ifl_stdev != status.st_dev))
3227                                         continue;
3228 
3229                                 /*
3230                                  * Disregard (skip) this image.
3231                                  */
3232                                 DBG_CALL(Dbg_file_skip(ofl->ofl_lml,
3233                                     ifl->ifl_name, name));
3234                                 (void) elf_end(elf);
3235 
3236                                 /*
3237                                  * If the file was explicitly defined on the
3238                                  * command line (this is always the case for
3239                                  * relocatable objects, and is true for shared
3240                                  * objects when they weren't specified via -l or
3241                                  * were dragged in as an implicit dependency),
3242                                  * then warn the user.
3243                                  */
3244                                 if (((flags & FLG_IF_CMDLINE) ||
3245                                     (ifl->ifl_flags & FLG_IF_CMDLINE)) &&
3246                                     !(ofl->ofl_flags & FLG_OF_MULINCL)) {
3247                                         const char      *errmsg;
3248 
3249                                         /*
3250                                          * Determine whether this is the same
3251                                          * file name as originally encountered
3252                                          * so as to provide the most
3253                                          * descriptive diagnostic.
3254                                          */
3255                                         errmsg =
3256                                             (strcmp(name, ifl->ifl_name) == 0) ?
3257                                             MSG_INTL(MSG_FIL_MULINC_1) :
3258                                             MSG_INTL(MSG_FIL_MULINC_2);
3259                                         ld_eprintf(ofl, ERR_WARNING,
3260                                             errmsg, name, ifl->ifl_name);
3261                                 }
3262                                 if (ifl_ret)
3263                                         *ifl_ret = ifl;
3264                                 return (1);
3265                         }
3266                 }