Print this page
8411 Build should warn when linking against libraries outside proto area


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   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 2011, Richard Lowe.

  24  */
  25 /*
  26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 /*
  31  * Wrapper for the GNU C compiler to make it accept the Sun C compiler
  32  * arguments where possible.
  33  *
  34  * Since the translation is inexact, this is something of a work-in-progress.
  35  *
  36  */
  37 
  38 /* If you modify this file, you must increment CW_VERSION */
  39 #define CW_VERSION      "1.30"
  40 
  41 /*
  42  * -#           Verbose mode
  43  * -###         Show compiler commands built by driver, no compilation
  44  * -A<name[(tokens)]>     Preprocessor predicate assertion
  45  * -B<[static|dynamic]>   Specify dynamic or static binding
  46  * -C           Prevent preprocessor from removing comments
  47  * -c           Compile only - produce .o files, suppress linking
  48  * -cg92        Alias for -xtarget=ss1000
  49  * -D<name[=token]>       Associate name with token as if by #define
  50  * -d[y|n]      dynamic [-dy] or static [-dn] option to linker
  51  * -E           Compile source through preprocessor only, output to stdout
  52  * -erroff=<t>    Suppress warnings specified by tags t(%none, %all, <tag list>)
  53  * -errtags=<a>   Display messages with tags a(no, yes)
  54  * -errwarn=<t>   Treats warnings specified by tags t(%none, %all, <tag list>)
  55  *              as errors
  56  * -fast        Optimize using a selection of options
  57  * -fd          Report old-style function definitions and declarations
  58  * -features=zla        Allow zero-length arrays
  59  * -flags       Show this summary of compiler options


1377                         case 'h':
1378                         case 'l':
1379                         default:
1380                                 error(arg);
1381                                 break;
1382                         }
1383                         break;
1384                 case 'Y':
1385                         if (arglen == 1) {
1386                                 if ((arg = *++ctx->i_oldargv) == NULL ||
1387                                     *arg == '\0')
1388                                         error("-Y");
1389                                 ctx->i_oldargc--;
1390                                 arglen = strlen(arg + 1);
1391                         } else {
1392                                 arg += 2;
1393                         }
1394                         /* Just ignore -YS,... for now */
1395                         if (strncmp(arg, "S,", 2) == 0)
1396                                 break;








1397                         if (strncmp(arg, "l,", 2) == 0) {
1398                                 char *s = strdup(arg);
1399                                 s[0] = '-';
1400                                 s[1] = 'B';
1401                                 newae(ctx->i_ae, s);
1402                                 free(s);
1403                                 break;
1404                         }
1405                         if (strncmp(arg, "I,", 2) == 0) {
1406                                 char *s = strdup(arg);
1407                                 s[0] = '-';
1408                                 s[1] = 'I';
1409                                 newae(ctx->i_ae, "-nostdinc");
1410                                 newae(ctx->i_ae, s);
1411                                 free(s);
1412                                 break;
1413                         }
1414                         error(arg);
1415                         break;
1416                 case 'Q':




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   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 2011, Richard Lowe.
  24  * Copyright 2017 RackTop Systems.
  25  */
  26 /*
  27  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */
  30 
  31 /*
  32  * Wrapper for the GNU C compiler to make it accept the Sun C compiler
  33  * arguments where possible.
  34  *
  35  * Since the translation is inexact, this is something of a work-in-progress.
  36  *
  37  */
  38 
  39 /* If you modify this file, you must increment CW_VERSION */
  40 #define CW_VERSION      "1.31"
  41 
  42 /*
  43  * -#           Verbose mode
  44  * -###         Show compiler commands built by driver, no compilation
  45  * -A<name[(tokens)]>     Preprocessor predicate assertion
  46  * -B<[static|dynamic]>   Specify dynamic or static binding
  47  * -C           Prevent preprocessor from removing comments
  48  * -c           Compile only - produce .o files, suppress linking
  49  * -cg92        Alias for -xtarget=ss1000
  50  * -D<name[=token]>       Associate name with token as if by #define
  51  * -d[y|n]      dynamic [-dy] or static [-dn] option to linker
  52  * -E           Compile source through preprocessor only, output to stdout
  53  * -erroff=<t>    Suppress warnings specified by tags t(%none, %all, <tag list>)
  54  * -errtags=<a>   Display messages with tags a(no, yes)
  55  * -errwarn=<t>   Treats warnings specified by tags t(%none, %all, <tag list>)
  56  *              as errors
  57  * -fast        Optimize using a selection of options
  58  * -fd          Report old-style function definitions and declarations
  59  * -features=zla        Allow zero-length arrays
  60  * -flags       Show this summary of compiler options


1378                         case 'h':
1379                         case 'l':
1380                         default:
1381                                 error(arg);
1382                                 break;
1383                         }
1384                         break;
1385                 case 'Y':
1386                         if (arglen == 1) {
1387                                 if ((arg = *++ctx->i_oldargv) == NULL ||
1388                                     *arg == '\0')
1389                                         error("-Y");
1390                                 ctx->i_oldargc--;
1391                                 arglen = strlen(arg + 1);
1392                         } else {
1393                                 arg += 2;
1394                         }
1395                         /* Just ignore -YS,... for now */
1396                         if (strncmp(arg, "S,", 2) == 0)
1397                                 break;
1398                         /* Reformat -YP or GCC will moan */
1399                         if (strncmp(arg, "P,", 2) == 0) {
1400                                 char *s;
1401                                 (void) asprintf(&s, "-Y%s", arg);
1402                                 newae(ctx->i_ae, s);
1403                                 free(s);
1404                                 break;
1405                         }
1406                         if (strncmp(arg, "l,", 2) == 0) {
1407                                 char *s = strdup(arg);
1408                                 s[0] = '-';
1409                                 s[1] = 'B';
1410                                 newae(ctx->i_ae, s);
1411                                 free(s);
1412                                 break;
1413                         }
1414                         if (strncmp(arg, "I,", 2) == 0) {
1415                                 char *s = strdup(arg);
1416                                 s[0] = '-';
1417                                 s[1] = 'I';
1418                                 newae(ctx->i_ae, "-nostdinc");
1419                                 newae(ctx->i_ae, s);
1420                                 free(s);
1421                                 break;
1422                         }
1423                         error(arg);
1424                         break;
1425                 case 'Q':