]> xenbits.xensource.com Git - xtf.git/commitdiff
link: Move the linker script to being common
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 4 Jan 2023 23:19:26 +0000 (23:19 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Jan 2023 01:03:19 +0000 (01:03 +0000)
... now that all x86-ism have been removed.  Fix some style bugs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/link.lds.S [deleted file]
build/common.mk
common/link.lds.S [new file with mode: 0644]

diff --git a/arch/x86/link.lds.S b/arch/x86/link.lds.S
deleted file mode 100644 (file)
index 3a0907d..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Common linker file for all architectures/environments
- */
-
-#include <xtf/numbers.h>
-#include <arch/page.h>
-
-/*
- * Architecture must provide:
- *   - OUTPUT_FORMAT()
- *   - OUTPUT_ARCH()
- *   - ENTRY()
- */
-#define LINKER_HEADER
-#include <arch/link.lds.h>
-#undef LINKER_HEADER
-
-PHDRS
-{
-        text PT_LOAD FLAGS(7); /* RWE */
-        note PT_NOTE FLAGS(4); /* R   */
-}
-
-SECTIONS
-{
-        . = XTF_VIRT_START;
-
-        _start = .;
-
-        .text : {
-                *(.text.head)
-                *(.text)
-
-       . = ALIGN(PAGE_SIZE);
-        __start_user_text = .;
-                *(.text.user)
-       . = ALIGN(PAGE_SIZE);
-        __end_user_text = .;
-
-        } :text = 0
-
-        .data : {
-                *(.data)
-        . = ALIGN(PAGE_SIZE);
-                *(.data.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-
-        __start_user_data = .;
-                *(.data.user)
-       . = ALIGN(PAGE_SIZE);
-        __end_user_data = .;
-
-        }
-
-        .note : {
-                *(.note)
-                *(.note.*)
-        } :note :text
-
-        .rodata : {
-                *(.rodata)
-                *(.rodata.*)
-
-        . = ALIGN(8);
-        __start_ex_table = .;
-                *(.ex_table)
-        __stop_ex_table = .;
-        } :text
-
-        .bss : {
-                *(.bss)
-        . = ALIGN(PAGE_SIZE);
-                *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-
-        __start_user_bss = .;
-                *(.bss.user.page_aligned)
-       . = ALIGN(PAGE_SIZE);
-        __end_user_bss = .;
-        }
-
-        _end = .;
-}
-
-/*
- * Linker games to use virtual addresses at 0 without triggering NULL pointer
- * "logic" and associated compiler optimisations.
- */
-zeroptr = 0;
-
-ASSERT(IS_ALIGNED(__start_user_text, PAGE_SIZE), "__start_user_text misaligned");
-ASSERT(IS_ALIGNED(__end_user_text,   PAGE_SIZE), "__end_user_text misaligned");
-ASSERT(IS_ALIGNED(__start_user_data, PAGE_SIZE), "__start_user_data misaligned");
-ASSERT(IS_ALIGNED(__end_user_data,   PAGE_SIZE), "__end_user_data misaligned")
-ASSERT(IS_ALIGNED(__start_user_bss,  PAGE_SIZE), "__start_user_data misaligned");
-ASSERT(IS_ALIGNED(__end_user_bss,    PAGE_SIZE), "__end_user_data misaligned")
-
-/* Architecture may provide any extra asserts. */
-#define LINKER_FOOTER
-#include <arch/link.lds.h>
-#undef LINKER_FOOTER
-
-/*
- * Local variables:
- * tab-width: 8
- * indent-tabs-mode: nil
- * End:
- */
index 42d4c77dd6807dfc712dd2ec0b9b763119c743a1..644961c03fa835cd48e8709a7cfd08480f3e1684 100644 (file)
@@ -72,8 +72,8 @@ DEPS-$(1) = \
        $$(obj-$(1):%.o=%-$(1).o) $$(obj-perenv:%.o=%-$(1).o)
 
 # Generate .lds with appropriate flags
-%/link-$(1).lds: %/link.lds.S
-       $$(CPP) $$(AFLAGS_$(1)) -P -C $$< -o $$@
+%/link-$(1).lds: $(ROOT)/common/link.lds.S
+       $$(CPP) $$(AFLAGS_$(1)) -P $$< -o $$@
 
 # Generate a per-arch .o from .S
 %-$($(1)_arch).o: %.S
diff --git a/common/link.lds.S b/common/link.lds.S
new file mode 100644 (file)
index 0000000..f5836b6
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Common linker file for all architectures/environments
+ */
+
+#include <xtf/numbers.h>
+#include <arch/page.h>
+
+/*
+ * Architecture must provide:
+ *   - OUTPUT_FORMAT()
+ *   - OUTPUT_ARCH()
+ *   - ENTRY()
+ */
+#define LINKER_HEADER
+#include <arch/link.lds.h>
+#undef LINKER_HEADER
+
+PHDRS
+{
+        text PT_LOAD FLAGS(7); /* RWE */
+        note PT_NOTE FLAGS(4); /* R   */
+}
+
+SECTIONS
+{
+        . = XTF_VIRT_START;
+
+        _start = .;
+
+        .text : {
+                *(.text.head)
+                *(.text)
+
+        . = ALIGN(PAGE_SIZE);
+        __start_user_text = .;
+                *(.text.user)
+        . = ALIGN(PAGE_SIZE);
+        __end_user_text = .;
+
+        } :text = 0
+
+        .data : {
+                *(.data)
+        . = ALIGN(PAGE_SIZE);
+                *(.data.page_aligned)
+        . = ALIGN(PAGE_SIZE);
+
+        __start_user_data = .;
+                *(.data.user)
+        . = ALIGN(PAGE_SIZE);
+        __end_user_data = .;
+
+        }
+
+        .note : {
+                *(.note)
+                *(.note.*)
+        } :note :text
+
+        .rodata : {
+                *(.rodata)
+                *(.rodata.*)
+
+        . = ALIGN(8);
+        __start_ex_table = .;
+                *(.ex_table)
+        __stop_ex_table = .;
+        } :text
+
+        .bss : {
+                *(.bss)
+        . = ALIGN(PAGE_SIZE);
+                *(.bss.page_aligned)
+        . = ALIGN(PAGE_SIZE);
+
+        __start_user_bss = .;
+                *(.bss.user.page_aligned)
+        . = ALIGN(PAGE_SIZE);
+        __end_user_bss = .;
+        }
+
+        _end = .;
+}
+
+/*
+ * Linker games to use virtual addresses at 0 without triggering NULL pointer
+ * "logic" and associated compiler optimisations.
+ */
+zeroptr = 0;
+
+ASSERT(IS_ALIGNED(__start_user_text, PAGE_SIZE), "__start_user_text misaligned");
+ASSERT(IS_ALIGNED(__end_user_text,   PAGE_SIZE), "__end_user_text misaligned");
+ASSERT(IS_ALIGNED(__start_user_data, PAGE_SIZE), "__start_user_data misaligned");
+ASSERT(IS_ALIGNED(__end_user_data,   PAGE_SIZE), "__end_user_data misaligned");
+ASSERT(IS_ALIGNED(__start_user_bss,  PAGE_SIZE), "__start_user_data misaligned");
+ASSERT(IS_ALIGNED(__end_user_bss,    PAGE_SIZE), "__end_user_data misaligned");
+
+/* Architecture may provide any extra asserts. */
+#define LINKER_FOOTER
+#include <arch/link.lds.h>
+#undef LINKER_FOOTER
+
+/*
+ * Local variables:
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ */