Print this page
11461 should use a native link-editor during the build
11463 SUNWonld has passed its use-by date
11464 cmd/sgs/tools should contain tools, not common code
11465 sgsmsg should be built with the rest of the build tools

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/cw/cw.c
          +++ new/usr/src/tools/cw/cw.c
↓ open down ↓ 298 lines elided ↑ open up ↑
 299  299  
 300  300  typedef struct {
 301  301          char *c_name;
 302  302          char *c_path;
 303  303          compiler_style_t c_style;
 304  304  } cw_compiler_t;
 305  305  
 306  306  typedef struct cw_ictx {
 307  307          struct cw_ictx  *i_next;
 308  308          cw_compiler_t   *i_compiler;
      309 +        char            *i_linker;
 309  310          struct aelist   *i_ae;
 310  311          uint32_t        i_flags;
 311  312          int             i_oldargc;
 312  313          char            **i_oldargv;
 313  314          pid_t           i_pid;
 314  315          char            *i_tmpdir;
 315  316          char            *i_stderr;
 316  317  } cw_ictx_t;
 317  318  
 318  319  /*
↓ open down ↓ 883 lines elided ↑ open up ↑
1202 1203                                      *arg == '\0')
1203 1204                                          error("-Y");
1204 1205                                  ctx->i_oldargc--;
1205 1206                                  arglen = strlen(arg + 1);
1206 1207                          } else {
1207 1208                                  arg += 2;
1208 1209                          }
1209 1210                          /* Just ignore -YS,... for now */
1210 1211                          if (strncmp(arg, "S,", 2) == 0)
1211 1212                                  break;
1212      -                        if (strncmp(arg, "l,", 2) == 0) {
1213      -                                char *s = strdup(arg);
1214      -                                s[0] = '-';
1215      -                                s[1] = 'B';
1216      -                                newae(ctx->i_ae, s);
1217      -                                free(s);
1218      -                                break;
1219      -                        }
1220 1213                          if (strncmp(arg, "I,", 2) == 0) {
1221 1214                                  char *s = strdup(arg);
1222 1215                                  s[0] = '-';
1223 1216                                  s[1] = 'I';
1224 1217                                  newae(ctx->i_ae, "-nostdinc");
1225 1218                                  newae(ctx->i_ae, s);
1226 1219                                  free(s);
1227 1220                                  break;
1228 1221                          }
1229 1222                          error(arg);
↓ open down ↓ 231 lines elided ↑ open up ↑
1461 1454  prepctx(cw_ictx_t *ctx)
1462 1455  {
1463 1456          newae(ctx->i_ae, ctx->i_compiler->c_path);
1464 1457  
1465 1458          if (ctx->i_flags & CW_F_PROG) {
1466 1459                  (void) printf("%s: %s\n", (ctx->i_flags & CW_F_SHADOW) ?
1467 1460                      "shadow" : "primary", ctx->i_compiler->c_path);
1468 1461                  (void) fflush(stdout);
1469 1462          }
1470 1463  
     1464 +        if (ctx->i_linker != NULL)
     1465 +                setenv("LD_ALTEXEC", ctx->i_linker, 1);
     1466 +
1471 1467          if (!(ctx->i_flags & CW_F_XLATE))
1472 1468                  return;
1473 1469  
1474 1470          switch (ctx->i_compiler->c_style) {
1475 1471          case SUN:
1476 1472                  do_cc(ctx);
1477 1473                  break;
1478 1474          case GNU:
1479 1475                  do_gcc(ctx);
1480 1476                  break;
↓ open down ↓ 239 lines elided ↑ open up ↑
1720 1716          boolean_t vflg = B_FALSE;
1721 1717          boolean_t Cflg = B_FALSE;
1722 1718          boolean_t cflg = B_FALSE;
1723 1719          boolean_t nflg = B_FALSE;
1724 1720          char *tmpdir;
1725 1721  
1726 1722          cw_ictx_t *main_ctx;
1727 1723  
1728 1724          static struct option longopts[] = {
1729 1725                  { "compiler", no_argument, NULL, 'c' },
     1726 +                { "linker", required_argument, NULL, 'l' },
1730 1727                  { "noecho", no_argument, NULL, 'n' },
1731 1728                  { "primary", required_argument, NULL, 'p' },
1732 1729                  { "shadow", required_argument, NULL, 's' },
1733 1730                  { "versions", no_argument, NULL, 'v' },
1734 1731                  { NULL, 0, NULL, 0 },
1735 1732          };
1736 1733  
1737 1734  
1738 1735          if ((main_ctx = newictx()) == NULL)
1739 1736                  nomem();
1740 1737  
1741 1738          while ((ch = getopt_long(argc, argv, "C", longopts, NULL)) != -1) {
1742 1739                  switch (ch) {
1743 1740                  case 'c':
1744 1741                          cflg = B_TRUE;
1745 1742                          break;
1746 1743                  case 'C':
1747 1744                          Cflg = B_TRUE;
     1745 +                        break;
     1746 +                case 'l':
     1747 +                        if ((main_ctx->i_linker = strdup(optarg)) == NULL)
     1748 +                                nomem();
1748 1749                          break;
1749 1750                  case 'n':
1750 1751                          nflg = B_TRUE;
1751 1752                          break;
1752 1753                  case 'p':
1753 1754                          if (primary.c_path != NULL) {
1754 1755                                  warnx("Only one primary compiler may "
1755 1756                                      "be specified");
1756 1757                                  usage();
1757 1758                          }
↓ open down ↓ 98 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX