kernel: when using --gc-sections, add --sort-section=name to get a more stable sorting order

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

Backport of r41951

git-svn-id: svn://svn.openwrt.org/openwrt/branches/barrier_breaker@42009 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2014-08-06 10:30:17 +00:00
parent ca6cac962a
commit 6781ca8d62
3 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
From: Felix Fietkau <nbd@openwrt.org>
use -ffunction-sections, -fdata-sections and --gc-sections
use -ffunction-sections, -fdata-sections and --gc-sections --sort-section=name
In combination with kernel symbol export stripping this significantly reduces
the kernel image size. Used on both ARM and MIPS architectures.
@ -17,7 +17,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
cflags-y += -msoft-float
-LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
+LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections
+LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections --sort-section=name
KBUILD_AFLAGS_MODULE += -mlong-calls
KBUILD_CFLAGS_MODULE += -mlong-calls
@ -423,7 +423,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
endif
+LDFLAGS_vmlinux += --gc-sections
+LDFLAGS_vmlinux += --gc-sections --sort-section=name
OBJCOPYFLAGS :=-O binary -R .comment -S
GZFLAGS :=-9

View File

@ -7,5 +7,5 @@
-cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
+cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
cflags-y += -msoft-float
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections --sort-section=name
KBUILD_AFLAGS_MODULE += -mlong-calls

View File

@ -3,7 +3,7 @@
@@ -90,8 +90,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
cflags-y += -msoft-float
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections --sort-section=name
+ifdef CONFIG_64BIT
KBUILD_AFLAGS_MODULE += -mlong-calls
KBUILD_CFLAGS_MODULE += -mlong-calls