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>
This commit is contained in:
Daniel Leung 2021-03-19 12:18:52 -07:00 committed by Anas Nashif
parent c745995a2e
commit cdd02a99a1
7 changed files with 37 additions and 35 deletions

View file

@ -1084,25 +1084,27 @@ if(NOT generated_kernel_files)
# 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 @@ else()
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})

View file

@ -141,15 +141,15 @@ SECTIONS
#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 @@ SECTIONS
#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 @@ SECTIONS
#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 @@ SECTIONS
#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 @@ SECTIONS
GROUP_END(RAMABLE_REGION)
#ifndef LINKER_PASS2
#ifndef LINKER_ZEPHYR_FINAL
/* static interrupts */
SECTION_PROLOGUE(intList,,)
{

View file

@ -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 */

View file

@ -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)

View file

@ -31,7 +31,7 @@
* }
*/
#ifndef LINKER_PASS2
#ifndef LINKER_ZEPHYR_FINAL
SECTION_PROLOGUE(.intList,,)
{
KEEP(*(.irq_info))

View file

@ -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 = .);

View file

@ -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;