Index: tools/rockboxdev.sh =================================================================== --- tools/rockboxdev.sh (revision 31177) +++ tools/rockboxdev.sh (working copy) @@ -276,8 +276,8 @@ echo "" case $arch in [Ss]) - build "binutils" "sh-elf" "2.16.1" "" "--disable-werror" - build "gcc" "sh-elf" "4.0.3" "gcc-4.0.3-rockbox-1.diff" + build "binutils" "sh-elf" "2.21.1" "" "--disable-werror" + build "gcc" "sh-elf" "4.6.2" "gcc-4.6.2-rockbox-preliminary-1.diff" ;; [Ii]) Index: tools/configure =================================================================== --- tools/configure (revision 31177) +++ tools/configure (working copy) @@ -3553,6 +3553,11 @@ echo "WARNING: You use an unpatched gcc compiler: $gccver" echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler" fi + + if test "$gccnum" -ge "406"; then + echo "Enabling link-time optimization" + GCCOPTS="$GCCOPTS -flto" + fi fi fi Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 31177) +++ apps/plugin.h (working copy) @@ -963,9 +963,9 @@ extern unsigned char plugin_start_addr[]; extern unsigned char plugin_end_addr[]; #define PLUGIN_HEADER \ - const struct plugin_api *rb DATA_ATTR; \ + const struct plugin_api *rb DATA_ATTR __attribute__ ((used)); \ const struct plugin_header __header \ - __attribute__ ((section (".header")))= { \ + __attribute__ ((section (".header"), used))= { \ { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ plugin_start_addr, plugin_end_addr }, plugin__start, &rb }; #else /* PLATFORM_HOSTED */ Index: apps/plugins/lib/gcc-support.c =================================================================== --- apps/plugins/lib/gcc-support.c (revision 31177) +++ apps/plugins/lib/gcc-support.c (working copy) @@ -29,22 +29,22 @@ } #endif -void *memcpy(void *dest, const void *src, size_t n) +void __attribute__((used)) *memcpy(void *dest, const void *src, size_t n) { return rb->memcpy(dest, src, n); } -void *memset(void *dest, int c, size_t n) +void __attribute__((used)) *memset(void *dest, int c, size_t n) { return rb->memset(dest, c, n); } -void *memmove(void *dest, const void *src, size_t n) +void __attribute__((used)) *memmove(void *dest, const void *src, size_t n) { return rb->memmove(dest, src, n); } -int memcmp(const void *s1, const void *s2, size_t n) +int __attribute__((used)) memcmp(const void *s1, const void *s2, size_t n) { return rb->memcmp(s1, s2, n); } Index: firmware/target/sh/archos/timer-archos.c =================================================================== --- firmware/target/sh/archos/timer-archos.c (revision 31177) +++ firmware/target/sh/archos/timer-archos.c (working copy) @@ -23,7 +23,7 @@ #include "system.h" #include "timer.h" -void IMIA4(void) __attribute__((interrupt_handler)); +void IMIA4(void) __attribute__((interrupt_handler, used)); void IMIA4(void) { if (pfn_timer != NULL) Index: firmware/target/sh/archos/audio-archos.c =================================================================== --- firmware/target/sh/archos/audio-archos.c (revision 31177) +++ firmware/target/sh/archos/audio-archos.c (working copy) @@ -153,7 +153,7 @@ } } -void DEI3(void) __attribute__((interrupt_handler)); +void DEI3(void) __attribute__((interrupt_handler, used)); void DEI3(void) { unsigned char* start; @@ -177,7 +177,7 @@ CHCR3 &= ~0x0002; /* Clear DMA interrupt */ } -void IMIA1(void) __attribute__((interrupt_handler)); +void IMIA1(void) __attribute__((interrupt_handler, used)); void IMIA1(void) /* Timer 1 interrupt */ { if(playing) @@ -189,14 +189,14 @@ #endif } -void IRQ6(void) __attribute__((interrupt_handler)); +void IRQ6(void) __attribute__((interrupt_handler, used)); void IRQ6(void) /* PB14: MAS stop demand IRQ */ { SCR0 &= ~0x80; } #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) -void IRQ3(void) __attribute__((interrupt_handler)); +void IRQ3(void) __attribute__((interrupt_handler, used)); void IRQ3(void) /* PA15: MAS demand IRQ */ { /* Begin with setting the IRQ to edge sensitive */ Index: firmware/target/sh/adc-sh.c =================================================================== --- firmware/target/sh/adc-sh.c (revision 31177) +++ firmware/target/sh/adc-sh.c (working copy) @@ -59,7 +59,7 @@ ADCSR = ADCSR_ADST | ADCSR_ADIE | ADCSR_SCAN | 3; } -void ADITI(void) __attribute__((interrupt_handler)); +void ADITI(void) __attribute__((interrupt_handler, used)); void ADITI(void) { if(ADCSR & ADCSR_ADF) Index: firmware/target/sh/thread-sh.c =================================================================== --- firmware/target/sh/thread-sh.c (revision 31177) +++ firmware/target/sh/thread-sh.c (working copy) @@ -30,6 +30,7 @@ { /* r8 = context */ asm volatile ( + ".global _start_thread \n" "_start_thread: \n" /* Start here - no naked attribute */ "mov.l @(4, r8), r0 \n" /* Fetch thread function pointer */ "mov.l @(28, r8), r15 \n" /* Set initial sp */ Index: firmware/target/sh/kernel-sh.c =================================================================== --- firmware/target/sh/kernel-sh.c (revision 31177) +++ firmware/target/sh/kernel-sh.c (working copy) @@ -55,7 +55,7 @@ TSTR |= 0x01; /* Start timer 1 */ } -void IMIA0(void) __attribute__ ((interrupt_handler)); +void IMIA0(void) __attribute__ ((interrupt_handler, used)); void IMIA0(void) { /* Run through the list of tick tasks */ Index: firmware/target/sh/system-sh.c =================================================================== --- firmware/target/sh/system-sh.c (revision 31177) +++ firmware/target/sh/system-sh.c (working copy) @@ -180,6 +180,7 @@ * Must go into the same section as the UIE() handler */ "\t.text\n" + ".global\t_UIE4\n" "_UIE4:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" "_UIE5:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" "_UIE6:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" @@ -286,13 +287,18 @@ "_UIE107:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" "_UIE108:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" "_UIE109:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" + "_UIE:\tmov.l\t__UIE_k,r0\n" + "jmp\t@r0\n" + "nop\n" + ".align\t4\n" + "__UIE_k:\t.long\t__UIE\n" ); extern void UIE4(void); /* needed for calculating the UIE number */ -void UIE (unsigned int pc) __attribute__((section(".text"))); -void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ +void _UIE (unsigned int pc) __attribute__((section(".text"), used)); +void _UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ { unsigned int n;