Rockbox

  • Status Closed
  • Percent Complete
    100%
  • 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 shoora - 2007-05-17
Last edited by learman - 2007-06-05

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

I use ARM-GCC 4.1.1 from http://www.gnuarm.org/.
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  learman
2007-06-05 19:28
Reason for closing:  Accepted

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?

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"
  );

}

MikeS 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. :

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

Here is patch with attribute 1).

1) used

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing