From 202ca9ae460faf1825ede303c46abd4e1f6cee28 Mon Sep 17 00:00:00 2001 From: Andrew Stormont Date: Sat, 29 Jul 2017 23:36:43 +0100 Subject: 8616 ld has trouble parsing -z options specified with -Wl Reviewed by: Toomas Soome Reviewed by: Yuri Pankov Approved by: Richard Lowe --- usr/src/cmd/sgs/libld/common/args.c | 9 +++++++++ usr/src/cmd/sgs/libld/common/libld.msg | 2 ++ usr/src/cmd/sgs/packages/common/SUNWonld-README | 1 + 3 files changed, 12 insertions(+) diff --git a/usr/src/cmd/sgs/libld/common/args.c b/usr/src/cmd/sgs/libld/common/args.c index d130f4ecf3..c737ea9065 100644 --- a/usr/src/cmd/sgs/libld/common/args.c +++ b/usr/src/cmd/sgs/libld/common/args.c @@ -27,6 +27,7 @@ */ /* * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright 2017 RackTop Systems. */ /* @@ -1236,6 +1237,14 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *usage) 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. diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index 26c0e33054..45a90b0e82 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -25,6 +25,7 @@ # # Copyright (c) 2012, Joyent, Inc. All rights reserved. +# Copyright 2017 RackTop Systems. # @ _START_ @@ -730,6 +731,7 @@ @ MSG_QSTR_STAR "'*'" @ MSG_STR_DOT "." @ MSG_STR_SLASH "/" +@ MSG_STR_COMMA "," @ MSG_STR_DYNAMIC "(.dynamic)" @ MSG_STR_ORIGIN "$ORIGIN" @ MSG_STR_MACHINE "$MACHINE" diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 0f3d5f67bd..b895773d15 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1660,3 +1660,4 @@ Bugid Risk Synopsis 6252 ld should merge function/data-sections in the same manner as GNU ld 7323 ld(1) -zignore can erroneously discard init and fini arrays as unreferenced 7594 ld -zaslr should accept Solaris-compatible values +8616 ld has trouble parsing -z options specified with -Wl -- cgit v1.2.3