RTL arm load failed

2014-11-02 Thread Peng Fan
Hi,

qemu-system-arm -no-reboot -net none -nographic -M realview-pbx-a9 -m 256M
-kernel `find . -name dl01.exe` -s -S

*** BEGIN OF TEST libdl (RTL) Loader 1 ***
load: /dl-o1.o
rtl: unsupported section: 15: type=1879048195 flags=00
handle: 0x212b10 has unresolved externals

dl-o1.o can not be correctly loaded, because of unresolved symbols.
I do some debug using remote gdb and found it is the reloc entry references
local symbols named "LCx" saying "LC0", "LC1", "LC2".

Freenix@linux-jyl1:~/per/new/build-arm> arm-rtems4.11-readelf -s `find .
-name dl-o1.o`

Symbol table '.symtab' contains 22 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 FILELOCAL  DEFAULT  ABS dl-o1.c
 2:  0 SECTION LOCAL  DEFAULT1
 3:  0 SECTION LOCAL  DEFAULT3
 4:  0 SECTION LOCAL  DEFAULT4
 5:  0 SECTION LOCAL  DEFAULT5
 6:  0 NOTYPE  LOCAL  DEFAULT5 $d
* 7:  0 NOTYPE  LOCAL  DEFAULT5 .LC0*
* 8: 0020 0 NOTYPE  LOCAL  DEFAULT5 .LC1*
* 9: 0068 0 NOTYPE  LOCAL  DEFAULT5 .LC2*
10:  0 NOTYPE  LOCAL  DEFAULT1 $t
11:  0 SECTION LOCAL  DEFAULT6
12:  0 SECTION LOCAL  DEFAULT8
13:  0 SECTION LOCAL  DEFAULT9
14:  0 SECTION LOCAL  DEFAULT   11
15:  0 SECTION LOCAL  DEFAULT   13
16: 0010 0 NOTYPE  LOCAL  DEFAULT   16 $d
17:  0 SECTION LOCAL  DEFAULT   16
18:  0 SECTION LOCAL  DEFAULT   14
19:  0 SECTION LOCAL  DEFAULT   15
20: 000188 FUNCGLOBAL DEFAULT1 rtems_main
21:  0 NOTYPE  GLOBAL DEFAULT  UND printf

The LCx symbols's type is NOTYPE and not included in the rtl symbol
table(local symbol may should not be included). In rtl-elf.c, line 387 see
following, the LCx symbols are not included, so fails. I prefer that if
unresolved symbols detected in rtl, detailed info should be print out, but
i found no debug msg about this.

384 /*

385  * Only keep the functions and global or weak symbols.

386  */

387 if ((ELF_ST_TYPE (symbol.st_info) == STT_OBJECT) ||

388 (ELF_ST_TYPE (symbol.st_info) == STT_FUNC))

I think this cause arm load failed. FYI, rap file are not included in the
dl test?

Regards,
Peng.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: RTL arm load failed

2014-11-02 Thread Chris Johns

On 2/11/2014 8:28 pm, Peng Fan wrote:


qemu-system-arm -no-reboot -net none -nographic -M realview-pbx-a9 -m
256M -kernel `find . -name dl01.exe` -s -S

*** BEGIN OF TEST libdl (RTL) Loader 1 ***
load: /dl-o1.o
rtl: unsupported section: 15: type=1879048195 flags=00
handle: 0x212b10 has unresolved externals



Thanks for the testing.


dl-o1.o can not be correctly loaded, because of unresolved symbols.
I do some debug using remote gdb and found it is the reloc entry
references local symbols named "LCx" saying "LC0", "LC1", "LC2".

Freenix@linux-jyl1:~/per/new/build-arm> arm-rtems4.11-readelf -s `find .
-name dl-o1.o`

Symbol table '.symtab' contains 22 entries:
Num:Value  Size TypeBind   Vis  Ndx Name
  0:  0 NOTYPE  LOCAL  DEFAULT  UND
  1:  0 FILELOCAL  DEFAULT  ABS dl-o1.c
  2:  0 SECTION LOCAL  DEFAULT1
  3:  0 SECTION LOCAL  DEFAULT3
  4:  0 SECTION LOCAL  DEFAULT4
  5:  0 SECTION LOCAL  DEFAULT5
  6:  0 NOTYPE  LOCAL  DEFAULT5 $d
