Commit c33fe444 authored by Chen Gang's avatar Chen Gang Committed by Jesper Nilsson

cris: arch-v10: kgdb: Add '__used' for static variable is_dyn_brkp

Within one C file, current gcc can optimize the global static variables
according to the C code, but it will skip assembly code -- it will pass
them to gas directly.

if the static variable is used between C code and assembly code in one C
file (e.g. is_dyn_brkp in kgdb.c), it needs '__used' to let gcc know it
should be still used, or gcc may remove it for optimization.

The related error in this case:

    LD      init/built-in.o
  arch/cris/arch-v10/kernel/built-in.o: In function `kgdb_handle_breakpoint':
  (.text+0x2aca): undefined reference to `is_dyn_brkp'
  arch/cris/arch-v10/kernel/built-in.o: In function `is_static':
  kgdb.c:(.text+0x2ada): undefined reference to `is_dyn_brkp'
Signed-off-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: default avatarJesper Nilsson <jespern@axis.com>
parent 8f40dceb
...@@ -352,7 +352,7 @@ char internal_stack[INTERNAL_STACK_SIZE]; ...@@ -352,7 +352,7 @@ char internal_stack[INTERNAL_STACK_SIZE];
breakpoint to be handled. A static breakpoint uses the content of register breakpoint to be handled. A static breakpoint uses the content of register
BRP as it is whereas a dynamic breakpoint requires subtraction with 2 BRP as it is whereas a dynamic breakpoint requires subtraction with 2
in order to execute the instruction. The first breakpoint is static. */ in order to execute the instruction. The first breakpoint is static. */
static unsigned char is_dyn_brkp = 0; static unsigned char __used is_dyn_brkp;
/********************************* String library ****************************/ /********************************* String library ****************************/
/* Single-step over library functions creates trap loops. */ /* Single-step over library functions creates trap loops. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment