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