diff options
author | Boris Gjenero <dreamlayers@rockbox.org> | 2012-10-22 21:30:01 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2012-10-24 14:02:41 +0200 |
commit | c975de1534f4b4092ad75f85353eec32a9a31b92 (patch) | |
tree | 611c581d6ce81b6575f8b20ec8cd795e85ccb298 | |
parent | 8ad8473d814c4ce4db62d35759939f1fae146361 (diff) | |
download | rockbox-c975de1534f4b4092ad75f85353eec32a9a31b92.tar.gz rockbox-c975de1534f4b4092ad75f85353eec32a9a31b92.zip |
SH gcc 4.6.3 with link-time optimization, for Archos targets
This is work from FS#12431 synced to current HEAD and slightly
tweaked (gcc 4.6.2 -> 4.6.3, binutils 2.21.1 -> 2.22)
Change-Id: I76af91e80ac2a9c16a776c7f0a33cc51603bbf9b
-rw-r--r-- | apps/plugin.h | 4 | ||||
-rw-r--r-- | apps/plugins/lib/gcc-support.c | 8 | ||||
-rw-r--r-- | firmware/asm/sh/thread.c | 1 | ||||
-rw-r--r-- | firmware/target/sh/adc-sh.c | 2 | ||||
-rw-r--r-- | firmware/target/sh/archos/audio-archos.c | 8 | ||||
-rw-r--r-- | firmware/target/sh/archos/timer-archos.c | 2 | ||||
-rw-r--r-- | firmware/target/sh/kernel-sh.c | 2 | ||||
-rw-r--r-- | firmware/target/sh/system-sh.c | 11 | ||||
-rwxr-xr-x | tools/configure | 6 | ||||
-rwxr-xr-x | tools/rockboxdev.sh | 4 |
10 files changed, 30 insertions, 18 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index bb2778164b..ad726d61bf 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -974,9 +974,9 @@ struct plugin_header { | |||
974 | extern unsigned char plugin_start_addr[]; | 974 | extern unsigned char plugin_start_addr[]; |
975 | extern unsigned char plugin_end_addr[]; | 975 | extern unsigned char plugin_end_addr[]; |
976 | #define PLUGIN_HEADER \ | 976 | #define PLUGIN_HEADER \ |
977 | const struct plugin_api *rb DATA_ATTR; \ | 977 | const struct plugin_api *rb DATA_ATTR USED_ATTR; \ |
978 | const struct plugin_header __header \ | 978 | const struct plugin_header __header \ |
979 | __attribute__ ((section (".header")))= { \ | 979 | __attribute__ ((section (".header"))) USED_ATTR = { \ |
980 | { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | 980 | { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ |
981 | plugin_start_addr, plugin_end_addr }, plugin__start, &rb }; | 981 | plugin_start_addr, plugin_end_addr }, plugin__start, &rb }; |
982 | #else /* PLATFORM_HOSTED */ | 982 | #else /* PLATFORM_HOSTED */ |
diff --git a/apps/plugins/lib/gcc-support.c b/apps/plugins/lib/gcc-support.c index 09a08fa9f5..156dbf93eb 100644 --- a/apps/plugins/lib/gcc-support.c +++ b/apps/plugins/lib/gcc-support.c | |||
@@ -29,22 +29,22 @@ void __attribute__((naked)) __div0(void) | |||
29 | } | 29 | } |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | void *memcpy(void *dest, const void *src, size_t n) | 32 | void USED_ATTR *memcpy(void *dest, const void *src, size_t n) |
33 | { | 33 | { |
34 | return rb->memcpy(dest, src, n); | 34 | return rb->memcpy(dest, src, n); |
35 | } | 35 | } |
36 | 36 | ||
37 | void *memset(void *dest, int c, size_t n) | 37 | void USED_ATTR *memset(void *dest, int c, size_t n) |
38 | { | 38 | { |
39 | return rb->memset(dest, c, n); | 39 | return rb->memset(dest, c, n); |
40 | } | 40 | } |
41 | 41 | ||
42 | void *memmove(void *dest, const void *src, size_t n) | 42 | void USED_ATTR *memmove(void *dest, const void *src, size_t n) |
43 | { | 43 | { |
44 | return rb->memmove(dest, src, n); | 44 | return rb->memmove(dest, src, n); |
45 | } | 45 | } |
46 | 46 | ||
47 | int memcmp(const void *s1, const void *s2, size_t n) | 47 | int USED_ATTR memcmp(const void *s1, const void *s2, size_t n) |
48 | { | 48 | { |
49 | return rb->memcmp(s1, s2, n); | 49 | return rb->memcmp(s1, s2, n); |
50 | } | 50 | } |
diff --git a/firmware/asm/sh/thread.c b/firmware/asm/sh/thread.c index e63470c4a1..c0e0ceb549 100644 --- a/firmware/asm/sh/thread.c +++ b/firmware/asm/sh/thread.c | |||
@@ -30,6 +30,7 @@ static void USED_ATTR __start_thread(void) | |||
30 | { | 30 | { |
31 | /* r8 = context */ | 31 | /* r8 = context */ |
32 | asm volatile ( | 32 | asm volatile ( |
33 | ".global _start_thread \n" | ||
33 | "_start_thread: \n" /* Start here - no naked attribute */ | 34 | "_start_thread: \n" /* Start here - no naked attribute */ |
34 | "mov.l @(4, r8), r0 \n" /* Fetch thread function pointer */ | 35 | "mov.l @(4, r8), r0 \n" /* Fetch thread function pointer */ |
35 | "mov.l @(28, r8), r15 \n" /* Set initial sp */ | 36 | "mov.l @(28, r8), r15 \n" /* Set initial sp */ |
diff --git a/firmware/target/sh/adc-sh.c b/firmware/target/sh/adc-sh.c index 2e6d6407b8..17f829ad97 100644 --- a/firmware/target/sh/adc-sh.c +++ b/firmware/target/sh/adc-sh.c | |||
@@ -59,7 +59,7 @@ static void adc_tick(void) | |||
59 | ADCSR = ADCSR_ADST | ADCSR_ADIE | ADCSR_SCAN | 3; | 59 | ADCSR = ADCSR_ADST | ADCSR_ADIE | ADCSR_SCAN | 3; |
60 | } | 60 | } |
61 | 61 | ||
62 | void ADITI(void) __attribute__((interrupt_handler)); | 62 | void ADITI(void) __attribute__((interrupt_handler)) USED_ATTR; |
63 | void ADITI(void) | 63 | void ADITI(void) |
64 | { | 64 | { |
65 | if(ADCSR & ADCSR_ADF) | 65 | if(ADCSR & ADCSR_ADF) |
diff --git a/firmware/target/sh/archos/audio-archos.c b/firmware/target/sh/archos/audio-archos.c index 2c2579bec5..207f26f250 100644 --- a/firmware/target/sh/archos/audio-archos.c +++ b/firmware/target/sh/archos/audio-archos.c | |||
@@ -153,7 +153,7 @@ static void play_tick(void) | |||
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | void DEI3(void) __attribute__((interrupt_handler)); | 156 | void DEI3(void) __attribute__((interrupt_handler)) USED_ATTR; |
157 | void DEI3(void) | 157 | void DEI3(void) |
158 | { | 158 | { |
159 | const void* start; | 159 | const void* start; |
@@ -177,7 +177,7 @@ void DEI3(void) | |||
177 | CHCR3 &= ~0x0002; /* Clear DMA interrupt */ | 177 | CHCR3 &= ~0x0002; /* Clear DMA interrupt */ |
178 | } | 178 | } |
179 | 179 | ||
180 | void IMIA1(void) __attribute__((interrupt_handler)); | 180 | void IMIA1(void) __attribute__((interrupt_handler)) USED_ATTR; |
181 | void IMIA1(void) /* Timer 1 interrupt */ | 181 | void IMIA1(void) /* Timer 1 interrupt */ |
182 | { | 182 | { |
183 | if(playing) | 183 | if(playing) |
@@ -189,14 +189,14 @@ void IMIA1(void) /* Timer 1 interrupt */ | |||
189 | #endif | 189 | #endif |
190 | } | 190 | } |
191 | 191 | ||
192 | void IRQ6(void) __attribute__((interrupt_handler)); | 192 | void IRQ6(void) __attribute__((interrupt_handler)) USED_ATTR; |
193 | void IRQ6(void) /* PB14: MAS stop demand IRQ */ | 193 | void IRQ6(void) /* PB14: MAS stop demand IRQ */ |
194 | { | 194 | { |
195 | SCR0 &= ~0x80; | 195 | SCR0 &= ~0x80; |
196 | } | 196 | } |
197 | 197 | ||
198 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | 198 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
199 | void IRQ3(void) __attribute__((interrupt_handler)); | 199 | void IRQ3(void) __attribute__((interrupt_handler)) USED_ATTR; |
200 | void IRQ3(void) /* PA15: MAS demand IRQ */ | 200 | void IRQ3(void) /* PA15: MAS demand IRQ */ |
201 | { | 201 | { |
202 | /* Begin with setting the IRQ to edge sensitive */ | 202 | /* Begin with setting the IRQ to edge sensitive */ |
diff --git a/firmware/target/sh/archos/timer-archos.c b/firmware/target/sh/archos/timer-archos.c index 98a3afb4b6..251d68638a 100644 --- a/firmware/target/sh/archos/timer-archos.c +++ b/firmware/target/sh/archos/timer-archos.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "timer.h" | 24 | #include "timer.h" |
25 | 25 | ||
26 | void IMIA4(void) __attribute__((interrupt_handler)); | 26 | void IMIA4(void) __attribute__((interrupt_handler)) USED_ATTR; |
27 | void IMIA4(void) | 27 | void IMIA4(void) |
28 | { | 28 | { |
29 | if (pfn_timer != NULL) | 29 | if (pfn_timer != NULL) |
diff --git a/firmware/target/sh/kernel-sh.c b/firmware/target/sh/kernel-sh.c index 65b27e47f0..d4cfaaa724 100644 --- a/firmware/target/sh/kernel-sh.c +++ b/firmware/target/sh/kernel-sh.c | |||
@@ -55,7 +55,7 @@ void tick_start(unsigned int interval_in_ms) | |||
55 | TSTR |= 0x01; /* Start timer 1 */ | 55 | TSTR |= 0x01; /* Start timer 1 */ |
56 | } | 56 | } |
57 | 57 | ||
58 | void IMIA0(void) __attribute__ ((interrupt_handler)); | 58 | void IMIA0(void) __attribute__ ((interrupt_handler)) USED_ATTR; |
59 | void IMIA0(void) | 59 | void IMIA0(void) |
60 | { | 60 | { |
61 | /* Run through the list of tick tasks */ | 61 | /* Run through the list of tick tasks */ |
diff --git a/firmware/target/sh/system-sh.c b/firmware/target/sh/system-sh.c index e054801b57..921d08f7b4 100644 --- a/firmware/target/sh/system-sh.c +++ b/firmware/target/sh/system-sh.c | |||
@@ -180,6 +180,7 @@ asm ( | |||
180 | * Must go into the same section as the UIE() handler */ | 180 | * Must go into the same section as the UIE() handler */ |
181 | 181 | ||
182 | "\t.text\n" | 182 | "\t.text\n" |
183 | ".global\t_UIE4\n" | ||
183 | "_UIE4:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | 184 | "_UIE4:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" |
184 | "_UIE5:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | 185 | "_UIE5:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" |
185 | "_UIE6:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | 186 | "_UIE6:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" |
@@ -286,13 +287,17 @@ asm ( | |||
286 | "_UIE107:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | 287 | "_UIE107:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" |
287 | "_UIE108:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | 288 | "_UIE108:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" |
288 | "_UIE109:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | 289 | "_UIE109:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" |
289 | 290 | "_UIE:\tmov.l\t__UIE_k,r0\n" | |
291 | "jmp\t@r0\n" | ||
292 | "nop\n" | ||
293 | ".align\t4\n" | ||
294 | "__UIE_k:\t.long\t__UIE\n" | ||
290 | ); | 295 | ); |
291 | 296 | ||
292 | extern void UIE4(void); /* needed for calculating the UIE number */ | 297 | extern void UIE4(void); /* needed for calculating the UIE number */ |
293 | 298 | ||
294 | void UIE (unsigned int pc) __attribute__((section(".text"))); | 299 | void _UIE (unsigned int pc) __attribute__((section(".text"))) USED_ATTR; |
295 | void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | 300 | void _UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ |
296 | { | 301 | { |
297 | unsigned int n; | 302 | unsigned int n; |
298 | 303 | ||
diff --git a/tools/configure b/tools/configure index 08d07b7797..4059a95a68 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -3707,6 +3707,12 @@ if test "$CC" = "sh-elf-gcc"; then | |||
3707 | echo "WARNING: You use an unpatched gcc compiler: $gccver" | 3707 | echo "WARNING: You use an unpatched gcc compiler: $gccver" |
3708 | echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler" | 3708 | echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler" |
3709 | fi | 3709 | fi |
3710 | |||
3711 | if test "$gccnum" -ge "406"; then | ||
3712 | echo "Enabling link-time optimization" | ||
3713 | GCCOPTS="$GCCOPTS -flto" | ||
3714 | fi | ||
3715 | |||
3710 | fi | 3716 | fi |
3711 | fi | 3717 | fi |
3712 | 3718 | ||
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh index 996aa86aea..78641b5b23 100755 --- a/tools/rockboxdev.sh +++ b/tools/rockboxdev.sh | |||
@@ -361,8 +361,8 @@ do | |||
361 | # default rule for Objective C. Disable the builtin make rules. See | 361 | # default rule for Objective C. Disable the builtin make rules. See |
362 | # http://sourceware.org/ml/binutils/2005-12/msg00259.html | 362 | # http://sourceware.org/ml/binutils/2005-12/msg00259.html |
363 | export MAKEFLAGS="-r $MAKEFLAGS" | 363 | export MAKEFLAGS="-r $MAKEFLAGS" |
364 | build "binutils" "sh-elf" "2.16.1" "" "--disable-werror" | 364 | build "binutils" "sh-elf" "2.22" "" "--disable-werror" |
365 | build "gcc" "sh-elf" "4.0.3" "gcc-4.0.3-rockbox-1.diff" | 365 | build "gcc" "sh-elf" "4.6.3" "" "" "gmp mpfr mpc" |
366 | ;; | 366 | ;; |
367 | 367 | ||
368 | [Ii]) | 368 | [Ii]) |