Print this page
8616 ld has trouble parsing -z options specified with -Wl
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/args.c
          +++ new/usr/src/cmd/sgs/libld/common/args.c
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   */
  21   21  
  22   22  /*
  23   23   *      Copyright (c) 1988 AT&T
  24   24   *        All Rights Reserved
  25   25   *
  26   26   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  27   27   */
  28   28  /*
  29   29   * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
       30 + * Copyright 2017 RackTop Systems.
  30   31   */
  31   32  
  32   33  /*
  33   34   * Publicly available flags are defined in ld(1).   The following flags are
  34   35   * private, and may be removed at any time.
  35   36   *
  36   37   *    OPTION                    MEANING
  37   38   *
  38   39   *    -z dtrace=symbol          assigns symbol to PT_SUNWDTRACE segment,
  39   40   *                              providing scratch area for dtrace processing.
↓ open down ↓ 1190 lines elided ↑ open up ↑
1230 1231                          break;
1231 1232  
1232 1233                  case 'u':
1233 1234                          DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, optarg));
1234 1235                          break;
1235 1236  
1236 1237                  case 'z':
1237 1238                          DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, optarg));
1238 1239  
1239 1240                          /*
     1241 +                         * Skip comma that might be present between -z and its
     1242 +                         * argument (e.g. if -Wl,-z,assert-deflib was passed).
     1243 +                         */
     1244 +                        if (strncmp(optarg, MSG_ORIG(MSG_STR_COMMA),
     1245 +                             MSG_STR_COMMA_SIZE) == 0)
     1246 +                                optarg++;
     1247 +
     1248 +                        /*
1240 1249                           * For specific help, print our usage message and exit
1241 1250                           * immediately to ensure a 0 return code.
1242 1251                           */
1243 1252                          if (strncmp(optarg, MSG_ORIG(MSG_ARG_HELP),
1244 1253                              MSG_ARG_HELP_SIZE) == 0) {
1245 1254                                  usage_mesg(TRUE);
1246 1255                                  exit(0);
1247 1256                          }
1248 1257  
1249 1258                          /*
↓ open down ↓ 925 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX