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>

@@ -25,10 +25,11 @@
  *
  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
+ * Copyright 2017 RackTop Systems.
  */
 
 /*
  * Publicly available flags are defined in ld(1).   The following flags are
  * private, and may be removed at any time.

@@ -1235,10 +1236,18 @@
 
                 case 'z':
                         DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, optarg));
 
                         /*
+                         * Skip comma that might be present between -z and its
+                         * argument (e.g. if -Wl,-z,assert-deflib was passed).
+                         */
+                        if (strncmp(optarg, MSG_ORIG(MSG_STR_COMMA),
+                             MSG_STR_COMMA_SIZE) == 0)
+                                optarg++;
+
+                        /*
                          * For specific help, print our usage message and exit
                          * immediately to ensure a 0 return code.
                          */
                         if (strncmp(optarg, MSG_ORIG(MSG_ARG_HELP),
                             MSG_ARG_HELP_SIZE) == 0) {