usr/src/tools/cw/cw.c
changeset 580 70dfd36fd02c
parent 499 3fe4d3ff5864
child 1717 ef845d4a1074
equal deleted inserted replaced
579:6139238196bb 580:70dfd36fd02c
     1 /*
     1 /*
     2  * CDDL HEADER START
     2  * CDDL HEADER START
     3  *
     3  *
     4  * The contents of this file are subject to the terms of the
     4  * The contents of this file are subject to the terms of the
     5  * Common Development and Distribution License, Version 1.0 only
     5  * Common Development and Distribution License (the "License").
     6  * (the "License").  You may not use this file except in compliance
     6  * You may not use this file except in compliance with the License.
     7  * with the License.
       
     8  *
     7  *
     9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    10  * or http://www.opensolaris.org/os/licensing.
     9  * or http://www.opensolaris.org/os/licensing.
    11  * See the License for the specific language governing permissions
    10  * See the License for the specific language governing permissions
    12  * and limitations under the License.
    11  * and limitations under the License.
    17  * fields enclosed by brackets "[]" replaced with your own identifying
    16  * fields enclosed by brackets "[]" replaced with your own identifying
    18  * information: Portions Copyright [yyyy] [name of copyright owner]
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    19  *
    18  *
    20  * CDDL HEADER END
    19  * CDDL HEADER END
    21  */
    20  */
       
    21 
    22 /*
    22 /*
    23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
    23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
    24  * Use is subject to license terms.
    24  * Use is subject to license terms.
    25  */
    25  */
    26 
    26 
   232  * -Xt				error
   232  * -Xt				error
   233  * -Xs				-traditional -std=c89
   233  * -Xs				-traditional -std=c89
   234  * -x386			-march=i386 (x86 only)
   234  * -x386			-march=i386 (x86 only)
   235  * -x486			-march=i486 (x86 only)
   235  * -x486			-march=i486 (x86 only)
   236  * -xarch=<a>			table
   236  * -xarch=<a>			table
   237  * -xbuiltin[=<b>]		error
   237  * -xbuiltin[=<b>]		-fbuiltin (-fno-builtin otherwise)
   238  * -xCC				ignore
   238  * -xCC				ignore
   239  * -xchar_byte_order=<o>	error
   239  * -xchar_byte_order=<o>	error
   240  * -xchip=<c>			table
   240  * -xchip=<c>			table
   241  * -xcode=<c>			table
   241  * -xcode=<c>			table
   242  * -xdebugformat=<format>	ignore (always use dwarf-2 for gcc)
   242  * -xdebugformat=<format>	ignore (always use dwarf-2 for gcc)
   518 	newae(h, "-fno-inline-functions");
   518 	newae(h, "-fno-inline-functions");
   519 	newae(h, "-fno-builtin");
   519 	newae(h, "-fno-builtin");
   520 	newae(h, "-fno-asm");
   520 	newae(h, "-fno-asm");
   521 	newae(h, "-nodefaultlibs");
   521 	newae(h, "-nodefaultlibs");
   522 
   522 
       
   523 #if defined(__sparc)
       
   524 	/*
       
   525 	 * The SPARC ldd and std instructions require 8-byte alignment of
       
   526 	 * their address operand.  gcc correctly uses them only when the
       
   527 	 * ABI requires 8-byte alignment; unfortunately we have a number of
       
   528 	 * pieces of buggy code that doesn't conform to the ABI.  This
       
   529 	 * flag makes gcc work more like Studio with -xmemalign=4.
       
   530 	 */
       
   531 	newae(h, "-mno-integer-ldd-std");
       
   532 #endif
       
   533 
   523 	/*
   534 	/*
   524 	 * This is needed because 'u' is defined
   535 	 * This is needed because 'u' is defined
   525 	 * under a conditional on 'sun'.  Should
   536 	 * under a conditional on 'sun'.  Should
   526 	 * probably just remove the conditional,
   537 	 * probably just remove the conditional,
   527 	 * or make it be dependent on '__sun'.
   538 	 * or make it be dependent on '__sun'.
   927 				 */
   938 				 */
   928 				break;
   939 				break;
   929 			}
   940 			}
   930 #if defined(__x86)
   941 #if defined(__x86)
   931 			if (strcmp(arg, "-Wu,-no_got_reloc") == 0) {
   942 			if (strcmp(arg, "-Wu,-no_got_reloc") == 0) {
   932 				/*
   943 				newae(h, "-fno-jump-tables");
   933 				 * Don't create any GOT relocations?
   944 				newae(h, "-fno-constant-pools");
   934 				 * Well, gcc doesn't have this degree
       
   935 				 * of control over its pic code ...
       
   936 				 */
       
   937 				break;
   945 				break;
   938 			}
   946 			}
   939 			if (strcmp(arg, "-Wu,-xmodel=kernel") == 0) {
   947 			if (strcmp(arg, "-Wu,-xmodel=kernel") == 0) {
   940 				newae(h, "-ffreestanding");
   948 				newae(h, "-ffreestanding");
   941 				newae(h, "-mno-red-zone");
   949 				newae(h, "-mno-red-zone");
   987 				break;
   995 				break;
   988 #endif	/* __x86 */
   996 #endif	/* __x86 */
   989 			case 'a':
   997 			case 'a':
   990 				if (strncmp(arg, "-xarch=", 7) == 0) {
   998 				if (strncmp(arg, "-xarch=", 7) == 0) {
   991 					xlate(h, arg + 7, xarch_tbl);
   999 					xlate(h, arg + 7, xarch_tbl);
       
  1000 					break;
       
  1001 				}
       
  1002 				error(arg);
       
  1003 				break;
       
  1004 			case 'b':
       
  1005 				if (strncmp(arg, "-xbuiltin=", 10) == 0) {
       
  1006 					if (strcmp(arg + 10, "%all"))
       
  1007 						newae(h, "-fbuiltin");
   992 					break;
  1008 					break;
   993 				}
  1009 				}
   994 				error(arg);
  1010 				error(arg);
   995 				break;
  1011 				break;
   996 			case 'C':
  1012 			case 'C':
  1139 					xlate(h, arg + 9, xtarget_tbl);
  1155 					xlate(h, arg + 9, xtarget_tbl);
  1140 					break;
  1156 					break;
  1141 				}
  1157 				}
  1142 				error(arg);
  1158 				error(arg);
  1143 				break;
  1159 				break;
  1144 			case 'b':
       
  1145 			case 'e':
  1160 			case 'e':
  1146 			case 'h':
  1161 			case 'h':
  1147 			case 'l':
  1162 			case 'l':
  1148 			default:
  1163 			default:
  1149 				error(arg);
  1164 				error(arg);