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
diff --git a/firmware/decompressor/link.lds b/firmware/decompressor/link.lds
index a33993d..51c0460 100644
--- a/firmware/decompressor/link.lds
+++ b/firmware/decompressor/link.lds
@@ -17,7 +17,7 @@
     {
         _loadaddress = .;
         _dramend = . + DRAMSIZE;
-        *(.vectors)
+        KEEP(*(.vectors))
         . = ALIGN(0x200);
     } > DRAM
 
diff --git a/firmware/rom.lds b/firmware/rom.lds
index a56beea..dadd2ab 100644
--- a/firmware/rom.lds
+++ b/firmware/rom.lds
@@ -81,8 +81,8 @@
         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 c638511..2497e09 100644
--- a/firmware/target/arm/at91sam/boot.lds
+++ b/firmware/target/arm/at91sam/boot.lds
@@ -29,7 +29,7 @@
     .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 ac91ffd..efa1d35 100644
--- a/firmware/target/arm/imx31/app.lds
+++ b/firmware/target/arm/imx31/app.lds
@@ -89,7 +89,7 @@
     .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 9c7eb16..f0773e0 100644
--- a/firmware/target/arm/ipod/app.lds
+++ b/firmware/target/arm/ipod/app.lds
@@ -84,7 +84,7 @@
     .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 a98f33d..013a05e 100644
--- a/firmware/target/arm/iriver/app.lds
+++ b/firmware/target/arm/iriver/app.lds
@@ -84,7 +84,7 @@
     .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 a98f33d..013a05e 100644
--- a/firmware/target/arm/olympus/app.lds
+++ b/firmware/target/arm/olympus/app.lds
@@ -84,7 +84,7 @@
     .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 a98f33d..013a05e 100644
--- a/firmware/target/arm/pbell/app.lds
+++ b/firmware/target/arm/pbell/app.lds
@@ -84,7 +84,7 @@
     .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 a98f33d..013a05e 100644
--- a/firmware/target/arm/philips/app.lds
+++ b/firmware/target/arm/philips/app.lds
@@ -84,7 +84,7 @@
     .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 3b7b73c..f14ef90 100644
--- a/firmware/target/arm/pnx0101/app.lds
+++ b/firmware/target/arm/pnx0101/app.lds
@@ -73,7 +73,7 @@
     .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 bdc7380..7e7ab1a 100644
--- a/firmware/target/arm/s3c2440/app.lds
+++ b/firmware/target/arm/s3c2440/app.lds
@@ -35,7 +35,7 @@
     .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 13b6344..302fedd 100644
--- a/firmware/target/arm/s3c2440/boot.lds
+++ b/firmware/target/arm/s3c2440/boot.lds
@@ -23,7 +23,7 @@
     .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 a98f33d..013a05e 100644
--- a/firmware/target/arm/samsung/app.lds
+++ b/firmware/target/arm/samsung/app.lds
@@ -84,7 +84,7 @@
     .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 57e1d4f..49322fb 100644
--- a/firmware/target/arm/sandisk/app.lds
+++ b/firmware/target/arm/sandisk/app.lds
@@ -81,7 +81,7 @@
     .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 a00d5f1..336322b 100644
--- a/firmware/target/arm/tatung/app.lds
+++ b/firmware/target/arm/tatung/app.lds
@@ -84,7 +84,7 @@
     .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 e56c7f5..4bd0f99 100644
--- a/firmware/target/arm/tcc780x/app.lds
+++ b/firmware/target/arm/tcc780x/app.lds
@@ -69,7 +69,7 @@
     .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 a3dadb6..6ceb512 100644
--- a/firmware/target/arm/tms320dm320/app.lds
+++ b/firmware/target/arm/tms320dm320/app.lds
@@ -77,7 +77,7 @@
     {
         . = 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 6221a78..a8ac6ff 100644
--- a/firmware/target/mips/ingenic_jz47xx/app.lds
+++ b/firmware/target/mips/ingenic_jz47xx/app.lds
@@ -55,14 +55,14 @@
     .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 a236a3f..c207fcb 100644
--- a/firmware/target/mips/ingenic_jz47xx/boot.lds
+++ b/firmware/target/mips/ingenic_jz47xx/boot.lds
@@ -49,14 +49,14 @@
     .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 192ee1d..b8a341a 100644
--- a/firmware/test/i2c/app.lds
+++ b/firmware/test/i2c/app.lds
@@ -4,7 +4,7 @@
 {
     .text 0x09010000 :
     {
-	*(.vectors)
+	KEEP(*(.vectors))
         . = ALIGN(0x200);
         *(.init.text)
     }
diff --git a/firmware/test/kernel/app.lds b/firmware/test/kernel/app.lds
index 192ee1d..b8a341a 100644
--- a/firmware/test/kernel/app.lds
+++ b/firmware/test/kernel/app.lds
@@ -4,7 +4,7 @@
 {
     .text 0x09010000 :
     {
-	*(.vectors)
+	KEEP(*(.vectors))
         . = ALIGN(0x200);
         *(.init.text)
     }
diff --git a/flash/bootloader/no_rom.lds b/flash/bootloader/no_rom.lds
index 796fbda..9f6af52 100644
--- a/flash/bootloader/no_rom.lds
+++ b/flash/bootloader/no_rom.lds
@@ -13,7 +13,7 @@
 {
 	.vectors :
 	{
-		*(.vectors)
+		KEEP(*(.vectors))
 		. = ALIGN(0x200);
 	} > FLASH