Print this page
9939 Need to stop GCC reordering functions


 324 # using this workaround is not applicable for x86.
 325 #
 326 CCSTATICSYM=            -Wc,-Qassembler-ounrefsym=0
 327 #
 328 # generate 32-bit addresses in the v9 kernel. Saves memory.
 329 CCABS32=                -Wc,-xcode=abs32
 330 #
 331 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
 332 # system calls.
 333 CC32BITCALLERS=         -_gcc=-massume-32bit-callers
 334 
 335 # GCC, especially, is increasingly beginning to auto-inline functions and
 336 # sadly does so separately not under the general -fno-inline-functions
 337 # Additionally, we wish to prevent optimisations which cause GCC to clone
 338 # functions -- in particular, these may cause unhelpful symbols to be
 339 # emitted instead of function names
 340 CCNOAUTOINLINE= \
 341         -_gcc=-fno-inline-small-functions \
 342         -_gcc=-fno-inline-functions-called-once \
 343         -_gcc=-fno-ipa-cp \
 344         -_gcc6=-fno-ipa-icf \
 345         -_gcc7=-fno-ipa-icf \
 346         -_gcc8=-fno-ipa-icf \
 347         -_gcc6=-fno-clone-functions \
 348         -_gcc7=-fno-clone-functions \
 349         -_gcc8=-fno-clone-functions










 350 
 351 # One optimization the compiler might perform is to turn this:
 352 #       #pragma weak foo
 353 #       extern int foo;
 354 #       if (&foo)
 355 #               foo = 5;
 356 # into
 357 #       foo = 5;
 358 # Since we do some of this (foo might be referenced in common kernel code
 359 # but provided only for some cpu modules or platforms), we disable this
 360 # optimization.
 361 #
 362 sparc_CCUNBOUND = -Wd,-xsafe=unboundsym
 363 i386_CCUNBOUND  =
 364 CCUNBOUND       = $($(MACH)_CCUNBOUND)
 365 
 366 #
 367 # compiler '-xarch' flag. This is here to centralize it and make it
 368 # overridable for testing.
 369 sparc_XARCH=    -m32


 549 # These variables are intended ONLY for use by developers to safely pass extra
 550 # flags to the compilers without unintentionally overriding Makefile-set
 551 # flags.  They should NEVER be set to any value in a Makefile.
 552 #
 553 # They come last in the associated FLAGS variable such that they can
 554 # explicitly override things if necessary, there are gaps in this, but it's
 555 # the best we can manage.
 556 #
 557 CUSERFLAGS              =
 558 CUSERFLAGS64            = $(CUSERFLAGS)
 559 CCUSERFLAGS             =
 560 CCUSERFLAGS64           = $(CCUSERFLAGS)
 561 
 562 CSOURCEDEBUGFLAGS       =
 563 CCSOURCEDEBUGFLAGS      =
 564 $(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g -xs
 565 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g -xs
 566 
 567 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
 568                 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \
 569                 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
 570                 $(CUSERFLAGS)
 571 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
 572                 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \
 573                 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
 574                 $(CUSERFLAGS64)
 575 #
 576 # Flags that are used to build parts of the code that are subsequently
 577 # run on the build machine (also known as the NATIVE_BUILD).
 578 #
 579 NATIVE_CFLAGS=  $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
 580                 $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \
 581                 $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
 582                 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
 583 
 584 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"       # For messaging.
 585 DTS_ERRNO=-D_TS_ERRNO
 586 CPPFLAGS.first= # Please keep empty.  Only lower makefiles should set this.
 587 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
 588         $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
 589         $(ADJUNCT_PROTO:%=-I%/usr/include)
 590 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
 591                 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
 592 CPPFLAGS=       $(CPPFLAGS.first) $(CPPFLAGS.master)
 593 AS_CPPFLAGS=    $(CPPFLAGS.first) $(CPPFLAGS.master)
 594 JAVAFLAGS=      -source 1.6 -target 1.6 -Xlint:deprecation,-options
 595 
 596 #
 597 # For source message catalogue
 598 #
 599 .SUFFIXES: $(SUFFIXES) .i .po
 600 MSGROOT= $(ROOT)/catalog
 601 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
 602 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)




 324 # using this workaround is not applicable for x86.
 325 #
 326 CCSTATICSYM=            -Wc,-Qassembler-ounrefsym=0
 327 #
 328 # generate 32-bit addresses in the v9 kernel. Saves memory.
 329 CCABS32=                -Wc,-xcode=abs32
 330 #
 331 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
 332 # system calls.
 333 CC32BITCALLERS=         -_gcc=-massume-32bit-callers
 334 
 335 # GCC, especially, is increasingly beginning to auto-inline functions and
 336 # sadly does so separately not under the general -fno-inline-functions
 337 # Additionally, we wish to prevent optimisations which cause GCC to clone
 338 # functions -- in particular, these may cause unhelpful symbols to be
 339 # emitted instead of function names
 340 CCNOAUTOINLINE= \
 341         -_gcc=-fno-inline-small-functions \
 342         -_gcc=-fno-inline-functions-called-once \
 343         -_gcc=-fno-ipa-cp \

 344         -_gcc7=-fno-ipa-icf \
 345         -_gcc8=-fno-ipa-icf \

 346         -_gcc7=-fno-clone-functions \
 347         -_gcc8=-fno-clone-functions \
 348 
 349 # GCC may put functions in different named sub-sections of .text based on
 350 # their presumed calling frequency.  At least in the kernel, where we actually
 351 # deliver relocatable objects, we don't want this to happen.
 352 #
 353 # Since at present we don't benefit from this even in userland, we disable it globally,
 354 # but the application of this may move into usr/src/uts/ in future.
 355 CCNOREORDER=    \
 356         -_gcc7=-fno-reorder-functions \
 357         -_gcc8=-fno-reorder-functions
 358 
 359 # One optimization the compiler might perform is to turn this:
 360 #       #pragma weak foo
 361 #       extern int foo;
 362 #       if (&foo)
 363 #               foo = 5;
 364 # into
 365 #       foo = 5;
 366 # Since we do some of this (foo might be referenced in common kernel code
 367 # but provided only for some cpu modules or platforms), we disable this
 368 # optimization.
 369 #
 370 sparc_CCUNBOUND = -Wd,-xsafe=unboundsym
 371 i386_CCUNBOUND  =
 372 CCUNBOUND       = $($(MACH)_CCUNBOUND)
 373 
 374 #
 375 # compiler '-xarch' flag. This is here to centralize it and make it
 376 # overridable for testing.
 377 sparc_XARCH=    -m32


 557 # These variables are intended ONLY for use by developers to safely pass extra
 558 # flags to the compilers without unintentionally overriding Makefile-set
 559 # flags.  They should NEVER be set to any value in a Makefile.
 560 #
 561 # They come last in the associated FLAGS variable such that they can
 562 # explicitly override things if necessary, there are gaps in this, but it's
 563 # the best we can manage.
 564 #
 565 CUSERFLAGS              =
 566 CUSERFLAGS64            = $(CUSERFLAGS)
 567 CCUSERFLAGS             =
 568 CCUSERFLAGS64           = $(CCUSERFLAGS)
 569 
 570 CSOURCEDEBUGFLAGS       =
 571 CCSOURCEDEBUGFLAGS      =
 572 $(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g -xs
 573 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g -xs
 574 
 575 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
 576                 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \
 577                 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \
 578                 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
 579 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
 580                 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \
 581                 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \
 582                 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
 583 #
 584 # Flags that are used to build parts of the code that are subsequently
 585 # run on the build machine (also known as the NATIVE_BUILD).
 586 #
 587 NATIVE_CFLAGS=  $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
 588                 $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \
 589                 $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
 590                 $(CCNOREORDER) $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
 591 
 592 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"       # For messaging.
 593 DTS_ERRNO=-D_TS_ERRNO
 594 CPPFLAGS.first= # Please keep empty.  Only lower makefiles should set this.
 595 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
 596         $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
 597         $(ADJUNCT_PROTO:%=-I%/usr/include)
 598 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
 599                 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
 600 CPPFLAGS=       $(CPPFLAGS.first) $(CPPFLAGS.master)
 601 AS_CPPFLAGS=    $(CPPFLAGS.first) $(CPPFLAGS.master)
 602 JAVAFLAGS=      -source 1.6 -target 1.6 -Xlint:deprecation,-options
 603 
 604 #
 605 # For source message catalogue
 606 #
 607 .SUFFIXES: $(SUFFIXES) .i .po
 608 MSGROOT= $(ROOT)/catalog
 609 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
 610 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)