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
This commit is contained in:
Boris Gjenero 2012-10-22 21:30:01 +02:00 committed by Marcin Bukat
parent 8ad8473d81
commit c975de1534
10 changed files with 30 additions and 18 deletions

View file

@ -974,9 +974,9 @@ struct plugin_header {
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 USED_ATTR; \
const struct plugin_header __header \
__attribute__ ((section (".header")))= { \
__attribute__ ((section (".header"))) USED_ATTR = { \
{ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
plugin_start_addr, plugin_end_addr }, plugin__start, &rb };
#else /* PLATFORM_HOSTED */

View file

@ -29,22 +29,22 @@ void __attribute__((naked)) __div0(void)
}
#endif
void *memcpy(void *dest, const void *src, size_t n)
void USED_ATTR *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 USED_ATTR *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 USED_ATTR *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 USED_ATTR memcmp(const void *s1, const void *s2, size_t n)
{
return rb->memcmp(s1, s2, n);
}

View file

@ -30,6 +30,7 @@ static void USED_ATTR __start_thread(void)
{
/* 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 */

View file

@ -59,7 +59,7 @@ static void adc_tick(void)
ADCSR = ADCSR_ADST | ADCSR_ADIE | ADCSR_SCAN | 3;
}
void ADITI(void) __attribute__((interrupt_handler));
void ADITI(void) __attribute__((interrupt_handler)) USED_ATTR;
void ADITI(void)
{
if(ADCSR & ADCSR_ADF)

View file

@ -153,7 +153,7 @@ static void play_tick(void)
}
}
void DEI3(void) __attribute__((interrupt_handler));
void DEI3(void) __attribute__((interrupt_handler)) USED_ATTR;
void DEI3(void)
{
const void* start;
@ -177,7 +177,7 @@ void DEI3(void)
CHCR3 &= ~0x0002; /* Clear DMA interrupt */
}
void IMIA1(void) __attribute__((interrupt_handler));
void IMIA1(void) __attribute__((interrupt_handler)) USED_ATTR;
void IMIA1(void) /* Timer 1 interrupt */
{
if(playing)
@ -189,14 +189,14 @@ void IMIA1(void) /* Timer 1 interrupt */
#endif
}
void IRQ6(void) __attribute__((interrupt_handler));
void IRQ6(void) __attribute__((interrupt_handler)) USED_ATTR;
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_ATTR;
void IRQ3(void) /* PA15: MAS demand IRQ */
{
/* Begin with setting the IRQ to edge sensitive */

View file

@ -23,7 +23,7 @@
#include "system.h"
#include "timer.h"
void IMIA4(void) __attribute__((interrupt_handler));
void IMIA4(void) __attribute__((interrupt_handler)) USED_ATTR;
void IMIA4(void)
{
if (pfn_timer != NULL)

View file

@ -55,7 +55,7 @@ void tick_start(unsigned int interval_in_ms)
TSTR |= 0x01; /* Start timer 1 */
}
void IMIA0(void) __attribute__ ((interrupt_handler));
void IMIA0(void) __attribute__ ((interrupt_handler)) USED_ATTR;
void IMIA0(void)
{
/* Run through the list of tick tasks */

View file

@ -180,6 +180,7 @@ asm (
* 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,17 @@ asm (
"_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_ATTR;
void _UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
{
unsigned int n;

6
tools/configure vendored
View file

@ -3707,6 +3707,12 @@ if test "$CC" = "sh-elf-gcc"; then
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

View file

@ -361,8 +361,8 @@ do
# default rule for Objective C. Disable the builtin make rules. See
# http://sourceware.org/ml/binutils/2005-12/msg00259.html
export MAKEFLAGS="-r $MAKEFLAGS"
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.22" "" "--disable-werror"
build "gcc" "sh-elf" "4.6.3" "" "" "gmp mpfr mpc"
;;
[Ii])