[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [PATCH v2 40/47] arm64: add the link file



This patch adds the link file for arm64.

This patch is based on Chen Baozi's patch:
   "arm64: Add the support for arm64"

Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 Makefile                          | 14 ++++++-
 arch/arm/arm64/minios-arm64.lds.S | 81 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/arm64/minios-arm64.lds.S

diff --git a/Makefile b/Makefile
index 43075e1..ad320e3 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ include minios.mk
 LDLIBS := 
 APP_LDLIBS := 
 LDARCHLIB := -L$(OBJ_DIR)/$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
-LDFLAGS_FINAL := -T 
$(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds 
$(ARCH_LDFLAGS_FINAL)
+LDFLAGS_FINAL := -T $(ARCH_LDFLAGS_FINAL)
 
 # Prefix for global API names. All other symbols are localised before
 # linking with EXTRA_OBJS.
@@ -160,11 +160,21 @@ ifneq ($(APP_OBJS),)
 APP_O=$(OBJ_DIR)/$(TARGET)_app.o 
 endif
 
+ifeq ($(MINIOS_TARGET_ARCH),arm64)
+LINK_FILE=$(OBJ_DIR)/$(TARGET_ARCH_DIR)/arm64/minios-$(MINIOS_TARGET_ARCH).lds
+else
+LINK_FILE=$(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
+endif
+LDFLAGS_FINAL += $(LINK_FILE)
+
 # Special rule for x86 for now
 $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
        $(CPP) $(ASFLAGS) -P $< -o $@
 
-$(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib 
$(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
+$(OBJ_DIR)/arch/arm/arm64/minios-$(MINIOS_TARGET_ARCH).lds:  
arch/arm/arm64/minios-$(MINIOS_TARGET_ARCH).lds.S
+       $(CPP) $(ASFLAGS) -I $(OBJ_DIR)/include/arm/ -P $< -o $@
+
+$(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(LINK_FILE)
        $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) 
-o $@.o
        $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
        $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
diff --git a/arch/arm/arm64/minios-arm64.lds.S 
b/arch/arm/arm64/minios-arm64.lds.S
new file mode 100644
index 0000000..bcb4cb5
--- /dev/null
+++ b/arch/arm/arm64/minios-arm64.lds.S
@@ -0,0 +1,81 @@
+#include <page_def.h>
+#include <arm64/pagetable.h>
+
+OUTPUT_FORMAT("elf64-littleaarch64")
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+  /*
+   * Please see section D4.2.6, the following start address is equal to
+   *          2 ^ 64 - 2 ^ (64 - T1SZ)
+   */
+  . = (1 << VA_BITS) * ((1 << (64 - VA_BITS)) - 1);
+  _text = .;                   /* Text and read-only data */
+  .text : {
+       *(.text)
+       *(.gnu.warning)
+  }
+
+  _etext = .;                  /* End of text section */
+
+  .rodata : { *(.rodata) *(.rodata.*) }
+  . = ALIGN(PAGE_SIZE);
+  _erodata = .;
+
+  /* newlib initialization functions */
+  . = ALIGN(8);
+  PROVIDE (__preinit_array_start = .);
+  .preinit_array     : { *(.preinit_array) }
+  PROVIDE (__preinit_array_end = .);
+  PROVIDE (__init_array_start = .);
+  .init_array     : { *(.init_array) }
+  PROVIDE (__init_array_end = .);
+  PROVIDE (__fini_array_start = .);
+  .fini_array     : { *(.fini_array) }
+  PROVIDE (__fini_array_end = .);
+
+  .ctors : {
+        __CTOR_LIST__ = .;
+        *(.ctors)
+       CONSTRUCTORS
+        QUAD(0)
+        __CTOR_END__ = .;
+  }
+
+  .dtors : {
+        __DTOR_LIST__ = .;
+        *(.dtors)
+        QUAD(0)
+        __DTOR_END__ = .;
+  }
+
+  .data : {                    /* Data */
+       *(.data)
+  }
+
+  _edata = .;                  /* End of data section */
+
+  __bss_start = .;             /* BSS */
+  .bss : {
+       *(.bss)
+        *(.app.bss)
+  }
+  _end = . ;
+
+  /* Sections to be discarded */
+  /DISCARD/ : {
+       *(.text.exit)
+       *(.data.exit)
+       *(.exitcall.exit)
+  }
+
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+}
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.