• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Alex Gerchanovsky - 2007-05-17
Last edited by Magnus Holmgren - 2007-06-05

FS#7183 - ARM-GCC 4.11 compiler error in thread.c

I use ARM-GCC 4.1.1 from
By the way, it generates slightly smaller code.
It only have problem with start_thread declaration. To fix this error we have to remove static declaration of this function.

Closed by  Magnus Holmgren
2007-06-05 19:28
Reason for closing:  Accepted
Dave Chapman commented on 2007-05-18 06:54

What problem does gcc 4.1.1 have with declaring start_thread as static? Do you know if this is a deliberate change in behaviour by gcc or a bug?

Alex Gerchanovsky commented on 2007-05-18 07:13

Error message is:
/cygdrive/c/rockbox/build-device/librockbox.a(thread.o): In function `create_thread':
thread.c:(.text+0x95c): undefined reference to `start_thread'

I guess this may be caused by call from inline assembler in function 'load_context'?
static inline void load_context(const void* addr)

  asm volatile(
      "ldmia  %0, { r4-r11, sp, lr } \\n" /* load regs r4 to r14 from context */
      "ldr    r0, [%0, #40]          \\n" /* load start pointer */
      "cmp    r0, #0                 \\n" /* check for NULL */
      "movne  r1, %0                 \\n" /* if not already running, jump to start */
      "ldrne  pc, =start_thread      \\n" 
      : : "r" (addr) : "r0", "r1"


Michael Sevakis commented on 2007-05-18 09:30

Probably discards the "unreferenced" (by C code) static function as an "optimization" then tries to link it. Sounds buggy to me and obviously doesn't trip up arm-elf-gcc 4.0.3. :

Magnus Holmgren commented on 2007-05-28 16:35

Not sure if it is a bug; similar things can be seen in other places with newer versions of GCC. A better fix would be to add "attribute 1)" to start_thread. (While at it, one could also add "attribute 2)" to stuff that shouldn't be inlined.)

1) used
2) noinline
Alex Gerchanovsky commented on 2007-05-29 19:15

Here is patch with attribute 1).

1) used


Available keyboard shortcuts


Task Details

Task Editing