1 # 2 # Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 # 27 # Makefile to specify compiler flags for programs and libraries 28 # targeted to Solaris. Should not contain any rules. 29 # 30 # WARNING: This file is shared with other workspaces. 31 # So when it includes other files, it must use JDK_TOPDIR. 32 # 33 34 # Warning: the following variables are overridden by Defs.gmk. Set 35 # values will be silently ignored: 36 # CFLAGS (set $(OTHER_CFLAGS) instead) 37 # CPPFLAGS (set $(OTHER_CPPFLAGS) instead) 38 # CXXFLAGS (set $(OTHER_CXXFLAGS) instead) 39 # LDFLAGS (set $(OTHER_LDFAGS) instead) 40 # LDLIBS (set $(EXTRA_LIBS) instead) 41 # LDLIBS_COMMON (set $(EXTRA_LIBS) instead) 42 # LINTFLAGS (set $(OTHER_LINTFLAGS) instead) 43 # 44 # Note: CPPFLAGS are used in C and C++ compiles. 45 # 46 47 # Get shared JDK settings 48 include $(JDK_MAKE_SHARED_DIR)/Defs.gmk 49 50 ifndef PLATFORM_SRC 51 PLATFORM_SRC = $(BUILDDIR)/../src/solaris 52 endif # PLATFORM_SRC 53 54 # Platform specific closed sources 55 ifndef OPENJDK 56 ifndef CLOSED_PLATFORM_SRC 57 CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris 58 endif 59 endif 60 61 # platform specific include files 62 PLATFORM_INCLUDE_NAME = $(PLATFORM) 63 PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) 64 65 # suffix used for make dependencies files 66 DEPEND_SUFFIX = d 67 # suffix used for lint files 68 LINT_SUFFIX = ln 69 # The suffix applied to the library name for FDLIBM 70 FDDLIBM_SUFFIX = a 71 # The suffix applied to scripts (.bat for windows, nothing for unix) 72 SCRIPT_SUFFIX = 73 # CC compiler object code output directive flag value 74 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! 75 76 ENABLE_FULL_DEBUG_SYMBOLS ?= 1 77 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 78 79 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 80 # Default OBJCOPY comes from the SUNWbinutils package: 81 DEF_OBJCOPY=/usr/sfw/bin/gobjcopy 82 ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64) 83 # On Solaris AMD64/X64, gobjcopy is not happy and fails: 84 # 85 # usr/sfw/bin/gobjcopy --add-gnu-debuglink=<lib>.debuginfo <lib>.so 86 # BFD: stKPaiop: Not enough room for program headers, try linking with -N 87 # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value 88 # BFD: stKPaiop: Not enough room for program headers, try linking with -N 89 # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value 90 # BFD: stKPaiop: Not enough room for program headers, try linking with -N 91 # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value 92 _JUNK_ := $(shell \ 93 echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64") 94 OBJCOPY= 95 else 96 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 97 ifneq ($(ALT_OBJCOPY),) 98 _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") 99 # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path 100 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 101 endif 102 endif 103 104 # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the 105 # JDK build to import .debuginfo or .diz files from the HotSpot build. 106 # However, adding FDS support to the JDK build will occur in phases 107 # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS) 108 # is used to indicate that a particular library supports FDS. 109 110 ifeq ($(OBJCOPY),) 111 _JUNK_ := $(shell \ 112 echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") 113 ENABLE_FULL_DEBUG_SYMBOLS=0 114 else 115 _JUNK_ := $(shell \ 116 echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") 117 118 # Library stripping policies for .debuginfo configs: 119 # all_strip - strips everything from the library 120 # min_strip - strips most stuff from the library; leaves minimum symbols 121 # no_strip - does not strip the library at all 122 # 123 # Oracle security policy requires "all_strip". A waiver was granted on 124 # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 125 # 126 # 127 # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 128 STRIP_POLICY ?= min_strip 129 130 _JUNK_ := $(shell \ 131 echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") 132 133 ZIP_DEBUGINFO_FILES ?= 1 134 135 _JUNK_ := $(shell \ 136 echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") 137 endif 138 endif 139 140 # 141 # Java default optimization (-x04/-O2) etc. Applies to the VM. 142 # 143 ifndef OPTIMIZATION_LEVEL 144 ifeq ($(PRODUCT), java) 145 OPTIMIZATION_LEVEL = HIGHER 146 else 147 OPTIMIZATION_LEVEL = LOWER 148 endif 149 endif 150 ifndef FASTDEBUG_OPTIMIZATION_LEVEL 151 FASTDEBUG_OPTIMIZATION_LEVEL = LOWER 152 endif 153 154 # 155 # If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the 156 # optimized build, and that ordering of the flags completely freaks 157 # out cc. Hence, -Xa is instead in each CFLAGS variant. 158 # 159 # The more unusual options to the Sun C compiler: 160 # -v Stricter type checking, more error checking 161 # (To turn ALL warnings into fatals, use -errwarn=%all) 162 # -xstrconst Place string literals and constants in read-only area 163 # (means you can't write on your string literals) 164 # -xs Force debug information (stabs) into the .so or a.out 165 # (makes the library/executable debuggable without the 166 # .o files needing to be around, but at a space cost) 167 # -g & -O If you add the -g option to the optimized compiles 168 # you will get better stack retraces, the code is 169 # still optimized. This includes a space cost too. 170 # -xc99=%none Do NOT allow for c99 extensions to be used. 171 # e.g. declarations must precede statements 172 # -xCC Allow the C++ style of comments in C: // 173 # Required with many of the source files. 174 # -mt Assume multi-threaded (important) 175 # 176 # The more unusual options to the Sun C compiler: 177 # +w Print more warnings 178 # +w2 Maximum warnings 179 # 180 181 # 182 # Debug flag for C and C++ compiler 183 # 184 CFLAGS_DEBUG_OPTION = -g $(CC_OPT/NONE) 185 CXXFLAGS_DEBUG_OPTION = -g $(CXX_OPT/NONE) 186 187 # Turn off -g if we are doing tcov build 188 ifdef TCOV_BUILD 189 CFLAGS_DEBUG_OPTION= 190 CXXFLAGS_DEBUG_OPTION= 191 endif 192 193 # FASTDEBUG: Optimize the -g builds, gives us a faster debug java 194 # If true adds -O to the debug compiles. This allows for any assert 195 # tests to remain and debug checking. The resulting code is faster 196 # but less debuggable. Stack traces are still valid, although only 197 # approximate line numbers are given. Printing of local variables 198 # during a debugging session is not possible, but stepping and 199 # printing of global or static variables should be possible. 200 # Performance/size of files should be about the same, maybe smaller. 201 # 202 ifeq ($(FASTDEBUG), true) 203 CFLAGS_DEBUG_OPTION = -g $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) 204 CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) 205 endif 206 207 CFLAGS_COMMON = -L$(OBJDIR) 208 209 # Do not allow C99 language features like declarations in code etc. 210 CFLAGS_COMMON += -xc99=%none 211 212 # Allow C++ comments in C code 213 CFLAGS_COMMON += -xCC 214 215 # Show error message tags on errors 216 CFLAGS_COMMON += -errshort=tags 217 CXXFLAGS_COMMON += -errtags=yes 218 219 # Optimization flags 220 CFLAGS_OPT = $(CC_OPT) 221 222 # Debug version flags 223 CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION) 224 225 # Required C compiler flags 226 CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED) 227 228 # Maximum warnings all the time 229 CXXFLAGS_COMMON += +w 230 CFLAGS_COMMON += -v 231 232 # Assume MT behavior all the time (important) 233 CXXFLAGS_COMMON += -mt 234 CFLAGS_COMMON += -mt 235 236 # Assume no C++ exceptions are used 237 CXXFLAGS_COMMON += -features=no%except -DCC_NOEX 238 239 # For C++, these options tell it to assume nothing about locating libraries 240 # either at compile time, or at runtime. Use of these options will likely 241 # require the use of -L and -R options to indicate where libraries will 242 # be found at compile time (-L) and at runtime (-R). 243 # The /usr/lib location comes for free, so no need to specify that one. 244 # Note: C is much simplier and there is no need for these options. This 245 # is mostly needed to avoid dependencies on libraries in the 246 # Compiler install area, also see LIBCXX and LIBM. 247 CXXFLAGS_COMMON += -norunpath -xnolib 248 249 # 250 # Treat compiler warnings as errors, if requested 251 # 252 ifeq ($(COMPILER_WARNINGS_FATAL),true) 253 CFLAGS_COMMON += -errwarn=%all 254 CXXFLAGS_COMMON += -errwarn=%all 255 endif 256 257 CXXFLAGS_OPT = $(CXX_OPT) 258 CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION) 259 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) 260 261 # Add -xstrconst to the library compiles. This forces all string 262 # literals into the read-only data section, which prevents them from 263 # being written to and increases the runtime pages shared on the system. 264 # 265 ifdef LIBRARY 266 CFLAGS_COMMON +=-xstrconst 267 endif 268 269 # Source browser database 270 # 271 # COMPILE_WITH_SB 272 # If defined adds -xsb to compiles and creates a 273 # source browsing database during compilation. 274 # 275 ifdef COMPILE_WITH_SB 276 ifeq ($(LIBRARY), java) 277 CFLAGS_DBG += -xsb 278 endif 279 endif 280 281 # Lint Flags: 282 # -Xa ANSI C plus K&R, favor ANSI rules 283 # -fd report on old style func defs 284 # -errchk=structarg report on 64bit struct args by value 285 # -errchk=longptr64 report on 64bit to 32bit issues (ignores casts) 286 # -errchk=parentheses report on suggested use of extra parens 287 # -v suppress unused args 288 # -x suppress unused externs 289 # -u suppress extern func/vars used/defined 290 # -errfmt=simple use one line errors with position info 291 # $(LINT_XARCH_OPTION) See Compiler-sun.gwk 292 293 LINTFLAGS_COMMON = -Xa 294 LINTFLAGS_COMMON += -fd 295 LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses 296 LINTFLAGS_COMMON += -v 297 LINTFLAGS_COMMON += -x 298 LINTFLAGS_COMMON += -u 299 LINTFLAGS_COMMON += -errfmt=simple 300 LINTFLAGS_OPT = 301 LINTFLAGS_DBG = 302 303 # The -W0,-noglobal tells the compiler to NOT generate mangled global 304 # ELF data symbols for file local static data. 305 # This can break fix&continue, but we'd rather do the same compilations 306 # for deliverable bits as we do for non-deliverable bits 307 # Tell the compilers to never generate globalized names, all the time. 308 CFLAGS_COMMON += -W0,-noglobal 309 310 # If we have a specific arch value to use, add it 311 CFLAGS_COMMON += $(XARCH_OPTION) 312 CXXFLAGS_COMMON += $(XARCH_OPTION) 313 ASFLAGS_COMMON += $(AS_XARCH_OPTION) 314 EXTRA_LIBS += $(XARCH_OPTION) 315 LINTFLAGS_COMMON += $(LINT_XARCH_OPTION) 316 317 # 318 # uncomment the following to build with PERTURBALOT set 319 # 320 # OTHER_CFLAGS += -DPERTURBALOT 321 # 322 323 CPPFLAGS_COMMON = -D__solaris__ -D$(ARCH_FAMILY) 324 CPPFLAGS_OPT = -DNDEBUG 325 CPPFLAGS_DBG = -DDEBUG 326 327 ifneq ($(PRODUCT), java) 328 CPPFLAGS_DBG += -DLOGGING -DDBINFO 329 endif 330 331 ifeq ($(ARCH_FAMILY), i586) 332 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the 333 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN 334 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). 335 # Note: -Dmacro is the same as #define macro 1 336 # -Dmacro= is the same as #define macro 337 # 338 CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH) 339 # Turn off a superfluous compiler error message on Intel 340 CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE 341 endif 342 343 # Java memory management is based on memory mapping by default, but a 344 # system only assuming malloc/free can be built by adding -DUSE_MALLOC 345 346 CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS 347 CPPFLAGS_OPT += -DTRIMMED 348 349 LDFLAGS_DEFS_OPTION = -z defs 350 LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) 351 352 # 353 # -L paths for finding and -ljava 354 # 355 LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) 356 LDFLAGS_OPT = 357 LDFLAGS_DBG = 358 359 # 360 # We never really want the incremental linker, ever 361 # The -xildoff option tells Sun's compilers to NOT use incremental linker 362 # 363 LDFLAGS_COMMON += -xildoff 364 365 ifdef LIBRARY 366 # Libraries need to locate other libraries at runtime, and you can tell 367 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) 368 # buried inside the .so. The $ORIGIN says to look relative to where 369 # the library itself is and it can be followed with relative paths from 370 # that. By default we always look in $ORIGIN, optionally we add relative 371 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. 372 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. 373 # Try: 'dump -Lv lib*.so' to see these settings in a library. 374 # 375 LDFLAGS_COMMON += -R\$$ORIGIN 376 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%) 377 endif 378 379 EXTRA_LIBS += -lc 380 381 # Postprocessing is done on the images directories only 382 # 383 ifeq ($(VARIANT), OPT) 384 ifeq ($(PARTIAL_GPROF), true) 385 NO_STRIP = true 386 endif 387 ifeq ($(GPROF), true) 388 NO_STRIP = true 389 endif 390 ifneq ($(NO_STRIP), true) 391 # Debug 'strip -x' leaves local function Elf symbols (better stack traces) 392 POST_STRIP_PROCESS = $(STRIP) -x 393 endif 394 endif 395 POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)" 396 397 # 398 # Sun C compiler will take -M and pass it on to ld. 399 # Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o 400 # 401 ifeq ($(CC_VERSION),gcc) 402 LD_MAPFILE_FLAG = -Xlinker -M -Xlinker 403 else 404 LD_MAPFILE_FLAG = -M 405 endif 406 407 # 408 # Variables globally settable from the make command line (default 409 # values in brackets): 410 # GPROF (false) 411 # Eg: % gnumake GPROF=true 412 GPROF = false 413 ifeq ($(GPROF), true) 414 CFLAGS_COMMON += -DGPROF -xpg 415 EXTRA_LIBS += -xpg 416 endif 417 418 # PARTIAL_GPROF is to be used ONLY during compilation - it should not 419 # appear during linking of libraries or programs. It also should 420 # prevent linking with -z defs to allow a symbol to remain undefined. 421 # 422 PARTIAL_GPROF = false 423 ifeq ($(PARTIAL_GPROF), true) 424 CFLAGS_GPROF += -xpg 425 LDFLAGS_DEFS_OPTION = -z nodefs 426 endif 427 428 # 429 # For a TCOV build we add in the TCOV_OPTION 430 # 431 ifdef TCOV_BUILD 432 TCOV_OPTION = -xprofile=tcov 433 LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic 434 CFLAGS_COMMON += $(TCOV_OPTION) 435 CXXFLAGS_COMMON += $(TCOV_OPTION) 436 EXTRA_LIBS += $(TCOV_OPTION) 437 LDNOMAP=true 438 endif 439 440 # 441 # Solaris only uses native threads. 442 # 443 THREADS_FLAG= native 444 THREADS_DIR= threads 445 446 # 447 # Support for Quantify. 448 # 449 ifdef QUANTIFY 450 QUANTIFY_CMD = quantify 451 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes 452 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) 453 ifdef LIBRARY 454 CFLAGS_COMMON += -K PIC 455 endif 456 endif 457 458 # 459 # Support for Purify. 460 # 461 ifdef PURIFY 462 PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify 463 PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes 464 LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS) 465 ifdef LIBRARY 466 CFLAGS_COMMON += -K PIC 467 endif 468 endif 469 470 # 471 # Different "levels" of optimization. 472 # 473 ifeq ($(CC_VERSION),gcc) 474 475 CC_OPT/NONE = 476 CC_OPT/LOWER = -O2 477 CC_OPT/HIGHER = -O3 478 CC_OPT/HIGHEST = -O3 479 480 CXX_OPT/NONE = 481 CXX_OPT/LOWER = -O2 482 CXX_OPT/HIGHER = -O3 483 CXX_OPT/HIGHEST = -O3 484 485 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer 486 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer 487 488 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) 489 # (See Rules.gmk) May need to wait for gcc 5? 490 AUTOMATIC_PCH_OPTION = 491 492 else 493 494 # Highest could be -xO5, but indications are that -xO5 should be reserved 495 # for a per-file use, on sources with known performance impacts. 496 OPT_LEVEL/LOWER = 2 497 OPT_LEVEL/HIGHER = 4 498 OPT_LEVEL/HIGHEST = 4 499 500 CC_OPT/NONE = 501 CC_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%) 502 CC_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%) 503 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) 504 505 CXX_OPT/NONE = 506 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%) 507 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%) 508 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) 509 510 # We need stack frames at all times 511 USE_XKEEPFRAME_OPTION = false 512 ifeq ($(USE_XKEEPFRAME_OPTION),true) 513 514 # Unknown spelling on this option at this time (Maybe in SS13?) 515 CC_XKEEPFRAME_OPTIONS = -xkeepframe 516 CXX_XKEEPFRAME_OPTIONS = -xkeepframe 517 518 else 519 520 # On X86, make sure tail call optimization is off 521 # The z and y are the tail call optimizations. 522 ifeq ($(ARCH_FAMILY), i586) 523 CC_NEWER_THAN_58 := \ 524 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \ 525 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 8 \) ) 526 ifeq ($(CC_NEWER_THAN_58),1) 527 # Somehow, tail call optimization is creeping in. 528 # Make sure it is off. 529 # WARNING: These may cause compiler warnings about duplicate -O options 530 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz 531 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz 532 endif 533 endif 534 535 # On i586 we need to tell the code generator to ALWAYS use a 536 # frame pointer. 537 ifeq ($(ARCH_FAMILY), i586) 538 # Note that in 5.7, this is done with -xregs=no%frameptr 539 ifeq ($(CC_VER), 5.5) 540 # It's not exactly clear when this optimization kicks in, the 541 # current assumption is -xO4 or greater and for C++ with 542 # the -features=no%except option and -xO4 and greater. 543 # Bottom line is, we ALWAYS want a frame pointer! 544 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B 545 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B 546 endif 547 548 CC_NEWER_THAN_56 := \ 549 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \ 550 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) ) 551 ifeq ($(CC_NEWER_THAN_56),1) 552 # Do NOT use frame pointer register as a general purpose opt register 553 CC_OPT/NONE += -xregs=no%frameptr 554 CXX_OPT/NONE += -xregs=no%frameptr 555 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr 556 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr 557 endif 558 endif 559 560 # Optimizer for sparc needs to be told not to do certain things 561 # related to frames or save instructions. 562 ifeq ($(ARCH_FAMILY), sparc) 563 # Do not use save instructions instead of add instructions 564 # This was an optimization starting in SC5.0 that made it hard for us to 565 # find the "save" instruction (which got turned into an "add") 566 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s 567 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s 568 # Don't allow tail call code optimization. Started in SC5.0. 569 # We don't like code of this form: 570 # save 571 # <code> 572 # call foo 573 # restore 574 # because we can't tell if the method will have a stack frame 575 # and register windows or not. 576 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0 577 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0 578 endif 579 580 endif 581 582 # Extra options used with HIGHEST 583 # 584 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be 585 # done with care, there are some assumptions below that need to 586 # be understood about the use of pointers, and IEEE behavior. 587 # 588 # Use non-standard floating point mode (not IEEE 754) 589 CC_HIGHEST_EXTRAS += -fns 590 # Do some simplification of floating point arithmetic (not IEEE 754) 591 CC_HIGHEST_EXTRAS += -fsimple 592 # Use single precision floating point with 'float' 593 CC_HIGHEST_EXTRAS += -fsingle 594 # Assume memory references via basic pointer types do not alias 595 # (Source with excessing pointer casting and data access with mixed 596 # pointer types are not recommended) 597 CC_HIGHEST_EXTRAS += -xalias_level=basic 598 # Use intrinsic or inline versions for math/std functions 599 # (If you expect perfect errno behavior, do not use this) 600 CC_HIGHEST_EXTRAS += -xbuiltin=%all 601 # Loop data dependency optimizations (need -xO3 or higher) 602 CC_HIGHEST_EXTRAS += -xdepend 603 # Pointer parameters to functions do not overlap 604 # (Similar to -xalias_level=basic usage, but less obvious sometimes. 605 # If you pass in multiple pointers to the same data, do not use this) 606 CC_HIGHEST_EXTRAS += -xrestrict 607 # Inline some library routines 608 # (If you expect perfect errno behavior, do not use this) 609 CC_HIGHEST_EXTRAS += -xlibmil 610 # Use optimized math routines 611 # (If you expect perfect errno behavior, do not use this) 612 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now 613 # CC_HIGHEST_EXTRAS += -xlibmopt 614 ifeq ($(ARCH_FAMILY), sparc) 615 # Assume at most 8byte alignment, raise SIGBUS on error 616 ### Presents an ABI issue with customer JNI libs? 617 ####CC_HIGHEST_EXTRAS += -xmemalign=8s 618 # Automatic prefetch instructions, explicit prefetch macros 619 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit 620 # Pick ultra as the chip to optimize to 621 CC_HIGHEST_EXTRAS += -xchip=ultra 622 endif 623 ifeq ($(ARCH), i586) 624 # Pick pentium as the chip to optimize to 625 CC_HIGHEST_EXTRAS += -xchip=pentium 626 endif 627 ifdef LIBRARY 628 # The Solaris CBE (Common Build Environment) requires that the use 629 # of appl registers be disabled when compiling a public library (or 630 # a library that's loaded by a public library) on sparc. 631 CFLAGS_REQUIRED_sparc += -xregs=no%appl 632 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl 633 endif 634 CC_NEWER_THAN_56 := \ 635 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \ 636 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) ) 637 ifeq ($(CC_NEWER_THAN_56),1) 638 # Presents an ABI issue with customer JNI libs? We must be able to 639 # to handle 4byte aligned objects? (rare occurance, but possible?) 640 CFLAGS_REQUIRED_sparc += -xmemalign=4s 641 endif 642 # Just incase someone trys to use the SOS9 compilers 643 ifeq ($(CC_VER), 5.6) 644 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) 645 CFLAGS_REQUIRED_sparc += -xmemalign=4s 646 endif 647 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) 648 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. 649 AUTOMATIC_PCH_OPTION = 650 651 # Add in keep frame options 652 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS) 653 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS) 654 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS) 655 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS) 656 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS) 657 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS) 658 659 # Add in highest optimization settings 660 CC_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS) 661 CXX_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS) 662 663 endif 664 665 # Default optimization settings based on level. 666 CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) 667 CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL)) 668 669 # Flags required all the time 670 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) 671 672 # 673 # Path and option to link against the VM, if you have to. Note that 674 # there are libraries that link against only -ljava, but they do get 675 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas 676 # the library itself should not. 677 # 678 VM_NAME = server 679 JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm 680 JAVALIB = -ljava $(JVMLIB) 681 682 # Part of INCREMENTAL_BUILD mechanism. 683 # Compiler emits things like: path/file.o: file.h 684 # We want something like: relative_path/file.o relative_path/file.d: file.h 685 # In addition on Solaris, any include file starting with / is deleted, 686 # this gets rid of things like /usr/include files, which never change. 687 CC_DEPEND = -xM1 688 CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u 689 690 # Location of openwin libraries (do we really need this anymore?) 691 OPENWIN_HOME = /usr/openwin 692 OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR) 693 694 # Runtime graphics library search paths... 695 OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR) 696 AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB) 697 698 # C++ Runtime library (libCrun.so), use instead of -lCrun. 699 # Originally used instead of -lCrun to guarantee use of the system 700 # .so version and not the .a or .so that came with the compilers. 701 # With the newer compilers this could probably change back to -lCrun but 702 # in general this is ok to continue to do. 703 LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1 704 705 # JDK now requires Solaris 10, so pick up libm.so.2 706 LIBM = /usr/lib$(ISA_DIR)/libm.so.2 707 708 # Socket library 709 LIBSOCKET = -lsocket 710 711 # Network Services library 712 LIBNSL = -lnsl 713 714 # service configuration facility library 715 LIBSCF = -lscf 716 717 # Dynamic Loading library 718 LIBDL = -ldl 719 720 # GLOBAL_KPIC: If set means all libraries are PIC, position independent code 721 # EXCEPT for select compiles 722 # If a .o file is compiled non-PIC then it should be forced 723 # into the RW data segment with a mapfile option. This is done 724 # with object files which generated from .s files. 725 # The -ztext enforces that no relocations remain in the text segment 726 # so that it remains purely read-only for optimum system performance. 727 # Some libraries may use a smaller size (13bit -Kpic) on sparc instead of 728 # (32 bit -KPIC) and will override GLOBAL_KPIC appropriately. 729 # 730 PIC_CODE_LARGE = -KPIC 731 PIC_CODE_SMALL = -Kpic 732 ifndef TCOV_BUILD 733 GLOBAL_KPIC = $(PIC_CODE_LARGE) 734 CXXFLAGS_COMMON += $(GLOBAL_KPIC) 735 CFLAGS_COMMON += $(GLOBAL_KPIC) 736 LDFLAGS_COMMON += -ztext 737 endif # TCOV_BUILD 738 739 # If your platform has DPS, it will have Type1 fonts too, in which case 740 # it is best to enable DPS support until such time as 2D's rasteriser 741 # can fully handle Type1 fonts in all cases. Default is "yes". 742 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs 743 # DPS (Displayable PostScript) is available on Solaris machines 744 745 HAVE_DPS = yes 746 747 # 748 # Japanese manpages 749 # 750 JA_SOURCE_ENCODING = eucJP 751 JA_TARGET_ENCODINGS = eucJP UTF-8 PCK 752 753 # Settings for the JDI - Serviceability Agent binding. 754 HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH) 755 SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX) 756 SA_DEBUGINFO_NAME = $(LIB_PREFIX)saproc.debuginfo 757 SA_DIZ_NAME = $(LIB_PREFIX)saproc.diz 758 INCLUDE_SA=true 759