summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2013-09-05 22:03:10 +0800
committerPeng Fan <van.freenix@gmail.com>2013-09-05 22:03:10 +0800
commit0048c847b0ae5df3f06e52bb8cb8f58196ca33ca (patch)
treeb5e761d32be00acb616e2e206b02b9f82ae26c55
parent633c0e0d23c4b874c71595a4d9d13b8d4acdf417 (diff)
Fix warnings
-rw-r--r--libbsd/include/link_elf.h31
-rw-r--r--rtl-debugger.c5
-rw-r--r--rtl-elf.c1
-rw-r--r--rtl-elf.h7
-rw-r--r--rtl-rap.c9
-rw-r--r--testcase/1.c2
-rw-r--r--testcase/2.c7
-rw-r--r--testcase/3.c3
-rw-r--r--testcase/3.h5
-rw-r--r--testcase/33.c2
-rw-r--r--testcase/333.c2
-rw-r--r--testcase/4.c3
-rw-r--r--testcase/i.h7
13 files changed, 71 insertions, 13 deletions
diff --git a/libbsd/include/link_elf.h b/libbsd/include/link_elf.h
index 6419561..0e32d7f 100644
--- a/libbsd/include/link_elf.h
+++ b/libbsd/include/link_elf.h
@@ -11,6 +11,7 @@
#include <machine/elf_machdep.h>
#include <stdint.h>
+#include <rtl-obj-fwd.h>
enum sections
{
@@ -28,14 +29,17 @@ enum sections
*/
typedef struct
{
- char* name;
- uint32_t offset;
- uint32_t size;
- uint32_t rap_id;
+ const char* name; /**< Section name. */
+ uint32_t offset; /**< The offset in the elf file. */
+ uint32_t size; /**< The size of the section. */
+ uint32_t rap_id; /**< Which obj does this section belongs to. */
}section_detail;
+/**
+ * link map structure will be used for GDB support.
+ */
struct link_map {
- char* name; /**< Name of the obj. */
+ const char* name; /**< Name of the obj. */
uint32_t sec_num; /**< The count of section. */
section_detail* sec_detail; /**< The section details. */
uint32_t* sec_addr[rap_secs]; /**< The RAP section addr. */
@@ -45,6 +49,9 @@ struct link_map {
struct link_map* l_prev;
};
+/**
+ * r_debug is used to manage the debug related structures.
+ */
struct r_debug {
int r_version; /* not used */
struct link_map *r_map; /* list of loaded images */
@@ -55,4 +62,18 @@ struct r_debug {
} r_state;
};
+/*
+ * stub function. It is empty.
+ */
+void _rtld_debug_state (void);
+
+/*
+ * add link map to the list.
+ */
+int _rtld_linkmap_add (rtems_rtl_obj_t* obj);
+
+/*
+ * Remove link map from the list.
+ */
+void _rtld_linkmap_delete (rtems_rtl_obj_t* obj);
#endif /* _LINK_ELF_H_ */
diff --git a/rtl-debugger.c b/rtl-debugger.c
index 531b268..711e429 100644
--- a/rtl-debugger.c
+++ b/rtl-debugger.c
@@ -26,6 +26,7 @@
#include "config.h"
#endif
+#include <stdio.h>
#include <link.h>
#include <rtl.h>
#include <rtl-trace.h>
@@ -63,13 +64,15 @@ _rtld_linkmap_add (rtems_rtl_obj_t* obj)
if (_rtld_debug.r_map == NULL)
{
_rtld_debug.r_map = l;
- return;
+ return true;
}
for (prev = _rtld_debug.r_map; prev->l_next != NULL; prev = prev->l_next);
l->l_prev = prev;
prev->l_next = l;
+
+ return true;
}
void
diff --git a/rtl-elf.c b/rtl-elf.c
index 35ae898..14e2460 100644
--- a/rtl-elf.c
+++ b/rtl-elf.c
@@ -698,7 +698,6 @@ bool rtems_rtl_elf_load_details (rtems_rtl_obj_t* obj)
{
rtems_chain_control* sections = NULL;
rtems_chain_node* node = NULL;
- size_t base_offset = 0;
bool first = true;
size_t mask = 0;
struct link_map* l = NULL;
diff --git a/rtl-elf.h b/rtl-elf.h
index 24bb5ba..dd3e14a 100644
--- a/rtl-elf.h
+++ b/rtl-elf.h
@@ -137,6 +137,13 @@ bool rtems_rtl_elf_find_symbol (rtems_rtl_obj_t* obj,
bool rtems_rtl_elf_file_check (rtems_rtl_obj_t* obj, int fd);
/**
+ * The ELF file details handler.
+ *
+ * @param obj Load the details of the obj.
+ */
+bool rtems_rtl_elf_load_details (rtems_rtl_obj_t* obj);
+
+/**
* The ELF format load handler.
*
* @param obj The object to load.
diff --git a/rtl-rap.c b/rtl-rap.c
index 2bfaead..be11fe9 100644
--- a/rtl-rap.c
+++ b/rtl-rap.c
@@ -440,7 +440,7 @@ rtems_rtl_rap_load_details (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj)
section_detail* tmp2;
uint32_t obj_detail_size;
uint32_t pos = 0;
- uint32_t i,j;
+ int i,j;
obj_detail_size = sizeof (struct link_map) * obj->obj_num;
@@ -515,8 +515,8 @@ rtems_rtl_rap_load_details (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj)
{
if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL))
{
- printf ("File %u: %s\n", i, ((struct link_map*)obj->detail + i)->name);
- printf ("Section: %u sections\n", obj->sec_num[i]);
+ printf ("File %d: %s\n", i, ((struct link_map*) obj->detail + i)->name);
+ printf ("Section: %d sections\n",(unsigned int) obj->sec_num[i]);
}
((struct link_map*)obj->detail + i)->sec_detail = tmp2;
@@ -548,7 +548,8 @@ rtems_rtl_rap_load_details (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj)
if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL))
{
printf ("name:%16s offset:0x%08x rap_id:%d size:0x%x\n",
- tmp2->name, tmp2->offset, tmp2->rap_id, tmp2->size);
+ tmp2->name, (unsigned int) tmp2->offset,
+ (unsigned int) tmp2->rap_id, (unsigned int) tmp2->size);
}
tmp2 += 1;
diff --git a/testcase/1.c b/testcase/1.c
index f3ba414..83c16b5 100644
--- a/testcase/1.c
+++ b/testcase/1.c
@@ -1,3 +1,5 @@
+#include "i.h"
+
int global;
static char local;
diff --git a/testcase/2.c b/testcase/2.c
index 84efea1..812f033 100644
--- a/testcase/2.c
+++ b/testcase/2.c
@@ -1,3 +1,5 @@
+#include "i.h"
+
extern int global;
extern void hello(int);
@@ -10,6 +12,8 @@ void tst_pc16(void)
#endif
#if defined (__sparc__)
+void tst_wdisp(void);
+
void tst_wdisp(void)
{
printf("R_SPARC_DISP22: pass\n");
@@ -22,9 +26,12 @@ int test(int argc, char **argv)
global = 1; //inter-module data access
printf("In test() global = %d\n", global);
hello(2); //inter-module call
+
+ return 0;
}
int my_main(int argc, char **argv)
{
exit(0);
+ return 0;
}
diff --git a/testcase/3.c b/testcase/3.c
index 4e63c1b..0903300 100644
--- a/testcase/3.c
+++ b/testcase/3.c
@@ -1,4 +1,5 @@
-#include <stdio.h>
+#include "3.h"
+
int ar_func_test(void)
{
printf ("ar_func_test\n");
diff --git a/testcase/3.h b/testcase/3.h
new file mode 100644
index 0000000..612d30a
--- /dev/null
+++ b/testcase/3.h
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+int ar_func_test(void);
+int t1(void);
+int t2(void);
diff --git a/testcase/33.c b/testcase/33.c
index dfc08f8..c6132f5 100644
--- a/testcase/33.c
+++ b/testcase/33.c
@@ -1,3 +1,5 @@
+#include "3.h"
+
int t1(void)
{
return 1;
diff --git a/testcase/333.c b/testcase/333.c
index 0c810fc..da87a59 100644
--- a/testcase/333.c
+++ b/testcase/333.c
@@ -1,3 +1,5 @@
+#include "3.h"
+
int t2(void)
{
return 2;
diff --git a/testcase/4.c b/testcase/4.c
index f038c0b..8ddb376 100644
--- a/testcase/4.c
+++ b/testcase/4.c
@@ -1,4 +1,5 @@
-#include <stdio.h>
+#include "3.h"
+
int rtems(int argc, char **argv)
{
int a;
diff --git a/testcase/i.h b/testcase/i.h
new file mode 100644
index 0000000..4ce5b43
--- /dev/null
+++ b/testcase/i.h
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+void hello(int arg);
+int rtems(int argc, char** argv);
+int test(int argc, char **argv);
+int my_main(int argc, char **argv);