* 7:  0 NOTYPE  LOCAL  DEFAULT5 .LC0*
* 8: 0020 0 NOTYPE  LOCAL  DEFAULT5 .LC1*
* 9: 0068 0 NOTYPE  LOCAL  DEFAULT5 .LC2*
 10:  0 NOTYPE  LOCAL  DEFAULT1 $t
 11:  0 SECTION LOCAL  DEFAULT6
 12:  0 SECTION LOCAL  DEFAULT8
 13:  0 SECTION LOCAL  DEFAULT9
 14:  0 SECTION LOCAL  DEFAULT   11
 15:  0 SECTION LOCAL  DEFAULT   13
 16: 0010 0 NOTYPE  LOCAL  DEFAULT   16 $d
 17:  0 SECTION LOCAL  DEFAULT   16
 18:  0 SECTION LOCAL  DEFAULT   14
 19:  0 SECTION LOCAL  DEFAULT   15
 20: 000188 FUNCGLOBAL DEFAULT1 rtems_main
 21:  0 NOTYPE  GLOBAL DEFAULT  UND printf

The LCx symbols's type is NOTYPE and not included in the rtl symbol
table(local symbol may should not be included). In rtl-elf.c, line 387
see following, the LCx symbols are not included, so fails. I prefer that
if unresolved symbols detected in rtl, detailed info should be print
out, but i found no debug msg about this.


Unresolved symbols may not be an error. If you have 2 files dependent on 
each other one will be loaded with unresolved externals until the other 
is loaded. The loader handles this and when the second dependent module 
is loaded the unresolved symbols are resolved. This means the loader is 
not in a position to have a clear enough picture to decide if there are 
unresolved symbols. The application loading must decide when to check, 
check and raise an error when it thinks there should be no errors.




384 /*
385  * Only keep the functions and global or weak symbols.
386  */
387 if ((ELF_ST_TYPE (symbol.st_info) == STT_OBJECT) ||
388 (ELF_ST_TYPE (symbol.st_info) == STT_FUNC))

I think this cause arm load failed.


Interesting. Nothing has changed here as ELF should always have these 
symbols. It must be this test does something our testing before did not 
highlight.


I also suspect we will have issues with the RAP files. Let me explain. 
The code that was in my personal repo placed all global and local 
symbols into a single 'externals' symbol table. This worked because we 
had the awk hack to create the base image symbol table that used nm and 
nm only provided the global symbols. When I came to do the rtems-syms 
tool that takes a base kernel image and creates an exported symbols 
table I incorrectly ended up with the local symbols of the kernel in the 
symbol table and embedding that symbol table in the base image via the 
double link pass method failed on the second link. As a result I cleaned 
up the symbol code to have the rld::symbols classes load symbols into 
separate global, weak and local table. I suspect the RAP code is now 
only referencing the global table and so local symbols are not being 
included in the symbol table. I need to review this code.



FYI, rap file are not included in the dl test?


This is coming as I have time. It is needed.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] libbsp ARM: create abort.h to eliminate warnings Created libbsp/arm/shared/abort/abort.h Edited abort.c and simple_abort.c to include abort.h Changed Raspberry Pi BSP to use abort.c instead of

2014-11-02 Thread Alan Cudmore
Signed-off-by: Alan Cudmore 
---
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am |  2 +-
 c/src/lib/libbsp/arm/shared/abort/abort.c| 28 +---
 c/src/lib/libbsp/arm/shared/abort/abort.h| 57 
 c/src/lib/libbsp/arm/shared/abort/simple_abort.c | 22 +
 4 files changed, 60 insertions(+), 49 deletions(-)
 create mode 100644 c/src/lib/libbsp/arm/shared/abort/abort.h

diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am 
b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index 839c8de..a606d9d 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -86,7 +86,7 @@ libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
 libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
 libbsp_a_SOURCES += ../../shared/sbrk.c
 libbsp_a_SOURCES += ../../shared/src/stackalloc.c
-libbsp_a_SOURCES += ../shared/abort/simple_abort.c
+libbsp_a_SOURCES += ../shared/abort/abort.c
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
 libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
 
diff --git a/c/src/lib/libbsp/arm/shared/abort/abort.c 
b/c/src/lib/libbsp/arm/shared/abort/abort.c
index d509a2a..8dc70d7 100644
--- a/c/src/lib/libbsp/arm/shared/abort/abort.c
+++ b/c/src/lib/libbsp/arm/shared/abort/abort.c
@@ -24,33 +24,7 @@
 #include 
 #include 
 
-#define INSN_MASK 0xc5
-
-#define INSN_STM1 0x80
-#define INSN_STM2 0x84
-#define INSN_STR  0x40
-#define INSN_STRB 0x44
-
-#define INSN_LDM1 0x81
-#define INSN_LDM230x85
-#define INSN_LDR  0x41
-#define INSN_LDRB 0x45
-
-#define GET_RD(x) ((x & 0xf000) >> 12)
-#define GET_RN(x) ((x & 0x000f) >> 16)
-
-#define GET_U(x)  ((x & 0x0080) >> 23)
-#define GET_I(x)  ((x & 0x0200) >> 25)
-
-#define GET_REG(r, ctx)  (((uint32_t   *)ctx)[r])
-#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
-#define GET_OFFSET(insn) (insn & 0xfff)
-
-/*
- * Prototypes
- */
-void _print_full_context(uint32_t);
-void do_data_abort(uint32_t, uint32_t, Context_Control *);
+#include "abort.h"
 
 uint32_t g_data_abort_cnt = 0;
 /*this is a big overhead for MCU only got 16K RAM*/
diff --git a/c/src/lib/libbsp/arm/shared/abort/abort.h 
b/c/src/lib/libbsp/arm/shared/abort/abort.h
new file mode 100644
index 000..14feac3
--- /dev/null
+++ b/c/src/lib/libbsp/arm/shared/abort/abort.h
@@ -0,0 +1,57 @@
+/**
+ *  @file
+ *
+ *  @ingroup arm_abort
+ *
+ *  @brief ARM abort support
+ */
+
+/*
+ *  COPYRIGHT (c) 2007 Ray Xu.
+ *  mailto: Rayx at gmail dot com
+ *
+ *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
+ *  Emmanuel Raguet, mailto:rag...@crf.canon.fr
+ *
+ *  Copyright (c) 2002 Advent Networks, Inc
+ *  Jay Monkman 
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ *
+ */
+
+#ifndef _BSPABORT_H
+#define _BSPABORT_H
+
+#define INSN_MASK 0xc5
+
+#define INSN_STM1 0x80
+#define INSN_STM2 0x84
+#define INSN_STR  0x40
+#define INSN_STRB 0x44
+
+#define INSN_LDM1 0x81
+#define INSN_LDM230x85
+#define INSN_LDR  0x41
+#define INSN_LDRB 0x45
+
+#define GET_RD(x) ((x & 0xf000) >> 12)
+#define GET_RN(x) ((x & 0x000f) >> 16)
+
+#define GET_U(x)  ((x & 0x0080) >> 23)
+#define GET_I(x)  ((x & 0x0200) >> 25)
+
+#define GET_REG(r, ctx)  (((uint32_t   *)ctx)[r])
+#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
+#define GET_OFFSET(insn) (insn & 0xfff)
+
+/*
+ * Prototypes
+ */
+void _print_full_context(uint32_t);
+void do_data_abort(uint32_t, uint32_t, Context_Control *);
+
+#endif  /* _BSPABORT_H_ */
+
diff --git a/c/src/lib/libbsp/arm/shared/abort/simple_abort.c 
b/c/src/lib/libbsp/arm/shared/abort/simple_abort.c
index 51854bd..57f9a02 100644
--- a/c/src/lib/libbsp/arm/shared/abort/simple_abort.c
+++ b/c/src/lib/libbsp/arm/shared/abort/simple_abort.c
@@ -21,27 +21,7 @@
 #include 
 #include 
 
-#define INSN_MASK 0xc5
-
-#define INSN_STM1 0x80
-#define INSN_STM2 0x84
-#define INSN_STR  0x40
-#define INSN_STRB 0x44
-
-#define INSN_LDM1 0x81
-#define INSN_LDM230x85
-#define INSN_LDR  0x41
-#define INSN_LDRB 0x45
-
-#define GET_RD(x) ((x & 0xf000) >> 12)
-#define GET_RN(x) ((x & 0x000f) >> 16)
-
-#define GET_U(x)  ((x & 0x0080) >> 23)
-#define GET_I(x)  ((x & 0x0200) >> 25)
-
-#define GET_REG(r, ctx)  (((uint32_t   *)ctx)[r])
-#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
-#define GET_OFFSET(insn) (insn & 0xfff)
+#include "abort.h"
 
 char *_print_full_context_mode2txt[0x10]={
   [0x0]="user",  /* User */
-- 
2.1.0

___
devel mailing l

Re: [PATCH] libbsp ARM: create abort.h to eliminate warnings Created libbsp/arm/shared/abort/abort.h Edited abort.c and simple_abort.c to include abort.h Changed Raspberry Pi BSP to use abort.c instea

2014-11-02 Thread Sebastian Huber

On 03/11/14 02:59, Alan Cudmore wrote:

-libbsp_a_SOURCES += ../shared/abort/simple_abort.c
+libbsp_a_SOURCES += ../shared/abort/abort.c


Since this BSP uses the shared start.S file, I would prefer to remove 
simple_abort.c and abort.c from the Makefile.am.  These files should go away in 
the long run.


The default abort handler is now in:

http://git.rtems.org/rtems/tree/cpukit/score/cpu/arm/armv4-exception-default.S

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel