Changeset 9780584 in mainline


Ignore:
Timestamp:
2017-06-05T16:21:21Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a961619
Parents:
7a99507
Message:

Use -ffunction-sections and —gc-sections

This change results in vast reduction of binary image sizes. For example, the
amd64 ISO image was 38MiB before this change and is only 25MiB after the change.

Unfortunately the ia64 linker ignores —gc-sections for some reason so it cannot
be turned on globally.

Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r7a99507 r9780584  
    235235GCC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
    236236        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
    237         -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
    238         -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
    239         -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
    240         -pipe -ggdb -D__$(ENDIANESS)__
     237        -finput-charset=UTF-8 -ffreestanding -fno-builtin -ffunction-sections \
     238        -nostdlib -nostdinc -Wall -Wextra -Wno-clobbered -Wno-unused-parameter \
     239        -Wmissing-prototypes -std=gnu99 -Werror-implicit-function-declaration \
     240        -Wwrite-strings -pipe -ggdb -D__$(ENDIANESS)__
    241241
    242242ICC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
  • uspace/lib/c/arch/amd64/Makefile.common

    r7a99507 r9780584  
    2929GCC_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
    3030CLANG_CFLAGS += -fno-omit-frame-pointer
     31LFLAGS += --gc-sections
    3132
    3233ENDIANESS = LE
  • uspace/lib/c/arch/arm32/Makefile.common

    r7a99507 r9780584  
    2828#
    2929
    30 GCC_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame -march=$(subst _,-,$(PROCESSOR_ARCH))
     30GCC_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame \
     31              -march=$(subst _,-,$(PROCESSOR_ARCH))
     32LFLAGS += --gc-sections
    3133
    3234ifeq ($(CONFIG_FPU),y)
  • uspace/lib/c/arch/ia32/Makefile.common

    r7a99507 r9780584  
    2828
    2929ifeq ($(PROCESSOR),i486)
    30         GCC_CFLAGS += -march=i486 -mno-tls-direct-seg-refs -fno-omit-frame-pointer
     30        GCC_CFLAGS += -march=i486
    3131else
    32         GCC_CFLAGS += -march=pentium -mno-tls-direct-seg-refs -fno-omit-frame-pointer
     32        GCC_CFLAGS += -march=pentium
    3333endif
    3434
     35GCC_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
    3536CLANG_CFLAGS += -fno-omit-frame-pointer
     37LFLAGS += --gc-sections
    3638
    3739ENDIANESS = LE
  • uspace/lib/c/arch/mips32/Makefile.common

    r7a99507 r9780584  
    3030BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    3131AS_PROLOG = .module softfloat;.abicalls;
     32LFLAGS += --gc-sections
    3233
    3334ENDIANESS = LE
  • uspace/lib/c/arch/mips32eb/Makefile.common

    r7a99507 r9780584  
    3030BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    3131AS_PROLOG = .module softfloat;.abicalls;
     32LFLAGS += --gc-sections
    3233
    3334ENDIANESS = BE
  • uspace/lib/c/arch/ppc32/Makefile.common

    r7a99507 r9780584  
    2727#
    2828
    29 
    3029ifeq ($(CONFIG_FPU),y)
    3130        FLOATS=hard
     
    3736BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    3837AFLAGS += -a32
     38LFLAGS += --gc-sections
    3939
    4040ENDIANESS = BE
  • uspace/lib/c/arch/sparc64/Makefile.common

    r7a99507 r9780584  
    3535GCC_CFLAGS += -m64 -mcmodel=medlow
    3636
    37 LFLAGS += -no-check-sections
     37LFLAGS += -no-check-sections --gc-sections
    3838
    3939ENDIANESS = BE
Note: See TracChangeset for help on using the changeset viewer.