cmake: rename linker_final_pass.cmd to linker.cmd
Since linker_final_pass.cmd is the actual linker script being
used to link the final Zephyr binary, rename it to linker.cmd.
This also renames LINKER_PASS2 to LINKER_ZEPHYR_FINAL simply
to clarify what it is used for, instead of ambiguous pass #n.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bc29bd..6d46715 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1084,25 +1084,27 @@
# generation stage.
set(logical_target_for_zephyr_elf ${ZEPHYR_PREBUILT_EXECUTABLE})
else()
- # The second linker pass uses the same source linker script of the
- # first pass (LINKER_SCRIPT), but this time with a different output
- # file and preprocessed with the define LINKER_PASS2.
+ # The final linker pass uses the same source linker script of the
+ # previous passes, but this time with a different output
+ # file and preprocessed with the define LINKER_ZEPHYR_FINAL.
+ #
+ # LINKER_PASS2 is deprecated but being kept to avoid breaking
+ # external projects. It will be removed in the future.
configure_linker_script(
- linker_pass_final.cmd
- "-DLINKER_PASS2"
+ linker.cmd
+ "-DLINKER_ZEPHYR_FINAL;-DLINKER_PASS2"
${CODE_RELOCATION_DEP}
${ZEPHYR_PREBUILT_EXECUTABLE}
zephyr_generated_headers
)
- set(LINKER_PASS_FINAL_SCRIPT_TARGET linker_pass_final_script_target)
add_custom_target(
- ${LINKER_PASS_FINAL_SCRIPT_TARGET}
+ linker_zephyr_final_script_target
DEPENDS
- linker_pass_final.cmd
+ linker.cmd
)
set_property(TARGET
- ${LINKER_PASS_FINAL_SCRIPT_TARGET}
+ linker_zephyr_final_script_target
PROPERTY INCLUDE_DIRECTORIES
${ZEPHYR_INCLUDE_DIRS}
)
@@ -1112,15 +1114,15 @@
TARGET_ELF ${ZEPHYR_FINAL_EXECUTABLE}
OUTPUT_MAP ${PROJECT_BINARY_DIR}/${ZEPHYR_FINAL_EXECUTABLE}.map
LIBRARIES_PRE_SCRIPT ${GKOF}
- LINKER_SCRIPT ${PROJECT_BINARY_DIR}/linker_pass_final.cmd
+ LINKER_SCRIPT ${PROJECT_BINARY_DIR}/linker.cmd
LIBRARIES_POST_SCRIPT ""
DEPENDENCIES ${CODE_RELOCATION_DEP}
)
target_byproducts(TARGET ${ZEPHYR_FINAL_EXECUTABLE}
BYPRODUCTS ${PROJECT_BINARY_DIR}/${ZEPHYR_FINAL_EXECUTABLE}.map
)
- set_property(TARGET ${ZEPHYR_FINAL_EXECUTABLE} PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker_pass_final.cmd)
- add_dependencies( ${ZEPHYR_FINAL_EXECUTABLE} ${LINKER_PASS_FINAL_SCRIPT_TARGET})
+ set_property(TARGET ${ZEPHYR_FINAL_EXECUTABLE} PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker.cmd)
+ add_dependencies( ${ZEPHYR_FINAL_EXECUTABLE} linker_zephyr_final_script_target)
# Use the pass2 elf as the final elf
set(logical_target_for_zephyr_elf ${ZEPHYR_FINAL_EXECUTABLE})
diff --git a/include/arch/x86/ia32/linker.ld b/include/arch/x86/ia32/linker.ld
index 1864b5b..9eba72d 100644
--- a/include/arch/x86/ia32/linker.ld
+++ b/include/arch/x86/ia32/linker.ld
@@ -141,15 +141,15 @@
#ifndef CONFIG_DYNAMIC_INTERRUPTS
. = ALIGN(8);
_idt_base_address = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(staticIdt))
#else
. += CONFIG_IDT_NUM_VECTORS * 8;
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
. = ALIGN(4);
_irq_to_interrupt_vector = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(irq_int_vector_map))
#else
. += CONFIG_MAX_IRQ_LINES;
@@ -255,18 +255,18 @@
#ifdef CONFIG_DYNAMIC_INTERRUPTS
. = ALIGN(4);
_irq_to_interrupt_vector = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(irq_int_vector_map))
#else
. += CONFIG_MAX_IRQ_LINES;
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
z_interrupt_vectors_allocated = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(irq_vectors_alloc))
#else
. += (CONFIG_IDT_NUM_VECTORS + 7) / 8;
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
/* Located in generated directory. This file is populated by the
@@ -288,20 +288,20 @@
#ifdef CONFIG_DYNAMIC_INTERRUPTS
. = ALIGN(8);
_idt_base_address = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(staticIdt))
#else
. += CONFIG_IDT_NUM_VECTORS * 8;
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
#ifdef CONFIG_GDT_DYNAMIC
KEEP(*(.tss))
. = ALIGN(8);
_gdt = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(gdt))
-#else /* LINKER_PASS2 */
+#else /* LINKER_ZEPHYR_FINAL */
#ifdef CONFIG_USERSPACE
#define GDT_NUM_ENTRIES 7
@@ -311,7 +311,7 @@
#define GDT_NUM_ENTRIES 3
#endif /* CONFIG_X86_USERSPACE */
. += GDT_NUM_ENTRIES * 8;
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
#endif /* CONFIG_GDT_DYNAMIC */
#ifdef CONFIG_X86_KPTI
@@ -354,7 +354,7 @@
GROUP_END(RAMABLE_REGION)
-#ifndef LINKER_PASS2
+#ifndef LINKER_ZEPHYR_FINAL
/* static interrupts */
SECTION_PROLOGUE(intList,,)
{
diff --git a/include/arch/x86/pagetables.ld b/include/arch/x86/pagetables.ld
index 905a048..9477e16 100644
--- a/include/arch/x86/pagetables.ld
+++ b/include/arch/x86/pagetables.ld
@@ -13,11 +13,11 @@
{
. = ALIGN(4096);
z_x86_pagetables_start = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(pagetables)) /* gen_mmu.py */
#else
KEEP(*(.dummy_pagetables)) /* from x86_mmu.c, just an empty array */
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
/* Top-level paging structure is the last thing in this section */
#if CONFIG_X86_PAE
@@ -29,11 +29,11 @@
#endif /* CONFIG_X86_PAE */
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
/DISCARD/ :
{
/* We have the real ones in this build */
*(.dummy_pagetables)
}
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
#endif /* CONFIG_MMU */
diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld
index 845ec70..5b73817 100644
--- a/include/linker/common-rom.ld
+++ b/include/linker/common-rom.ld
@@ -193,10 +193,10 @@
SECTION_DATA_PROLOGUE(device_handles,,)
{
__device_handles_start = .;
-#ifdef LINKER_PASS2
+#ifdef LINKER_ZEPHYR_FINAL
KEEP(*(SORT(.__device_handles_pass2*)));
-#else /* LINKER_PASS2 */
+#else /* LINKER_ZEPHYR_FINAL */
KEEP(*(SORT(.__device_handles_pass1*)));
-#endif /* LINKER_PASS2 */
+#endif /* LINKER_ZEPHYR_FINAL */
__device_handles_end = .;
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
diff --git a/include/linker/intlist.ld b/include/linker/intlist.ld
index dd00051..b99b763 100644
--- a/include/linker/intlist.ld
+++ b/include/linker/intlist.ld
@@ -31,7 +31,7 @@
* }
*/
-#ifndef LINKER_PASS2
+#ifndef LINKER_ZEPHYR_FINAL
SECTION_PROLOGUE(.intList,,)
{
KEEP(*(.irq_info))
diff --git a/include/linker/kobject-text.ld b/include/linker/kobject-text.ld
index 6d3761e..bc1a047 100644
--- a/include/linker/kobject-text.ld
+++ b/include/linker/kobject-text.ld
@@ -12,7 +12,7 @@
*(".kobject_data.text*")
_kobject_text_area_end = .;
_kobject_text_area_used = _kobject_text_area_end - _kobject_text_area_start;
-#ifndef LINKER_PASS2
+#ifndef LINKER_ZEPHYR_FINAL
#ifdef CONFIG_DYNAMIC_OBJECTS
PROVIDE(z_object_gperf_find = .);
PROVIDE(z_object_gperf_wordlist_foreach = .);
diff --git a/include/linker/kobject.ld b/include/linker/kobject.ld
index c02c107..114347e 100644
--- a/include/linker/kobject.ld
+++ b/include/linker/kobject.ld
@@ -26,7 +26,7 @@
{
*(".kobject_data.data*")
-#ifndef LINKER_PASS2
+#ifndef LINKER_ZEPHYR_FINAL
#ifdef CONFIG_DYNAMIC_OBJECTS
PROVIDE(_thread_idx_map = .);
. += CONFIG_MAX_THREAD_BYTES;