From ca9111ef641f42ccb32610d8f3ac44767b062e94 Mon Sep 17 00:00:00 2001 From: Boris Gjenero Date: Sun, 18 Dec 2011 06:43:08 +0000 Subject: [PATCH] Add KEEP() around vectors in linker scripts. Vectors are needed by the CPU, but they don't need to be accessed by Rockbox. Without the KEEP(), they can be removed when liking with --gc-sections, creating a broken binary without any warnings. This tells the linker to not remove them. It should enable use of --gc-sections for all targets. When not using --gc-sections, this does not change the binary. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31351 a1c6a512-1295-4272-9138-f99709370657 --- firmware/decompressor/link.lds | 2 +- firmware/rom.lds | 4 ++-- firmware/target/arm/at91sam/boot.lds | 2 +- firmware/target/arm/imx31/app.lds | 2 +- firmware/target/arm/ipod/app.lds | 2 +- firmware/target/arm/iriver/app.lds | 2 +- firmware/target/arm/olympus/app.lds | 2 +- firmware/target/arm/pbell/app.lds | 2 +- firmware/target/arm/philips/app.lds | 2 +- firmware/target/arm/pnx0101/app.lds | 2 +- firmware/target/arm/s3c2440/app.lds | 2 +- firmware/target/arm/s3c2440/boot.lds | 2 +- firmware/target/arm/samsung/app.lds | 2 +- firmware/target/arm/sandisk/app.lds | 2 +- firmware/target/arm/tatung/app.lds | 2 +- firmware/target/arm/tcc780x/app.lds | 2 +- firmware/target/arm/tms320dm320/app.lds | 2 +- firmware/target/mips/ingenic_jz47xx/app.lds | 10 +++++----- firmware/target/mips/ingenic_jz47xx/boot.lds | 10 +++++----- firmware/test/i2c/app.lds | 2 +- firmware/test/kernel/app.lds | 2 +- flash/bootloader/no_rom.lds | 2 +- 22 files changed, 31 insertions(+), 31 deletions(-) diff --git a/firmware/decompressor/link.lds b/firmware/decompressor/link.lds index a33993d9b0..51c0460d42 100644 --- a/firmware/decompressor/link.lds +++ b/firmware/decompressor/link.lds @@ -17,7 +17,7 @@ SECTIONS { _loadaddress = .; _dramend = . + DRAMSIZE; - *(.vectors) + KEEP(*(.vectors)) . = ALIGN(0x200); } > DRAM diff --git a/firmware/rom.lds b/firmware/rom.lds index a56beea915..dadd2ab4eb 100644 --- a/firmware/rom.lds +++ b/firmware/rom.lds @@ -81,8 +81,8 @@ SECTIONS loadaddress = .; _loadaddress = .; _datastart = .; - *(.resetvectors); - *(.vectors); + KEEP(*(.resetvectors)); + KEEP(*(.vectors)); . = ALIGN(0x200); *(.data) . = ALIGN(0x4); diff --git a/firmware/target/arm/at91sam/boot.lds b/firmware/target/arm/at91sam/boot.lds index c638511e47..2497e09958 100644 --- a/firmware/target/arm/at91sam/boot.lds +++ b/firmware/target/arm/at91sam/boot.lds @@ -29,7 +29,7 @@ SECTIONS .vectors 0 : AT (DRAMORIG + DRAMSIZE - 1M) { _start_vectors_section = .; - *(.vectors) + KEEP(*(.vectors)) *(.glue_7) *(.glue_7t) . = ALIGN(4); diff --git a/firmware/target/arm/imx31/app.lds b/firmware/target/arm/imx31/app.lds index ac91ffd767..efa1d35a30 100644 --- a/firmware/target/arm/imx31/app.lds +++ b/firmware/target/arm/imx31/app.lds @@ -89,7 +89,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors) + KEEP(*(.vectors)) _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/ipod/app.lds b/firmware/target/arm/ipod/app.lds index 9c7eb16391..f0773e0139 100644 --- a/firmware/target/arm/ipod/app.lds +++ b/firmware/target/arm/ipod/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/iriver/app.lds b/firmware/target/arm/iriver/app.lds index a98f33dd9f..013a05e411 100644 --- a/firmware/target/arm/iriver/app.lds +++ b/firmware/target/arm/iriver/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/olympus/app.lds b/firmware/target/arm/olympus/app.lds index a98f33dd9f..013a05e411 100644 --- a/firmware/target/arm/olympus/app.lds +++ b/firmware/target/arm/olympus/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/pbell/app.lds b/firmware/target/arm/pbell/app.lds index a98f33dd9f..013a05e411 100644 --- a/firmware/target/arm/pbell/app.lds +++ b/firmware/target/arm/pbell/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/philips/app.lds b/firmware/target/arm/philips/app.lds index a98f33dd9f..013a05e411 100644 --- a/firmware/target/arm/philips/app.lds +++ b/firmware/target/arm/philips/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/pnx0101/app.lds b/firmware/target/arm/pnx0101/app.lds index 3b7b73c7b0..f14ef90129 100644 --- a/firmware/target/arm/pnx0101/app.lds +++ b/firmware/target/arm/pnx0101/app.lds @@ -73,7 +73,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; *(.dmabuf) } >IRAM0 AT> DRAM diff --git a/firmware/target/arm/s3c2440/app.lds b/firmware/target/arm/s3c2440/app.lds index bdc7380a54..7e7ab1acfd 100644 --- a/firmware/target/arm/s3c2440/app.lds +++ b/firmware/target/arm/s3c2440/app.lds @@ -35,7 +35,7 @@ SECTIONS .vectors DRAMORIG : { _vectorstart = .; - *(.vectors*); + KEEP(*(.vectors*)); *(.init.text) . = ALIGN(0x4); } > DRAM diff --git a/firmware/target/arm/s3c2440/boot.lds b/firmware/target/arm/s3c2440/boot.lds index 13b6344afb..302fedda33 100644 --- a/firmware/target/arm/s3c2440/boot.lds +++ b/firmware/target/arm/s3c2440/boot.lds @@ -23,7 +23,7 @@ SECTIONS .vectors DRAMORIG : { _vectorstart = .; - *(.vectors*); + KEEP(*(.vectors*)); *(.init.text) . = ALIGN(0x4); } > DRAM diff --git a/firmware/target/arm/samsung/app.lds b/firmware/target/arm/samsung/app.lds index a98f33dd9f..013a05e411 100644 --- a/firmware/target/arm/samsung/app.lds +++ b/firmware/target/arm/samsung/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/sandisk/app.lds b/firmware/target/arm/sandisk/app.lds index 57e1d4f256..49322fbf97 100644 --- a/firmware/target/arm/sandisk/app.lds +++ b/firmware/target/arm/sandisk/app.lds @@ -81,7 +81,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/tatung/app.lds b/firmware/target/arm/tatung/app.lds index a00d5f1f2e..336322b4ea 100644 --- a/firmware/target/arm/tatung/app.lds +++ b/firmware/target/arm/tatung/app.lds @@ -84,7 +84,7 @@ SECTIONS .vectors 0x0 : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } AT> DRAM diff --git a/firmware/target/arm/tcc780x/app.lds b/firmware/target/arm/tcc780x/app.lds index e56c7f5cb7..4bd0f9921b 100644 --- a/firmware/target/arm/tcc780x/app.lds +++ b/firmware/target/arm/tcc780x/app.lds @@ -69,7 +69,7 @@ SECTIONS .vectors ITCMORIG : { _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } > ITCM AT> DRAM diff --git a/firmware/target/arm/tms320dm320/app.lds b/firmware/target/arm/tms320dm320/app.lds index a3dadb64ed..6ceb512d21 100644 --- a/firmware/target/arm/tms320dm320/app.lds +++ b/firmware/target/arm/tms320dm320/app.lds @@ -77,7 +77,7 @@ SECTIONS { . = ALIGN(0x4); _vectorsstart = .; - *(.vectors); + KEEP(*(.vectors)); _vectorsend = .; } > ITCM AT> DRAM diff --git a/firmware/target/mips/ingenic_jz47xx/app.lds b/firmware/target/mips/ingenic_jz47xx/app.lds index 6221a787c9..a8ac6ff0bf 100644 --- a/firmware/target/mips/ingenic_jz47xx/app.lds +++ b/firmware/target/mips/ingenic_jz47xx/app.lds @@ -55,14 +55,14 @@ SECTIONS .iram IRAMORIG: AT (_edata) { _iramstart = .; - *(.vectors.1); + KEEP(*(.vectors.1)); . = 0x100; - *(.vectors.2); + KEEP(*(.vectors.2)); . = 0x180; - *(.vectors.3); + KEEP(*(.vectors.3)); . = 0x200; - *(.vectors.4); - *(.vectors); + KEEP(*(.vectors.4)); + KEEP(*(.vectors)); *(.icode); *(.irodata); diff --git a/firmware/target/mips/ingenic_jz47xx/boot.lds b/firmware/target/mips/ingenic_jz47xx/boot.lds index a236a3f40a..c207fcbac3 100644 --- a/firmware/target/mips/ingenic_jz47xx/boot.lds +++ b/firmware/target/mips/ingenic_jz47xx/boot.lds @@ -49,14 +49,14 @@ SECTIONS .iram IRAMORIG: { _iramstart = .; - *(.vectors.1); + KEEP(*(.vectors.1)); . = 0x100; - *(.vectors.2); + KEEP(*(.vectors.2)); . = 0x180; - *(.vectors.3); + KEEP(*(.vectors.3)); . = 0x200; - *(.vectors.4); - *(.vectors); + KEEP(*(.vectors.4)); + KEEP(*(.vectors)); *(.icode); *(.irodata); diff --git a/firmware/test/i2c/app.lds b/firmware/test/i2c/app.lds index 192ee1d2a4..b8a341a8ae 100644 --- a/firmware/test/i2c/app.lds +++ b/firmware/test/i2c/app.lds @@ -4,7 +4,7 @@ SECTIONS { .text 0x09010000 : { - *(.vectors) + KEEP(*(.vectors)) . = ALIGN(0x200); *(.init.text) } diff --git a/firmware/test/kernel/app.lds b/firmware/test/kernel/app.lds index 192ee1d2a4..b8a341a8ae 100644 --- a/firmware/test/kernel/app.lds +++ b/firmware/test/kernel/app.lds @@ -4,7 +4,7 @@ SECTIONS { .text 0x09010000 : { - *(.vectors) + KEEP(*(.vectors)) . = ALIGN(0x200); *(.init.text) } diff --git a/flash/bootloader/no_rom.lds b/flash/bootloader/no_rom.lds index 796fbda4fb..9f6af52aef 100644 --- a/flash/bootloader/no_rom.lds +++ b/flash/bootloader/no_rom.lds @@ -13,7 +13,7 @@ SECTIONS { .vectors : { - *(.vectors) + KEEP(*(.vectors)) . = ALIGN(0x200); } > FLASH