24 25 # Compiler-specific flags for sparcworks. 26 27 # tell make which C and C++ compilers to use 28 CC = cc 29 CPP = CC 30 31 # Note that this 'as' is an older version of the Sun Studio 'fbe', and will 32 # use the older style options. The 'fbe' options will match 'cc' and 'CC'. 33 AS = /usr/ccs/bin/as 34 35 NM = /usr/ccs/bin/nm 36 NAWK = /bin/nawk 37 38 REORDER_FLAG = -xF 39 40 # Check for the versions of C++ and C compilers ($CPP and $CC) used. 41 42 # Get the last thing on the line that looks like x.x+ (x is a digit). 43 COMPILER_REV := \ 44 $(shell $(CPP) -V 2>&1 | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/') 45 C_COMPILER_REV := \ 46 $(shell $(CC) -V 2>&1 | grep -i "cc:" | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/') 47 48 # Pick which compiler is validated 49 ifeq ($(JDK_MINOR_VERSION),6) 50 # Validated compiler for JDK6 is SS11 (5.8) 51 VALIDATED_COMPILER_REV := 5.8 52 VALIDATED_C_COMPILER_REV := 5.8 53 else 54 # Validated compiler for JDK7 is SS12 (5.9) 55 VALIDATED_COMPILER_REV := 5.9 56 VALIDATED_C_COMPILER_REV := 5.9 57 endif 58 59 # Warning messages about not using the above validated version 60 ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV} 61 ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV}) 62 dummy_target_to_enforce_compiler_rev:=\ 63 $(info WARNING: You are using CC version ${COMPILER_REV} \ 64 and should be using version ${ENFORCE_COMPILER_REV}) 65 endif 66 67 ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV} 68 ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV}) 69 dummy_target_to_enforce_c_compiler_rev:=\ 70 $(info WARNING: You are using cc version ${C_COMPILER_REV} \ 71 and should be using version ${ENFORCE_C_COMPILER_REV}) 72 endif 73 74 # Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04 75 # and newer; objects with a dependency on this symbol will not run on older 76 # Solaris 8. 77 JVM_FAIL_IF_UNDEFINED = __fabsf 78 79 JVM_CHECK_SYMBOLS = $(NM) -u -p $(LIBJVM.o) | \ 80 $(NAWK) -v f="${JVM_FAIL_IF_UNDEFINED}" \ 81 'BEGIN { c=split(f,s); rc=0; } \ 82 /:$$/ { file = $$1; } \ 83 /[^:]$$/ { for(n=1;n<=c;++n) { \ 84 if($$1==s[n]) { \ 85 printf("JVM_CHECK_SYMBOLS: %s contains illegal symbol %s\n", \ 86 file,$$1); \ 87 rc=1; \ 88 } \ 89 } \ 90 } \ 91 END { exit rc; }' 92 93 LINK_LIB.CC/PRE_HOOK += $(JVM_CHECK_SYMBOLS) || exit 1; 103 # settings below have changed all SS12 32bit sparc builds to be v8plus. 104 # The older SS11 (5.8) settings have remained as they always have been. 105 ifeq ($(TYPE),COMPILER2) 106 ARCHFLAG_OLD/sparc = -xarch=v8plus 107 else 108 ifeq ($(TYPE),TIERED) 109 ARCHFLAG_OLD/sparc = -xarch=v8plus 110 else 111 ARCHFLAG_OLD/sparc = -xarch=v8 112 endif 113 endif 114 ARCHFLAG_NEW/sparc = -m32 -xarch=sparc 115 ARCHFLAG_OLD/sparcv9 = -xarch=v9 116 ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc 117 ARCHFLAG_OLD/i486 = 118 ARCHFLAG_NEW/i486 = -m32 119 ARCHFLAG_OLD/amd64 = -xarch=amd64 120 ARCHFLAG_NEW/amd64 = -m64 121 122 # Select the ARCHFLAGs and other SS12 (5.9) options 123 ifeq ($(shell expr $(COMPILER_REV) \>= 5.9), 1) 124 ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc) 125 ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9) 126 ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486) 127 ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64) 128 else 129 ARCHFLAG/sparc = $(ARCHFLAG_OLD/sparc) 130 ARCHFLAG/sparcv9 = $(ARCHFLAG_OLD/sparcv9) 131 ARCHFLAG/i486 = $(ARCHFLAG_OLD/i486) 132 ARCHFLAG/amd64 = $(ARCHFLAG_OLD/amd64) 133 endif 134 135 # ARCHFLAGS for the current build arch 136 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) 137 AS_ARCHFLAG = $(ARCHFLAG_OLD/$(BUILDARCH)) 138 139 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept. 140 ISA_DIR=$(ISA_DIR/$(BUILDARCH)) 141 ISA_DIR/sparcv9=/sparcv9 142 ISA_DIR/amd64=/amd64 143 144 # Use these to work around compiler bugs: 145 OPT_CFLAGS/SLOWER=-xO3 146 OPT_CFLAGS/O2=-xO2 147 OPT_CFLAGS/NOOPT=-xO1 148 149 ################################################# 150 # Begin current (>=5.6) Forte compiler options # 151 ################################################# 152 153 ifeq ($(shell expr $(COMPILER_REV) \>= 5.6), 1) 154 155 ifeq ("${Platform_arch}", "sparc") 156 157 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) 158 ifndef LP64 159 CFLAGS += -xmemalign=4s 160 endif 161 162 endif 163 164 endif 165 166 ################################################# 167 # Begin current (>=5.5) Forte compiler options # 168 ################################################# 169 170 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) 171 172 CFLAGS += $(ARCHFLAG) 173 AOUT_FLAGS += $(ARCHFLAG) 174 LIB_FLAGS += $(ARCHFLAG) 175 LFLAGS += $(ARCHFLAG) 176 177 ifeq ("${Platform_arch}", "sparc") 178 179 # Flags for Optimization 180 181 # [phh] Commented out pending verification that we do indeed want 182 # to potentially bias against u1 and u3 targets. 183 #CFLAGS += -xchip=ultra2 184 185 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) 186 187 endif # sparc 188 189 ifeq ("${Platform_arch_model}", "x86_32") 190 238 # [RGV] Need to figure which files to remove to get link to work 239 #PICFLAG/BETTER = -pic 240 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 241 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 242 243 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. 244 MAPFLAG = -M FILENAME 245 246 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj 247 SONAMEFLAG = -h SONAME 248 249 # Build shared library 250 SHARED_FLAG = -G 251 252 # We don't need libCstd.so and librwtools7.so, only libCrun.so 253 CFLAGS += -library=%none 254 LFLAGS += -library=%none 255 256 LFLAGS += -mt 257 258 endif # COMPILER_REV >= 5.5 259 260 ###################################### 261 # End 5.5 Forte compiler options # 262 ###################################### 263 264 ###################################### 265 # Begin 5.2 Forte compiler options # 266 ###################################### 267 268 ifeq ($(COMPILER_REV), 5.2) 269 270 CFLAGS += $(ARCHFLAG) 271 AOUT_FLAGS += $(ARCHFLAG) 272 LIB_FLAGS += $(ARCHFLAG) 273 LFLAGS += $(ARCHFLAG) 274 275 ifeq ("${Platform_arch}", "sparc") 276 277 # Flags for Optimization 278 279 # [phh] Commented out pending verification that we do indeed want 280 # to potentially bias against u1 and u3 targets. 281 #CFLAGS += -xchip=ultra2 282 283 ifdef LP64 284 # SC5.0 tools on v9 are flakey at -xO4 285 # [phh] Is this still true for 6.1? 286 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS) 287 else 288 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) 307 # no more exceptions 308 CFLAGS/NOEX=-noex 309 310 # Reduce code bloat by reverting back to 5.0 behavior for static initializers 311 CFLAGS += -Qoption ccfe -one_static_init 312 313 # PIC is safer for SPARC, and is considerably slower 314 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" 315 PICFLAG = -KPIC 316 PICFLAG/DEFAULT = $(PICFLAG) 317 # [RGV] Need to figure which files to remove to get link to work 318 #PICFLAG/BETTER = -pic 319 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 320 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 321 322 # Would be better if these weren't needed, since we link with CC, but 323 # at present removing them causes run-time errors 324 LFLAGS += -library=Crun 325 LIBS += -library=Crun -lCrun 326 327 endif # COMPILER_REV == 5.2 328 329 ################################## 330 # End 5.2 Forte compiler options # 331 ################################## 332 333 ################################## 334 # Begin old 5.1 compiler options # 335 ################################## 336 ifeq ($(COMPILER_REV), 5.1) 337 338 _JUNK_ := $(shell echo >&2 \ 339 "*** ERROR: sparkWorks.make incomplete for 5.1 compiler") 340 @exit 1 341 endif 342 ################################## 343 # End old 5.1 compiler options # 344 ################################## 345 346 ################################## 347 # Begin old 5.0 compiler options # 348 ################################## 349 350 ifeq (${COMPILER_REV}, 5.0) 351 352 # Had to hoist this higher apparently because of other changes. Must 353 # come before -xarch specification. 354 # NOTE: native says optimize for the machine doing the compile, bad news. 355 CFLAGS += -xtarget=native 356 357 CFLAGS += $(ARCHFLAG) 358 AOUT_FLAGS += $(ARCHFLAG) 359 LIB_FLAGS += $(ARCHFLAG) 360 LFLAGS += $(ARCHFLAG) 361 362 CFLAGS += -library=iostream 363 LFLAGS += -library=iostream -library=Crun 364 LIBS += -library=iostream -library=Crun -lCrun 365 366 # Flags for Optimization 367 ifdef LP64 368 # SC5.0 tools on v9 are flakey at -xO4 369 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS) 370 else 371 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) 372 endif 373 374 ifeq ("${Platform_arch}", "sparc") 375 376 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.il 377 378 endif # sparc 379 380 ifeq ("${Platform_arch_model}", "x86_32") 381 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS) 382 ifeq ("${COMPILER_REV}", "5.0") 383 # SC5.0 tools on x86 are flakey at -xO4 384 OPT_CFLAGS+=-xO3 385 else 386 OPT_CFLAGS+=-xO4 387 endif 388 389 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il 390 391 endif # 32bit x86 392 393 # The following options run into misaligned ldd problem (raj) 394 #OPT_CFLAGS = -fast -O4 $(ARCHFLAG/sparc) -xchip=ultra 395 396 # no more exceptions 397 CFLAGS/NOEX=-noex 398 399 # PIC is safer for SPARC, and is considerably slower 400 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" 401 PICFLAG = -PIC 402 PICFLAG/DEFAULT = $(PICFLAG) 403 # [RGV] Need to figure which files to remove to get link to work 404 #PICFLAG/BETTER = -pic 405 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 406 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 407 408 endif # COMPILER_REV = 5.0 409 410 ################################ 411 # End old 5.0 compiler options # 412 ################################ 413 414 ifeq ("${COMPILER_REV}", "4.2") 415 # 4.2 COMPILERS SHOULD NO LONGER BE USED 416 _JUNK_ := $(shell echo >&2 \ 417 "*** ERROR: SC4.2 compilers are not supported by this code base!") 418 @exit 1 419 endif 420 421 # do not include shared lib path in a.outs 422 AOUT_FLAGS += -norunpath 423 LFLAGS_VM = -norunpath -z noversion 424 425 # need position-indep-code for shared libraries 426 # (ild appears to get errors on PIC code, so we'll try non-PIC for debug) 427 ifeq ($(PICFLAGS),DEFAULT) 428 VM_PICFLAG/LIBJVM = $(PICFLAG/DEFAULT) 429 else 430 VM_PICFLAG/LIBJVM = $(PICFLAG/BYFILE) 431 endif 432 VM_PICFLAG/AOUT = 433 434 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) 435 CFLAGS += $(VM_PICFLAG) 436 437 # less dynamic linking (no PLTs, please) 438 #LIB_FLAGS += $(LINK_MODE) 439 # %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose 440 441 LINK_MODE = $(LINK_MODE/$(VERSION)) 442 LINK_MODE/debug = 443 LINK_MODE/optimized = -Bsymbolic -znodefs 444 445 # Have thread local errnos 446 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) 447 CFLAGS += -mt 448 else 449 CFLAGS += -D_REENTRANT 450 endif 451 452 ifdef CC_INTERP 453 # C++ Interpreter 454 CFLAGS += -DCC_INTERP 455 endif 456 457 # Flags for Debugging 458 DEBUG_CFLAGS = -g 459 FASTDEBUG_CFLAGS = -g0 460 # The -g0 setting allows the C++ frontend to inline, which is a big win. 461 462 # Special global options for SS12 463 ifeq ($(COMPILER_REV),5.9) 464 # There appears to be multiple issues with the new Dwarf2 debug format, so 465 # we tell the compiler to use the older 'stabs' debug format all the time. 466 # Note that this needs to be used in optimized compiles too to be 100%. 467 # This is a workaround for SS12 (5.9) bug 6694600 468 CFLAGS += -xdebugformat=stabs 469 endif 470 471 # Enable the following CFLAGS additions if you need to compare the 472 # built ELF objects. 473 # 474 # The -g option makes static data global and the "-Qoption ccfe 475 # -xglobalstatic" option tells the compiler to not globalize static 476 # data using a unique globalization prefix. Instead force the use of 477 # a static globalization prefix based on the source filepath so the 478 # objects from two identical compilations are the same. 479 #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic 480 #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic 481 482 ifeq (${COMPILER_REV}, 5.2) 483 COMPILER_DATE := $(shell $(CPP) -V 2>&1 | awk '{ print $$NF; }') 484 ifeq (${COMPILER_DATE}, 2001/01/31) 485 # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy 486 # use an innocuous value because it will get -g if it's empty 487 FASTDEBUG_CFLAGS = -c 488 endif 489 endif 490 491 # Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information. 492 # CFLAGS_BROWSE = -sbfast 493 CFLAGS += $(CFLAGS_BROWSE) 494 495 # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7) 496 ifeq ($(shell expr $(COMPILER_REV) \< 5.7), 1) 497 # use ild when debugging (but when optimizing we want reproducible results) 498 ILDFLAG = $(ILDFLAG/$(VERSION)) 499 ILDFLAG/debug = -xildon 500 ILDFLAG/optimized = 501 AOUT_FLAGS += $(ILDFLAG) 502 endif 503 504 # Where to put the *.o files (a.out, or shared library)? 505 LINK_INTO = $(LINK_INTO/$(VERSION)) 506 LINK_INTO/debug = LIBJVM 507 LINK_INTO/optimized = LIBJVM 508 509 # We link the debug version into the a.out because: 510 # 1. ild works on a.out but not shared libraries, and using ild 511 # can cut rebuild times by 25% for small changes. (ILD is gone in SS11) 512 # 2. dbx cannot gracefully set breakpoints in shared libraries 513 # 514 515 # apply this setting to link into the shared library even in the debug version: 516 ifdef LP64 | 24 25 # Compiler-specific flags for sparcworks. 26 27 # tell make which C and C++ compilers to use 28 CC = cc 29 CPP = CC 30 31 # Note that this 'as' is an older version of the Sun Studio 'fbe', and will 32 # use the older style options. The 'fbe' options will match 'cc' and 'CC'. 33 AS = /usr/ccs/bin/as 34 35 NM = /usr/ccs/bin/nm 36 NAWK = /bin/nawk 37 38 REORDER_FLAG = -xF 39 40 # Check for the versions of C++ and C compilers ($CPP and $CC) used. 41 42 # Get the last thing on the line that looks like x.x+ (x is a digit). 43 COMPILER_REV := \ 44 $(shell $(CPP) -V 2>&1 | sed -n 's/^.*[ ,\t]C++[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') 45 C_COMPILER_REV := \ 46 $(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') 47 48 # Pick which compiler is validated 49 ifeq ($(JDK_MINOR_VERSION),6) 50 # Validated compiler for JDK6 is SS11 (5.8) 51 VALIDATED_COMPILER_REV := 5.8 52 VALIDATED_C_COMPILER_REV := 5.8 53 else 54 # Validated compiler for JDK7 is SS12 (5.9) 55 VALIDATED_COMPILER_REV := 5.9 56 VALIDATED_C_COMPILER_REV := 5.9 57 endif 58 59 # Warning messages about not using the above validated version 60 ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV} 61 ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV}) 62 dummy_target_to_enforce_compiler_rev:=\ 63 $(info WARNING: You are using CC version ${COMPILER_REV} \ 64 and should be using version ${ENFORCE_COMPILER_REV}) 65 endif 66 67 ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV} 68 ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV}) 69 dummy_target_to_enforce_c_compiler_rev:=\ 70 $(info WARNING: You are using cc version ${C_COMPILER_REV} \ 71 and should be using version ${ENFORCE_C_COMPILER_REV}) 72 endif 73 74 COMPILER_REV_MAJOR := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$1 }') 75 COMPILER_REV_MINOR := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$2 }') 76 COMPILER_REV_NUMERIC := $(shell expr $(COMPILER_REV_MAJOR) \* 100 + $(COMPILER_REV_MINOR)) 77 78 # Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04 79 # and newer; objects with a dependency on this symbol will not run on older 80 # Solaris 8. 81 JVM_FAIL_IF_UNDEFINED = __fabsf 82 83 JVM_CHECK_SYMBOLS = $(NM) -u -p $(LIBJVM.o) | \ 84 $(NAWK) -v f="${JVM_FAIL_IF_UNDEFINED}" \ 85 'BEGIN { c=split(f,s); rc=0; } \ 86 /:$$/ { file = $$1; } \ 87 /[^:]$$/ { for(n=1;n<=c;++n) { \ 88 if($$1==s[n]) { \ 89 printf("JVM_CHECK_SYMBOLS: %s contains illegal symbol %s\n", \ 90 file,$$1); \ 91 rc=1; \ 92 } \ 93 } \ 94 } \ 95 END { exit rc; }' 96 97 LINK_LIB.CC/PRE_HOOK += $(JVM_CHECK_SYMBOLS) || exit 1; 107 # settings below have changed all SS12 32bit sparc builds to be v8plus. 108 # The older SS11 (5.8) settings have remained as they always have been. 109 ifeq ($(TYPE),COMPILER2) 110 ARCHFLAG_OLD/sparc = -xarch=v8plus 111 else 112 ifeq ($(TYPE),TIERED) 113 ARCHFLAG_OLD/sparc = -xarch=v8plus 114 else 115 ARCHFLAG_OLD/sparc = -xarch=v8 116 endif 117 endif 118 ARCHFLAG_NEW/sparc = -m32 -xarch=sparc 119 ARCHFLAG_OLD/sparcv9 = -xarch=v9 120 ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc 121 ARCHFLAG_OLD/i486 = 122 ARCHFLAG_NEW/i486 = -m32 123 ARCHFLAG_OLD/amd64 = -xarch=amd64 124 ARCHFLAG_NEW/amd64 = -m64 125 126 # Select the ARCHFLAGs and other SS12 (5.9) options 127 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) 128 ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc) 129 ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9) 130 ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486) 131 ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64) 132 else 133 ARCHFLAG/sparc = $(ARCHFLAG_OLD/sparc) 134 ARCHFLAG/sparcv9 = $(ARCHFLAG_OLD/sparcv9) 135 ARCHFLAG/i486 = $(ARCHFLAG_OLD/i486) 136 ARCHFLAG/amd64 = $(ARCHFLAG_OLD/amd64) 137 endif 138 139 # ARCHFLAGS for the current build arch 140 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) 141 AS_ARCHFLAG = $(ARCHFLAG_OLD/$(BUILDARCH)) 142 143 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept. 144 ISA_DIR=$(ISA_DIR/$(BUILDARCH)) 145 ISA_DIR/sparcv9=/sparcv9 146 ISA_DIR/amd64=/amd64 147 148 # Use these to work around compiler bugs: 149 OPT_CFLAGS/SLOWER=-xO3 150 OPT_CFLAGS/O2=-xO2 151 OPT_CFLAGS/NOOPT=-xO1 152 153 ################################################# 154 # Begin current (>=5.6) Forte compiler options # 155 ################################################# 156 157 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 506), 1) 158 159 ifeq ("${Platform_arch}", "sparc") 160 161 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) 162 ifndef LP64 163 CFLAGS += -xmemalign=4s 164 endif 165 166 endif 167 168 endif 169 170 ################################################# 171 # Begin current (>=5.5) Forte compiler options # 172 ################################################# 173 174 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) 175 176 CFLAGS += $(ARCHFLAG) 177 AOUT_FLAGS += $(ARCHFLAG) 178 LIB_FLAGS += $(ARCHFLAG) 179 LFLAGS += $(ARCHFLAG) 180 181 ifeq ("${Platform_arch}", "sparc") 182 183 # Flags for Optimization 184 185 # [phh] Commented out pending verification that we do indeed want 186 # to potentially bias against u1 and u3 targets. 187 #CFLAGS += -xchip=ultra2 188 189 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) 190 191 endif # sparc 192 193 ifeq ("${Platform_arch_model}", "x86_32") 194 242 # [RGV] Need to figure which files to remove to get link to work 243 #PICFLAG/BETTER = -pic 244 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 245 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 246 247 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. 248 MAPFLAG = -M FILENAME 249 250 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj 251 SONAMEFLAG = -h SONAME 252 253 # Build shared library 254 SHARED_FLAG = -G 255 256 # We don't need libCstd.so and librwtools7.so, only libCrun.so 257 CFLAGS += -library=%none 258 LFLAGS += -library=%none 259 260 LFLAGS += -mt 261 262 endif # COMPILER_REV_NUMERIC >= 505 263 264 ###################################### 265 # End 5.5 Forte compiler options # 266 ###################################### 267 268 ###################################### 269 # Begin 5.2 Forte compiler options # 270 ###################################### 271 272 ifeq ($(COMPILER_REV_NUMERIC), 502) 273 274 CFLAGS += $(ARCHFLAG) 275 AOUT_FLAGS += $(ARCHFLAG) 276 LIB_FLAGS += $(ARCHFLAG) 277 LFLAGS += $(ARCHFLAG) 278 279 ifeq ("${Platform_arch}", "sparc") 280 281 # Flags for Optimization 282 283 # [phh] Commented out pending verification that we do indeed want 284 # to potentially bias against u1 and u3 targets. 285 #CFLAGS += -xchip=ultra2 286 287 ifdef LP64 288 # SC5.0 tools on v9 are flakey at -xO4 289 # [phh] Is this still true for 6.1? 290 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS) 291 else 292 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) 311 # no more exceptions 312 CFLAGS/NOEX=-noex 313 314 # Reduce code bloat by reverting back to 5.0 behavior for static initializers 315 CFLAGS += -Qoption ccfe -one_static_init 316 317 # PIC is safer for SPARC, and is considerably slower 318 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" 319 PICFLAG = -KPIC 320 PICFLAG/DEFAULT = $(PICFLAG) 321 # [RGV] Need to figure which files to remove to get link to work 322 #PICFLAG/BETTER = -pic 323 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 324 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 325 326 # Would be better if these weren't needed, since we link with CC, but 327 # at present removing them causes run-time errors 328 LFLAGS += -library=Crun 329 LIBS += -library=Crun -lCrun 330 331 endif # COMPILER_REV_NUMERIC == 502 332 333 ################################## 334 # End 5.2 Forte compiler options # 335 ################################## 336 337 ################################## 338 # Begin old 5.1 compiler options # 339 ################################## 340 ifeq ($(COMPILER_REV_NUMERIC), 501) 341 342 _JUNK_ := $(shell echo >&2 \ 343 "*** ERROR: sparkWorks.make incomplete for 5.1 compiler") 344 @exit 1 345 endif 346 ################################## 347 # End old 5.1 compiler options # 348 ################################## 349 350 ################################## 351 # Begin old 5.0 compiler options # 352 ################################## 353 354 ifeq (${COMPILER_REV_NUMERIC}, 500) 355 356 # Had to hoist this higher apparently because of other changes. Must 357 # come before -xarch specification. 358 # NOTE: native says optimize for the machine doing the compile, bad news. 359 CFLAGS += -xtarget=native 360 361 CFLAGS += $(ARCHFLAG) 362 AOUT_FLAGS += $(ARCHFLAG) 363 LIB_FLAGS += $(ARCHFLAG) 364 LFLAGS += $(ARCHFLAG) 365 366 CFLAGS += -library=iostream 367 LFLAGS += -library=iostream -library=Crun 368 LIBS += -library=iostream -library=Crun -lCrun 369 370 # Flags for Optimization 371 ifdef LP64 372 # SC5.0 tools on v9 are flakey at -xO4 373 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS) 374 else 375 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) 376 endif 377 378 ifeq ("${Platform_arch}", "sparc") 379 380 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.il 381 382 endif # sparc 383 384 ifeq ("${Platform_arch_model}", "x86_32") 385 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS) 386 ifeq ("${COMPILER_REV_NUMERIC}", "500") 387 # SC5.0 tools on x86 are flakey at -xO4 388 OPT_CFLAGS+=-xO3 389 else 390 OPT_CFLAGS+=-xO4 391 endif 392 393 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il 394 395 endif # 32bit x86 396 397 # The following options run into misaligned ldd problem (raj) 398 #OPT_CFLAGS = -fast -O4 $(ARCHFLAG/sparc) -xchip=ultra 399 400 # no more exceptions 401 CFLAGS/NOEX=-noex 402 403 # PIC is safer for SPARC, and is considerably slower 404 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" 405 PICFLAG = -PIC 406 PICFLAG/DEFAULT = $(PICFLAG) 407 # [RGV] Need to figure which files to remove to get link to work 408 #PICFLAG/BETTER = -pic 409 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 410 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 411 412 endif # COMPILER_REV_NUMERIC = 500 413 414 ################################ 415 # End old 5.0 compiler options # 416 ################################ 417 418 ifeq ("${COMPILER_REV_NUMERIC}", "402") 419 # 4.2 COMPILERS SHOULD NO LONGER BE USED 420 _JUNK_ := $(shell echo >&2 \ 421 "*** ERROR: SC4.2 compilers are not supported by this code base!") 422 @exit 1 423 endif 424 425 # do not include shared lib path in a.outs 426 AOUT_FLAGS += -norunpath 427 LFLAGS_VM = -norunpath -z noversion 428 429 # need position-indep-code for shared libraries 430 # (ild appears to get errors on PIC code, so we'll try non-PIC for debug) 431 ifeq ($(PICFLAGS),DEFAULT) 432 VM_PICFLAG/LIBJVM = $(PICFLAG/DEFAULT) 433 else 434 VM_PICFLAG/LIBJVM = $(PICFLAG/BYFILE) 435 endif 436 VM_PICFLAG/AOUT = 437 438 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) 439 CFLAGS += $(VM_PICFLAG) 440 441 # less dynamic linking (no PLTs, please) 442 #LIB_FLAGS += $(LINK_MODE) 443 # %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose 444 445 LINK_MODE = $(LINK_MODE/$(VERSION)) 446 LINK_MODE/debug = 447 LINK_MODE/optimized = -Bsymbolic -znodefs 448 449 # Have thread local errnos 450 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) 451 CFLAGS += -mt 452 else 453 CFLAGS += -D_REENTRANT 454 endif 455 456 ifdef CC_INTERP 457 # C++ Interpreter 458 CFLAGS += -DCC_INTERP 459 endif 460 461 # Flags for Debugging 462 DEBUG_CFLAGS = -g 463 FASTDEBUG_CFLAGS = -g0 464 # The -g0 setting allows the C++ frontend to inline, which is a big win. 465 466 # Special global options for SS12 467 ifeq ($(COMPILER_REV_NUMERIC),509) 468 # There appears to be multiple issues with the new Dwarf2 debug format, so 469 # we tell the compiler to use the older 'stabs' debug format all the time. 470 # Note that this needs to be used in optimized compiles too to be 100%. 471 # This is a workaround for SS12 (5.9) bug 6694600 472 CFLAGS += -xdebugformat=stabs 473 endif 474 475 # Enable the following CFLAGS additions if you need to compare the 476 # built ELF objects. 477 # 478 # The -g option makes static data global and the "-Qoption ccfe 479 # -xglobalstatic" option tells the compiler to not globalize static 480 # data using a unique globalization prefix. Instead force the use of 481 # a static globalization prefix based on the source filepath so the 482 # objects from two identical compilations are the same. 483 #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic 484 #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic 485 486 ifeq (${COMPILER_REV_NUMERIC}, 502) 487 COMPILER_DATE := $(shell $(CPP) -V 2>&1 | sed -n '/^.*[ ]C++[ ]\([1-9]\.[0-9][0-9]*\)/p' | awk '{ print $$NF; }') 488 ifeq (${COMPILER_DATE}, 2001/01/31) 489 # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy 490 # use an innocuous value because it will get -g if it's empty 491 FASTDEBUG_CFLAGS = -c 492 endif 493 endif 494 495 # Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information. 496 # CFLAGS_BROWSE = -sbfast 497 CFLAGS += $(CFLAGS_BROWSE) 498 499 # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7) 500 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1) 501 # use ild when debugging (but when optimizing we want reproducible results) 502 ILDFLAG = $(ILDFLAG/$(VERSION)) 503 ILDFLAG/debug = -xildon 504 ILDFLAG/optimized = 505 AOUT_FLAGS += $(ILDFLAG) 506 endif 507 508 # Where to put the *.o files (a.out, or shared library)? 509 LINK_INTO = $(LINK_INTO/$(VERSION)) 510 LINK_INTO/debug = LIBJVM 511 LINK_INTO/optimized = LIBJVM 512 513 # We link the debug version into the a.out because: 514 # 1. ild works on a.out but not shared libraries, and using ild 515 # can cut rebuild times by 25% for small changes. (ILD is gone in SS11) 516 # 2. dbx cannot gracefully set breakpoints in shared libraries 517 # 518 519 # apply this setting to link into the shared library even in the debug version: 520 ifdef LP64 |