Print this page
9884 cw(1) should use -fpic rather than -Kpic

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/cw/cw.c
          +++ new/usr/src/tools/cw/cw.c
↓ open down ↓ 63 lines elided ↑ open up ↑
  64   64   * -fsingle     Use single-precision arithmetic (-Xt and -Xs modes only)
  65   65   * -ftrap=<t>   Select floating-point trapping mode in effect at startup
  66   66   * -fstore      force floating pt. values to target precision on assignment
  67   67   * -G           Build a dynamic shared library
  68   68   * -g           Compile for debugging
  69   69   * -H           Print path name of each file included during compilation
  70   70   * -h <name>    Assign <name> to generated dynamic shared library
  71   71   * -I<dir>      Add <dir> to preprocessor #include file search path
  72   72   * -i           Passed to linker to ignore any LD_LIBRARY_PATH setting
  73   73   * -keeptmp     Keep temporary files created during compilation
  74      - * -KPIC        Compile position independent code with 32-bit addresses
  75      - * -Kpic        Compile position independent code
  76   74   * -L<dir>      Pass to linker to add <dir> to the library search path
  77   75   * -l<name>     Link with library lib<name>.a or lib<name>.so
  78   76   * -mc          Remove duplicate strings from .comment section of output files
  79   77   * -mr          Remove all strings from .comment section of output files
  80   78   * -mr,"string" Remove all strings and append "string" to .comment section
  81   79   * -mt          Specify options needed when compiling multi-threaded code
  82   80   * -native      Find available processor, generate code accordingly
  83   81   * -nofstore    Do not force floating pt. values to target precision
  84   82   *              on assignment
  85   83   * -norunpath   Do not build in a runtime path for shared libraries
↓ open down ↓ 87 lines elided ↑ open up ↑
 173  171   * -fsingle[=<n>]               error
 174  172   * -ftrap=<t>                   error
 175  173   * -fstore                      error
 176  174   * -G                           pass-thru
 177  175   * -g                           pass-thru
 178  176   * -H                           pass-thru
 179  177   * -h <name>                    pass-thru
 180  178   * -I<dir>                      pass-thru
 181  179   * -i                           pass-thru
 182  180   * -keeptmp                     -save-temps
 183      - * -KPIC                        -fPIC
 184      - * -Kpic                        -fpic
 185  181   * -L<dir>                      pass-thru
 186  182   * -l<name>                     pass-thru
 187  183   * -mc                          error
 188  184   * -mr                          error
 189  185   * -mr,"string"                 error
 190  186   * -mt                          -D_REENTRANT
 191  187   * -native                      error
 192  188   * -nofstore                    error
 193  189   * -nolib                       -nodefaultlibs
 194  190   * -norunpath                   ignore
↓ open down ↓ 365 lines elided ↑ open up ↑
 560  556          while (*table != NULL) {
 561  557                  newae(h, *table);
 562  558                  table++;
 563  559          }
 564  560  }
 565  561  
 566  562  static void
 567  563  do_gcc(cw_ictx_t *ctx)
 568  564  {
 569  565          int c;
 570      -        int pic = 0, nolibc = 0;
      566 +        int nolibc = 0;
 571  567          int in_output = 0, seen_o = 0, c_files = 0;
 572  568          cw_op_t op = CW_O_LINK;
 573  569          char *model = NULL;
 574  570          char *nameflag;
 575  571          int     mflag = 0;
 576  572  
 577  573          if (ctx->i_flags & CW_F_PROG) {
 578  574                  newae(ctx->i_ae, "--version");
 579  575                  return;
 580  576          }
↓ open down ↓ 115 lines elided ↑ open up ↑
 696  692                                  newae(ctx->i_ae, strchr(arg, '=') + 1);
 697  693                          }
 698  694                          break;
 699  695                  case '#':
 700  696                          if (arglen == 1) {
 701  697                                  newae(ctx->i_ae, "-v");
 702  698                                  break;
 703  699                          }
 704  700                          error(arg);
 705  701                          break;
      702 +                case 'f':
      703 +                        if ((strcmp(arg, "-fpic") == 0) ||
      704 +                            (strcmp(arg, "-fPIC") == 0)) {
      705 +                                newae(ctx->i_ae, arg);
      706 +                                break;
      707 +                        }
      708 +                        error(arg);
      709 +                        break;
 706  710                  case 'g':
 707  711                          newae(ctx->i_ae, "-gdwarf-2");
 708  712                          break;
 709  713                  case 'E':
 710  714                          if (arglen == 1) {
 711  715                                  newae(ctx->i_ae, "-xc");
 712  716                                  newae(ctx->i_ae, arg);
 713  717                                  op = CW_O_PREPROCESS;
 714  718                                  nolibc = 1;
 715  719                                  break;
↓ open down ↓ 96 lines elided ↑ open up ↑
 812  816                          newae(ctx->i_ae, "-shared");
 813  817                          nolibc = 1;
 814  818                          break;
 815  819                  case 'k':
 816  820                          if (strcmp(arg, "-keeptmp") == 0) {
 817  821                                  newae(ctx->i_ae, "-save-temps");
 818  822                                  break;
 819  823                          }
 820  824                          error(arg);
 821  825                          break;
 822      -                case 'K':
 823      -                        if (arglen == 1) {
 824      -                                if ((arg = *++ctx->i_oldargv) == NULL ||
 825      -                                    *arg == '\0')
 826      -                                        error("-K");
 827      -                                ctx->i_oldargc--;
 828      -                        } else {
 829      -                                arg += 2;
 830      -                        }
 831      -                        if (strcmp(arg, "pic") == 0) {
 832      -                                newae(ctx->i_ae, "-fpic");
 833      -                                pic = 1;
 834      -                                break;
 835      -                        }
 836      -                        if (strcmp(arg, "PIC") == 0) {
 837      -                                newae(ctx->i_ae, "-fPIC");
 838      -                                pic = 1;
 839      -                                break;
 840      -                        }
 841      -                        error("-K");
 842      -                        break;
 843  826                  case 'm':
 844  827                          if (strcmp(arg, "-mt") == 0) {
 845  828                                  newae(ctx->i_ae, "-D_REENTRANT");
 846  829                                  break;
 847  830                          }
 848  831                          if (strcmp(arg, "-m64") == 0) {
 849  832                                  newae(ctx->i_ae, "-m64");
 850  833  #if defined(__x86)
 851  834                                  newae(ctx->i_ae, "-mtune=opteron");
 852  835  #endif
↓ open down ↓ 126 lines elided ↑ open up ↑
 979  962                          if (strcmp(arg, "-Wd,-xsafe=unboundsym") == 0) {
 980  963                                  /*
 981  964                                   * Prevents optimizing away checks for
 982  965                                   * unbound weak symbol addresses.  gcc does
 983  966                                   * not do this, so it's not needed.
 984  967                                   */
 985  968                                  break;
 986  969                          }
 987  970                          if (strncmp(arg, "-Wc,-xcode=", 11) == 0) {
 988  971                                  xlate(ctx->i_ae, arg + 11, xcode_tbl);
 989      -                                if (strncmp(arg + 11, "pic", 3) == 0)
 990      -                                        pic = 1;
 991  972                                  break;
 992  973                          }
 993  974                          if (strncmp(arg, "-Wc,-Qiselect", 13) == 0) {
 994  975                                  /*
 995  976                                   * Prevents insertion of register symbols.
 996  977                                   * gcc doesn't do this, so ignore it.
 997  978                                   */
 998  979                                  break;
 999  980                          }
1000  981                          if (strcmp(arg, "-Wc,-Qassembler-ounrefsym=0") == 0) {
↓ open down ↓ 56 lines elided ↑ open up ↑
1057 1038                                  if (strncmp(arg, "-xc99=%none", 11) == 0) {
1058 1039                                          newae(ctx->i_ae, "-std=gnu89");
1059 1040                                          break;
1060 1041                                  }
1061 1042                                  if (strncmp(arg, "-xchip=", 7) == 0) {
1062 1043                                          xlate(ctx->i_ae, arg + 7, xchip_tbl);
1063 1044                                          break;
1064 1045                                  }
1065 1046                                  if (strncmp(arg, "-xcode=", 7) == 0) {
1066 1047                                          xlate(ctx->i_ae, arg + 7, xcode_tbl);
1067      -                                        if (strncmp(arg + 7, "pic", 3) == 0)
1068      -                                                pic = 1;
1069 1048                                          break;
1070 1049                                  }
1071 1050                                  if (strncmp(arg, "-xcrossfile", 11) == 0)
1072 1051                                          break;
1073 1052                                  error(arg);
1074 1053                                  break;
1075 1054                          case 'd':
1076 1055                                  if (strncmp(arg, "-xdebugformat=", 14) == 0)
1077 1056                                          break;
1078 1057                                  error(arg);
↓ open down ↓ 202 lines elided ↑ open up ↑
1281 1260          default:
1282 1261                  (void) fprintf(stderr,
1283 1262                      "Incompatible -xarch= and/or -m32/-m64 options used.\n");
1284 1263                  exit(2);
1285 1264          }
1286 1265  
1287 1266          if ((op == CW_O_LINK || op == CW_O_PREPROCESS) &&
1288 1267              (ctx->i_flags & CW_F_SHADOW))
1289 1268                  exit(0);
1290 1269  
1291      -        if (model && !pic)
     1270 +        if (model != NULL)
1292 1271                  newae(ctx->i_ae, model);
1293 1272          if (!nolibc)
1294 1273                  newae(ctx->i_ae, "-lc");
1295 1274          if (!seen_o && (ctx->i_flags & CW_F_SHADOW)) {
1296 1275                  newae(ctx->i_ae, "-o");
1297 1276                  newae(ctx->i_ae, ctx->i_discard);
1298 1277          }
1299 1278  }
1300 1279  
1301 1280  static void
↓ open down ↓ 435 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX