355 # emitted instead of function names
356 CCNOAUTOINLINE= \
357 -_gcc=-fno-inline-small-functions \
358 -_gcc=-fno-inline-functions-called-once \
359 -_gcc=-fno-ipa-cp \
360 -_gcc7=-fno-ipa-icf \
361 -_gcc8=-fno-ipa-icf \
362 -_gcc7=-fno-clone-functions \
363 -_gcc8=-fno-clone-functions
364
365 # GCC may put functions in different named sub-sections of .text based on
366 # their presumed calling frequency. At least in the kernel, where we actually
367 # deliver relocatable objects, we don't want this to happen.
368 #
369 # Since at present we don't benefit from this even in userland, we disable it globally,
370 # but the application of this may move into usr/src/uts/ in future.
371 CCNOREORDER= \
372 -_gcc7=-fno-reorder-functions \
373 -_gcc8=-fno-reorder-functions
374
375 # One optimization the compiler might perform is to turn this:
376 # #pragma weak foo
377 # extern int foo;
378 # if (&foo)
379 # foo = 5;
380 # into
381 # foo = 5;
382 # Since we do some of this (foo might be referenced in common kernel code
383 # but provided only for some cpu modules or platforms), we disable this
384 # optimization.
385 #
386 sparc_CCUNBOUND = -Wd,-xsafe=unboundsym
387 i386_CCUNBOUND =
388 CCUNBOUND = $($(MACH)_CCUNBOUND)
389
390 #
391 # compiler '-xarch' flag. This is here to centralize it and make it
392 # overridable for testing.
393 sparc_XARCH= -m32
394 sparcv9_XARCH= -m64
584 # flags to the compilers without unintentionally overriding Makefile-set
585 # flags. They should NEVER be set to any value in a Makefile.
586 #
587 # They come last in the associated FLAGS variable such that they can
588 # explicitly override things if necessary, there are gaps in this, but it's
589 # the best we can manage.
590 #
591 CUSERFLAGS =
592 CUSERFLAGS64 = $(CUSERFLAGS)
593 CCUSERFLAGS =
594 CCUSERFLAGS64 = $(CCUSERFLAGS)
595
596 CSOURCEDEBUGFLAGS =
597 CCSOURCEDEBUGFLAGS =
598 $(SRCDBGBLD)CSOURCEDEBUGFLAGS = $(CCGDEBUG) -xs
599 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS = $(CCGDEBUG) -xs
600
601 CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
602 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \
603 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \
604 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
605 CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
606 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \
607 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \
608 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
609 #
610 # Flags that are used to build parts of the code that are subsequently
611 # run on the build machine (also known as the NATIVE_BUILD).
612 #
613 NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
614 $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \
615 $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
616 $(CCNOREORDER) $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
617
618 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
619 DTS_ERRNO=-D_TS_ERRNO
620 CPPFLAGS.first= # Please keep empty. Only lower makefiles should set this.
621 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
622 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
623 $(ADJUNCT_PROTO:%=-I%/usr/include)
624 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
625 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
626 CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
627 AS_CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
|
355 # emitted instead of function names
356 CCNOAUTOINLINE= \
357 -_gcc=-fno-inline-small-functions \
358 -_gcc=-fno-inline-functions-called-once \
359 -_gcc=-fno-ipa-cp \
360 -_gcc7=-fno-ipa-icf \
361 -_gcc8=-fno-ipa-icf \
362 -_gcc7=-fno-clone-functions \
363 -_gcc8=-fno-clone-functions
364
365 # GCC may put functions in different named sub-sections of .text based on
366 # their presumed calling frequency. At least in the kernel, where we actually
367 # deliver relocatable objects, we don't want this to happen.
368 #
369 # Since at present we don't benefit from this even in userland, we disable it globally,
370 # but the application of this may move into usr/src/uts/ in future.
371 CCNOREORDER= \
372 -_gcc7=-fno-reorder-functions \
373 -_gcc8=-fno-reorder-functions
374
375 #
376 # gcc has a rather aggressive optimization on by default that infers loop
377 # bounds based on undefined behavior (!!). This can lead to some VERY
378 # surprising optimizations -- ones that may be technically correct in the
379 # strictest sense but also result in incorrect program behavior. We turn
380 # this optimization off, with extreme prejudice.
381 #
382 CCNOAGGRESSIVELOOPS= \
383 -_gcc7=-fno-aggressive-loop-optimizations \
384 -_gcc8=-fno-aggressive-loop-optimizations
385
386 # One optimization the compiler might perform is to turn this:
387 # #pragma weak foo
388 # extern int foo;
389 # if (&foo)
390 # foo = 5;
391 # into
392 # foo = 5;
393 # Since we do some of this (foo might be referenced in common kernel code
394 # but provided only for some cpu modules or platforms), we disable this
395 # optimization.
396 #
397 sparc_CCUNBOUND = -Wd,-xsafe=unboundsym
398 i386_CCUNBOUND =
399 CCUNBOUND = $($(MACH)_CCUNBOUND)
400
401 #
402 # compiler '-xarch' flag. This is here to centralize it and make it
403 # overridable for testing.
404 sparc_XARCH= -m32
405 sparcv9_XARCH= -m64
595 # flags to the compilers without unintentionally overriding Makefile-set
596 # flags. They should NEVER be set to any value in a Makefile.
597 #
598 # They come last in the associated FLAGS variable such that they can
599 # explicitly override things if necessary, there are gaps in this, but it's
600 # the best we can manage.
601 #
602 CUSERFLAGS =
603 CUSERFLAGS64 = $(CUSERFLAGS)
604 CCUSERFLAGS =
605 CCUSERFLAGS64 = $(CCUSERFLAGS)
606
607 CSOURCEDEBUGFLAGS =
608 CCSOURCEDEBUGFLAGS =
609 $(SRCDBGBLD)CSOURCEDEBUGFLAGS = $(CCGDEBUG) -xs
610 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS = $(CCGDEBUG) -xs
611
612 CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
613 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \
614 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \
615 $(CCNOAGGRESSIVELOOPS) \
616 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
617 CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
618 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \
619 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \
620 $(CCNOAGGRESSIVELOOPS) \
621 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
622 #
623 # Flags that are used to build parts of the code that are subsequently
624 # run on the build machine (also known as the NATIVE_BUILD).
625 #
626 NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
627 $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \
628 $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
629 $(CCNOREORDER) $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
630
631 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
632 DTS_ERRNO=-D_TS_ERRNO
633 CPPFLAGS.first= # Please keep empty. Only lower makefiles should set this.
634 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
635 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
636 $(ADJUNCT_PROTO:%=-I%/usr/include)
637 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
638 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
639 CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
640 AS_CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
|