build: Various LTO fixes

* Give arm panicf_f() USED_ATTR
 * Ensure start_thread() has USED_ATTR

Change-Id: I6a833be7fbe25410c21e0df233fcae91e451bf00
This commit is contained in:
Solomon Peachy 2024-11-24 08:36:07 -05:00
parent bdf1690cb2
commit 0624e265ab
4 changed files with 5 additions and 5 deletions

View file

@ -25,7 +25,7 @@
* Start the thread running and terminate it if it returns * Start the thread running and terminate it if it returns
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
void start_thread(void); /* Provide C access to ASM label */ void start_thread(void) USED_ATTR; /* Provide C access to ASM label */
static void USED_ATTR __start_thread(void) static void USED_ATTR __start_thread(void)
{ {
/* a0=macsr, a1=context */ /* a0=macsr, a1=context */

View file

@ -26,7 +26,7 @@
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
void start_thread(void); /* Provide C access to ASM label */ void start_thread(void) USED_ATTR; /* Provide C access to ASM label */
static void USED_ATTR _start_thread(void) static void USED_ATTR _start_thread(void)
{ {
/* t1 = context */ /* t1 = context */

View file

@ -49,7 +49,7 @@ $(BUILDDIR)/sysfont.o: $(SYSFONTX) $(BUILDDIR)/sysfont.h
ifdef USE_LTO ifdef USE_LTO
$(BUILDDIR)/firmware/asm/%.o: CFLAGS += -fno-lto $(BUILDDIR)/firmware/asm/%.o: CFLAGS += -fno-lto
$(BUILDDIR)/firmware/kernel/%.o: CFLAGS += -fno-lto $(BUILDDIR)/firmware/kernel/thread.o: CFLAGS += -fno-lto
endif endif
# GNU make (at least) has a bug/feature that exported variable are not available # GNU make (at least) has a bug/feature that exported variable are not available

View file

@ -47,7 +47,7 @@ static char panic_buf[128];
#define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) - 2 #define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) - 2
#if defined(CPU_ARM) && defined(HAVE_RB_BACKTRACE) #if defined(CPU_ARM) && defined(HAVE_RB_BACKTRACE)
void panicf_f( const char *fmt, ...); void panicf_f( const char *fmt, ...) USED_ATTR;
/* we wrap panicf() here with naked function to catch SP value */ /* we wrap panicf() here with naked function to catch SP value */
void __attribute__((naked)) panicf( const char *fmt, ...) void __attribute__((naked)) panicf( const char *fmt, ...)
@ -60,7 +60,7 @@ void __attribute__((naked)) panicf( const char *fmt, ...)
} }
/* /*
* "Dude. This is pretty fucked-up, right here." * "Dude. This is pretty fucked-up, right here."
*/ */
void panicf_f( const char *fmt, ...) void panicf_f( const char *fmt, ...)
{ {