summaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-26 02:42:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-26 02:42:39 +0000
commit6cafdad8d539bbfbe2a516e46fe41549b8a6b68a (patch)
tree0ffd14523bd45197f366cb232d8f05f3d91f5c35 /nuttx/binfmt
parentb9732fc877642a6cddde87f3440a6589675f10de (diff)
downloadpx4-nuttx-6cafdad8d539bbfbe2a516e46fe41549b8a6b68a.tar.gz
px4-nuttx-6cafdad8d539bbfbe2a516e46fe41549b8a6b68a.tar.bz2
px4-nuttx-6cafdad8d539bbfbe2a516e46fe41549b8a6b68a.zip
Rename elf.h to elf32.h; Additional ELF loader changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5263 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/elf.c2
-rw-r--r--nuttx/binfmt/libelf/gnu-elf.ld138
-rw-r--r--nuttx/binfmt/libelf/libelf.h2
-rw-r--r--nuttx/binfmt/libelf/libelf_bind.c2
-rw-r--r--nuttx/binfmt/libelf/libelf_init.c2
-rw-r--r--nuttx/binfmt/libelf/libelf_load.c2
-rw-r--r--nuttx/binfmt/libelf/libelf_read.c2
-rw-r--r--nuttx/binfmt/libelf/libelf_symbols.c2
8 files changed, 46 insertions, 106 deletions
diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c
index d9c3d0b9c..9a0ac1873 100644
--- a/nuttx/binfmt/elf.c
+++ b/nuttx/binfmt/elf.c
@@ -42,7 +42,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
-#include <elf.h>
+#include <elf32.h>
#include <debug.h>
#include <errno.h>
diff --git a/nuttx/binfmt/libelf/gnu-elf.ld b/nuttx/binfmt/libelf/gnu-elf.ld
index 703f36981..bdf82836b 100644
--- a/nuttx/binfmt/libelf/gnu-elf.ld
+++ b/nuttx/binfmt/libelf/gnu-elf.ld
@@ -1,7 +1,7 @@
/****************************************************************************
- * examples/elf/gnu-elf-gotoff.ld
+ * examples/elf/gnu-elf.ld
*
- * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -33,44 +33,11 @@
*
****************************************************************************/
-MEMORY
-{
- ISPACE : ORIGIN = 0x0, LENGTH = 2097152
- DSPACE : ORIGIN = 0x0, LENGTH = 2097152
-}
-
-/****************************************************************************
- * The XFLAT program image is divided into two segments:
- *
- * (1) ISpace (Instruction Space). This is the segment that contains
- * code (.text). Everything in the segment should be fetch-able
- * machine PC instructions (jump, branch, call, etc.).
- * (2) DSpace (Data Space). This is the segment that contains both
- * read-write data (.data, .bss) as well as read-only data (.rodata).
- * Everything in this segment should be access-able with machine
- * PIC load and store instructions.
- *
- * Older versions of GCC (at least up to GCC 4.3.3), use GOT-relative
- * addressing to access RO data. In that case, read-only data (.rodata) must
- * reside in D-Space and this linker script should be used.
- *
- * Newer versions of GCC (at least as of GCC 4.6.3), use PC-relative
- * addressing to access RO data. In that case, read-only data (.rodata) must
- * reside in I-Space and this linker script should NOT be used with those
- * newer tools.
- *
- ****************************************************************************/
-
SECTIONS
{
.text 0x00000000 :
{
- /* ISpace is located at address 0. Every (unrelocated) ISpace
- * address is an offset from the begining of this segment.
- */
-
- text_start = . ;
-
+ _stext = . ;
*(.text)
*(.text.*)
*(.gnu.warning)
@@ -79,99 +46,72 @@ SECTIONS
*(.glue_7t)
*(.jcr)
- /* C++ support: The .init and .fini sections contain XFLAT-
- * specific logic to manage static constructors and destructors.
+ /* C++ support: The .init and .fini sections contain specific logic
+ * to manage static constructors and destructors.
*/
*(.gnu.linkonce.t.*)
*(.init)
*(.fini)
-
- /* This is special code area at the end of the normal
- text section. It contains a small lookup table at
- the start followed by the code pointed to by entries
- in the lookup table. */
-
- . = ALIGN (4) ;
- PROVIDE(__ctbp = .);
- *(.call_table_data)
- *(.call_table_text)
-
_etext = . ;
+ }
- } > ISPACE
-
- /* DSpace is also located at address 0. Every (unrelocated) DSpace
- * address is an offset from the begining of this segment.
- */
-
- .data 0x00000000 :
+ .rodata :
{
- /* In this model, .rodata is access using PC-relative addressing
- * and, hence, must also reside in the .text section.
- */
-
- __data_start = . ;
+ _srodata = . ;
*(.rodata)
*(.rodata1)
*(.rodata.*)
*(.gnu.linkonce.r*)
+ _erodata = . ;
+ }
+ .data :
+ {
+ _sdata = . ;
*(.data)
*(.data1)
*(.data.*)
*(.gnu.linkonce.d*)
- *(.data1)
- *(.eh_frame)
- *(.gcc_except_table)
-
- *(.gnu.linkonce.s.*)
- *(__libc_atexit)
- *(__libc_subinit)
- *(__libc_subfreeres)
- *(.note.ABI-tag)
-
- /* C++ support. For each global and static local C++ object,
- * GCC creates a small subroutine to construct the object. Pointers
- * to these routines (not the routines themselves) are stored as
- * simple, linear arrays in the .ctors section of the object file.
- * Similarly, pointers to global/static destructor routines are
- * stored in .dtors.
- */
+ _edata = . ;
+ }
- *(.gnu.linkonce.d.*)
+ /* C++ support. For each global and static local C++ object,
+ * GCC creates a small subroutine to construct the object. Pointers
+ * to these routines (not the routines themselves) are stored as
+ * simple, linear arrays in the .ctors section of the object file.
+ * Similarly, pointers to global/static destructor routines are
+ * stored in .dtors.
+ */
- _ctors_start = . ;
+ .ctors :
+ {
+ _sctros = . ;
*(.ctors)
- _ctors_end = . ;
- _dtors_start = . ;
- *(.dtors)
- _dtors_end = . ;
+ _edtors = . ;
+ }
- _edata = . ;
- edata = ALIGN( 0x10 ) ;
- } > DSPACE
+ .ctors :
+ {
+ _sdtors = . ;
+ *(.dtors)
+ _edtors = . ;
+ }
.bss :
{
- __bss_start = _edata ;
- *(.dynsbss)
- *(.sbss)
- *(.sbss.*)
- *(.scommon)
- *(.dynbss)
+ _sbss = . ;
*(.bss)
*(.bss.*)
- *(.bss*)
+ *(.sbss)
+ *(.sbss.*)
*(.gnu.linkonce.b*)
*(COMMON)
- end = ALIGN( 0x10 ) ;
- _end = ALIGN( 0x10 ) ;
- } > DSPACE
+ _ebss = . ;
+ }
- .got 0 : { *(.got.plt) *(.got) }
- .junk 0 : { *(.rel*) *(.rela*) }
/* Stabs debugging sections. */
+
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
diff --git a/nuttx/binfmt/libelf/libelf.h b/nuttx/binfmt/libelf/libelf.h
index 37a2ad872..0fb1362dc 100644
--- a/nuttx/binfmt/libelf/libelf.h
+++ b/nuttx/binfmt/libelf/libelf.h
@@ -43,7 +43,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
-#include <elf.h>
+#include <elf32.h>
#include <nuttx/binfmt/elf.h>
diff --git a/nuttx/binfmt/libelf/libelf_bind.c b/nuttx/binfmt/libelf/libelf_bind.c
index e398521cc..f41b5a0b6 100644
--- a/nuttx/binfmt/libelf/libelf_bind.c
+++ b/nuttx/binfmt/libelf/libelf_bind.c
@@ -41,7 +41,7 @@
#include <stdint.h>
#include <string.h>
-#include <elf.h>
+#include <elf32.h>
#include <errno.h>
#include <assert.h>
#include <debug.h>
diff --git a/nuttx/binfmt/libelf/libelf_init.c b/nuttx/binfmt/libelf/libelf_init.c
index a3a320b16..f2744eae7 100644
--- a/nuttx/binfmt/libelf/libelf_init.c
+++ b/nuttx/binfmt/libelf/libelf_init.c
@@ -43,7 +43,7 @@
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
-#include <elf.h>
+#include <elf32.h>
#include <debug.h>
#include <errno.h>
diff --git a/nuttx/binfmt/libelf/libelf_load.c b/nuttx/binfmt/libelf/libelf_load.c
index 4a1a561c3..9378661e3 100644
--- a/nuttx/binfmt/libelf/libelf_load.c
+++ b/nuttx/binfmt/libelf/libelf_load.c
@@ -45,7 +45,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
-#include <elf.h>
+#include <elf32.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
diff --git a/nuttx/binfmt/libelf/libelf_read.c b/nuttx/binfmt/libelf/libelf_read.c
index 0b01cf096..da41212f2 100644
--- a/nuttx/binfmt/libelf/libelf_read.c
+++ b/nuttx/binfmt/libelf/libelf_read.c
@@ -43,7 +43,7 @@
#include <stdint.h>
#include <unistd.h>
#include <string.h>
-#include <elf.h>
+#include <elf32.h>
#include <debug.h>
#include <errno.h>
diff --git a/nuttx/binfmt/libelf/libelf_symbols.c b/nuttx/binfmt/libelf/libelf_symbols.c
index 05f827963..123f9f77f 100644
--- a/nuttx/binfmt/libelf/libelf_symbols.c
+++ b/nuttx/binfmt/libelf/libelf_symbols.c
@@ -41,7 +41,7 @@
#include <stdlib.h>
#include <string.h>
-#include <elf.h>
+#include <elf32.h>
#include <errno.h>
#include <debug.h>