Changeset cf84f1bf in mainline for kernel/Makefile


Ignore:
Timestamp:
2010-05-26T15:36:03Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3c664d6
Parents:
938f227
Message:

add kernel support for link-time optimization (GCC 4.5+)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r938f227 rcf84f1bf  
    118118endif
    119119
     120ifeq ($(CONFIG_LTO),y)
     121        GCC_CFLAGS += -flto
     122endif
     123
    120124-include arch/$(KARCH)/Makefile.inc
    121125-include genarch/Makefile.inc
     
    167171        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    168172endif
     173
     174AFLAGS =
     175LFLAGS = -N -T $(LINK) -M
    169176
    170177## Generic kernel sources
     
    348355GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
    349356
     357LFLAGS_LTO := $(addprefix -Xlinker ,$(LFLAGS))
     358
    350359ifeq ($(CONFIG_SYMTAB),y)
    351360        SYMTAB_OBJECTS := generic/src/debug/real_map.o
     
    361370
    362371$(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
    363         $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
     372ifeq ($(CONFIG_LTO),y)
     373        $(GCC) $(LFLAGS_LTO) -Xlinker -Map -Xlinker $(MAP) $(DEFS) $(GCC_CFLAGS) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
     374else
     375        $(LD) $(LFLAGS) -Map $(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
     376endif
    364377ifeq ($(CONFIG_STRIP_BINARIES),y)
    365         $(STRIP) $(RAW) 
     378        $(STRIP) $(RAW)
    366379endif
    367380
     
    370383
    371384%.o: %.S $(DEPEND)
    372         $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
     385        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c -o $@ $<
    373386ifeq ($(PRECHECK),y)
    374387        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(GCC_CFLAGS) -D__ASM__
     
    387400
    388401test/fpu/%.o: test/fpu/%.c $(DEPEND)
    389         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
     402        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c -o $@ $<
    390403ifeq ($(PRECHECK),y)
    391404        $(JOBFILE) $(JOB) $< $@ cc test $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
     
    397410
    398411%.o: %.c $(DEPEND)
    399         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@
     412        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c -o $@ $<
    400413ifeq ($(PRECHECK),y)
    401414        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
     
    407420$(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
    408421        echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o $(EMPTY_MAP)
    409         $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
     422ifeq ($(CONFIG_LTO),y)
     423        $(GCC) $(LFLAGS_LTO) -Xlinker -Map -Xlinker $(MAP_PREV) $(DEFS) $(GCC_CFLAGS) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
     424else
     425        $(LD) $(LFLAGS) -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
     426endif
    410427        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
    411428        $(GENMAP) $(MAP_PREV) $(DUMP) $@
     
    415432       
    416433        echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o $(SIZEOK_MAP)
    417         $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
     434ifeq ($(CONFIG_LTO),y)
     435        $(GCC) $(LFLAGS_LTO) -Xlinker -Map -Xlinker $(MAP_PREV) $(DEFS) $(GCC_CFLAGS) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
     436else
     437        $(LD) $(LFLAGS) -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
     438endif
    418439        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
    419440        $(GENMAP) $(MAP_PREV) $(DUMP) $@
Note: See TracChangeset for help on using the changeset viewer.