440 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) 441 442 CXX_OPT/NONE = 443 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%) 444 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%) 445 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) 446 447 # We need stack frames at all times 448 USE_XKEEPFRAME_OPTION = false 449 ifeq ($(USE_XKEEPFRAME_OPTION),true) 450 451 # Unknown spelling on this option at this time (Maybe in SS13?) 452 CC_XKEEPFRAME_OPTIONS = -xkeepframe 453 CXX_XKEEPFRAME_OPTIONS = -xkeepframe 454 455 else 456 457 # On X86, make sure tail call optimization is off 458 # The z and y are the tail call optimizations. 459 ifeq ($(ARCH_FAMILY), i586) 460 ifeq ($(shell $(EXPR) $(CC_MAJORVER) \>= 5), 1) 461 ifeq ($(shell $(EXPR) $(CC_MINORVER) \> 8), 1) 462 # Somehow, tail call optimization is creeping in. 463 # Make sure it is off. 464 # WARNING: These may cause compiler warnings about duplicate -O options 465 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz 466 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz 467 endif 468 endif 469 endif 470 471 # On i586 we need to tell the code generator to ALWAYS use a 472 # frame pointer. 473 ifeq ($(ARCH_FAMILY), i586) 474 # Note that in 5.7, this is done with -xregs=no%frameptr 475 ifeq ($(CC_VER), 5.5) 476 # It's not exactly clear when this optimization kicks in, the 477 # current assumption is -xO4 or greater and for C++ with 478 # the -features=no%except option and -xO4 and greater. 479 # Bottom line is, we ALWAYS want a frame pointer! 480 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B 481 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B 482 endif 483 484 ifeq ($(shell $(EXPR) $(CC_MAJORVER) \>= 5), 1) 485 ifeq ($(shell $(EXPR) $(CC_MINORVER) \> 6), 1) 486 # Do NOT use frame pointer register as a general purpose opt register 487 CC_OPT/NONE += -xregs=no%frameptr 488 CXX_OPT/NONE += -xregs=no%frameptr 489 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr 490 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr 491 endif 492 endif 493 endif 494 495 # Optimizer for sparc needs to be told not to do certain things 496 # related to frames or save instructions. 497 ifeq ($(ARCH_FAMILY), sparc) 498 # Do not use save instructions instead of add instructions 499 # This was an optimization starting in SC5.0 that made it hard for us to 500 # find the "save" instruction (which got turned into an "add") 501 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s 502 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s 503 # Don't allow tail call code optimization. Started in SC5.0. 504 # We don't like code of this form: 505 # save 506 # <code> 507 # call foo 508 # restore 509 # because we can't tell if the method will have a stack frame 510 # and register windows or not. 511 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0 512 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0 513 endif 549 ifeq ($(ARCH_FAMILY), sparc) 550 # Assume at most 8byte alignment, raise SIGBUS on error 551 ### Presents an ABI issue with customer JNI libs? 552 ####CC_HIGHEST_EXTRAS += -xmemalign=8s 553 # Automatic prefetch instructions, explicit prefetch macros 554 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit 555 # Pick ultra as the chip to optimize to 556 CC_HIGHEST_EXTRAS += -xchip=ultra 557 endif 558 ifeq ($(ARCH), i586) 559 # Pick pentium as the chip to optimize to 560 CC_HIGHEST_EXTRAS += -xchip=pentium 561 endif 562 ifdef LIBRARY 563 # The Solaris CBE (Common Build Environment) requires that the use 564 # of appl registers be disabled when compiling a public library (or 565 # a library that's loaded by a public library) on sparc. 566 CFLAGS_REQUIRED_sparc += -xregs=no%appl 567 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl 568 endif 569 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1) 570 # We MUST allow data alignment of 4 for sparc V8 (32bit) 571 # Presents an ABI issue with customer JNI libs? We must be able to 572 # to handle 4byte aligned objects? (rare occurance, but possible?) 573 CFLAGS_REQUIRED_sparc += -xmemalign=4s 574 endif 575 # Just incase someone trys to use the SOS9 compilers 576 ifeq ($(CC_VER), 5.6) 577 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) 578 CFLAGS_REQUIRED_sparc += -xmemalign=4s 579 endif 580 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) 581 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. 582 AUTOMATIC_PCH_OPTION = 583 584 # Add in keep frame options 585 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS) 586 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS) 587 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS) 588 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS) 589 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS) 590 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS) | 440 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) 441 442 CXX_OPT/NONE = 443 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%) 444 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%) 445 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) 446 447 # We need stack frames at all times 448 USE_XKEEPFRAME_OPTION = false 449 ifeq ($(USE_XKEEPFRAME_OPTION),true) 450 451 # Unknown spelling on this option at this time (Maybe in SS13?) 452 CC_XKEEPFRAME_OPTIONS = -xkeepframe 453 CXX_XKEEPFRAME_OPTIONS = -xkeepframe 454 455 else 456 457 # On X86, make sure tail call optimization is off 458 # The z and y are the tail call optimizations. 459 ifeq ($(ARCH_FAMILY), i586) 460 CC_NEWER_THAN_58 := \ 461 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \ 462 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 8 \) ) 463 ifeq ($(CC_NEWER_THAN_58),1) 464 # Somehow, tail call optimization is creeping in. 465 # Make sure it is off. 466 # WARNING: These may cause compiler warnings about duplicate -O options 467 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz 468 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz 469 endif 470 endif 471 472 # On i586 we need to tell the code generator to ALWAYS use a 473 # frame pointer. 474 ifeq ($(ARCH_FAMILY), i586) 475 # Note that in 5.7, this is done with -xregs=no%frameptr 476 ifeq ($(CC_VER), 5.5) 477 # It's not exactly clear when this optimization kicks in, the 478 # current assumption is -xO4 or greater and for C++ with 479 # the -features=no%except option and -xO4 and greater. 480 # Bottom line is, we ALWAYS want a frame pointer! 481 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B 482 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B 483 endif 484 485 CC_NEWER_THAN_56 := \ 486 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \ 487 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) ) 488 ifeq ($(CC_NEWER_THAN_56),1) 489 # Do NOT use frame pointer register as a general purpose opt register 490 CC_OPT/NONE += -xregs=no%frameptr 491 CXX_OPT/NONE += -xregs=no%frameptr 492 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr 493 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr 494 endif 495 endif 496 497 # Optimizer for sparc needs to be told not to do certain things 498 # related to frames or save instructions. 499 ifeq ($(ARCH_FAMILY), sparc) 500 # Do not use save instructions instead of add instructions 501 # This was an optimization starting in SC5.0 that made it hard for us to 502 # find the "save" instruction (which got turned into an "add") 503 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s 504 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s 505 # Don't allow tail call code optimization. Started in SC5.0. 506 # We don't like code of this form: 507 # save 508 # <code> 509 # call foo 510 # restore 511 # because we can't tell if the method will have a stack frame 512 # and register windows or not. 513 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0 514 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0 515 endif 551 ifeq ($(ARCH_FAMILY), sparc) 552 # Assume at most 8byte alignment, raise SIGBUS on error 553 ### Presents an ABI issue with customer JNI libs? 554 ####CC_HIGHEST_EXTRAS += -xmemalign=8s 555 # Automatic prefetch instructions, explicit prefetch macros 556 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit 557 # Pick ultra as the chip to optimize to 558 CC_HIGHEST_EXTRAS += -xchip=ultra 559 endif 560 ifeq ($(ARCH), i586) 561 # Pick pentium as the chip to optimize to 562 CC_HIGHEST_EXTRAS += -xchip=pentium 563 endif 564 ifdef LIBRARY 565 # The Solaris CBE (Common Build Environment) requires that the use 566 # of appl registers be disabled when compiling a public library (or 567 # a library that's loaded by a public library) on sparc. 568 CFLAGS_REQUIRED_sparc += -xregs=no%appl 569 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl 570 endif 571 CC_NEWER_THAN_56 := \ 572 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \ 573 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) ) 574 ifeq ($(CC_NEWER_THAN_56),1) 575 # Presents an ABI issue with customer JNI libs? We must be able to 576 # to handle 4byte aligned objects? (rare occurance, but possible?) 577 CFLAGS_REQUIRED_sparc += -xmemalign=4s 578 endif 579 # Just incase someone trys to use the SOS9 compilers 580 ifeq ($(CC_VER), 5.6) 581 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) 582 CFLAGS_REQUIRED_sparc += -xmemalign=4s 583 endif 584 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) 585 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. 586 AUTOMATIC_PCH_OPTION = 587 588 # Add in keep frame options 589 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS) 590 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS) 591 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS) 592 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS) 593 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS) 594 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS) |