Skip to content

Commit cdd02a9

Browse files
dcpleungnashif
authored andcommitted
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 <[email protected]>
1 parent c745995 commit cdd02a9

File tree

7 files changed

+37
-35
lines changed

7 files changed

+37
-35
lines changed

CMakeLists.txt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,25 +1084,27 @@ if(NOT generated_kernel_files)
10841084
# generation stage.
10851085
set(logical_target_for_zephyr_elf ${ZEPHYR_PREBUILT_EXECUTABLE})
10861086
else()
1087-
# The second linker pass uses the same source linker script of the
1088-
# first pass (LINKER_SCRIPT), but this time with a different output
1089-
# file and preprocessed with the define LINKER_PASS2.
1087+
# The final linker pass uses the same source linker script of the
1088+
# previous passes, but this time with a different output
1089+
# file and preprocessed with the define LINKER_ZEPHYR_FINAL.
1090+
#
1091+
# LINKER_PASS2 is deprecated but being kept to avoid breaking
1092+
# external projects. It will be removed in the future.
10901093
configure_linker_script(
1091-
linker_pass_final.cmd
1092-
"-DLINKER_PASS2"
1094+
linker.cmd
1095+
"-DLINKER_ZEPHYR_FINAL;-DLINKER_PASS2"
10931096
${CODE_RELOCATION_DEP}
10941097
${ZEPHYR_PREBUILT_EXECUTABLE}
10951098
zephyr_generated_headers
10961099
)
10971100

1098-
set(LINKER_PASS_FINAL_SCRIPT_TARGET linker_pass_final_script_target)
10991101
add_custom_target(
1100-
${LINKER_PASS_FINAL_SCRIPT_TARGET}
1102+
linker_zephyr_final_script_target
11011103
DEPENDS
1102-
linker_pass_final.cmd
1104+
linker.cmd
11031105
)
11041106
set_property(TARGET
1105-
${LINKER_PASS_FINAL_SCRIPT_TARGET}
1107+
linker_zephyr_final_script_target
11061108
PROPERTY INCLUDE_DIRECTORIES
11071109
${ZEPHYR_INCLUDE_DIRS}
11081110
)
@@ -1112,15 +1114,15 @@ else()
11121114
TARGET_ELF ${ZEPHYR_FINAL_EXECUTABLE}
11131115
OUTPUT_MAP ${PROJECT_BINARY_DIR}/${ZEPHYR_FINAL_EXECUTABLE}.map
11141116
LIBRARIES_PRE_SCRIPT ${GKOF}
1115-
LINKER_SCRIPT ${PROJECT_BINARY_DIR}/linker_pass_final.cmd
1117+
LINKER_SCRIPT ${PROJECT_BINARY_DIR}/linker.cmd
11161118
LIBRARIES_POST_SCRIPT ""
11171119
DEPENDENCIES ${CODE_RELOCATION_DEP}
11181120
)
11191121
target_byproducts(TARGET ${ZEPHYR_FINAL_EXECUTABLE}
11201122
BYPRODUCTS ${PROJECT_BINARY_DIR}/${ZEPHYR_FINAL_EXECUTABLE}.map
11211123
)
1122-
set_property(TARGET ${ZEPHYR_FINAL_EXECUTABLE} PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker_pass_final.cmd)
1123-
add_dependencies( ${ZEPHYR_FINAL_EXECUTABLE} ${LINKER_PASS_FINAL_SCRIPT_TARGET})
1124+
set_property(TARGET ${ZEPHYR_FINAL_EXECUTABLE} PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker.cmd)
1125+
add_dependencies( ${ZEPHYR_FINAL_EXECUTABLE} linker_zephyr_final_script_target)
11241126

11251127
# Use the pass2 elf as the final elf
11261128
set(logical_target_for_zephyr_elf ${ZEPHYR_FINAL_EXECUTABLE})

include/arch/x86/ia32/linker.ld

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ SECTIONS
141141
#ifndef CONFIG_DYNAMIC_INTERRUPTS
142142
. = ALIGN(8);
143143
_idt_base_address = .;
144-
#ifdef LINKER_PASS2
144+
#ifdef LINKER_ZEPHYR_FINAL
145145
KEEP(*(staticIdt))
146146
#else
147147
. += CONFIG_IDT_NUM_VECTORS * 8;
148-
#endif /* LINKER_PASS2 */
148+
#endif /* LINKER_ZEPHYR_FINAL */
149149

150150
. = ALIGN(4);
151151
_irq_to_interrupt_vector = .;
152-
#ifdef LINKER_PASS2
152+
#ifdef LINKER_ZEPHYR_FINAL
153153
KEEP(*(irq_int_vector_map))
154154
#else
155155
. += CONFIG_MAX_IRQ_LINES;
@@ -255,18 +255,18 @@ SECTIONS
255255
#ifdef CONFIG_DYNAMIC_INTERRUPTS
256256
. = ALIGN(4);
257257
_irq_to_interrupt_vector = .;
258-
#ifdef LINKER_PASS2
258+
#ifdef LINKER_ZEPHYR_FINAL
259259
KEEP(*(irq_int_vector_map))
260260
#else
261261
. += CONFIG_MAX_IRQ_LINES;
262-
#endif /* LINKER_PASS2 */
262+
#endif /* LINKER_ZEPHYR_FINAL */
263263

264264
z_interrupt_vectors_allocated = .;
265-
#ifdef LINKER_PASS2
265+
#ifdef LINKER_ZEPHYR_FINAL
266266
KEEP(*(irq_vectors_alloc))
267267
#else
268268
. += (CONFIG_IDT_NUM_VECTORS + 7) / 8;
269-
#endif /* LINKER_PASS2 */
269+
#endif /* LINKER_ZEPHYR_FINAL */
270270
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
271271

272272
/* Located in generated directory. This file is populated by the
@@ -288,20 +288,20 @@ SECTIONS
288288
#ifdef CONFIG_DYNAMIC_INTERRUPTS
289289
. = ALIGN(8);
290290
_idt_base_address = .;
291-
#ifdef LINKER_PASS2
291+
#ifdef LINKER_ZEPHYR_FINAL
292292
KEEP(*(staticIdt))
293293
#else
294294
. += CONFIG_IDT_NUM_VECTORS * 8;
295-
#endif /* LINKER_PASS2 */
295+
#endif /* LINKER_ZEPHYR_FINAL */
296296
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
297297

298298
#ifdef CONFIG_GDT_DYNAMIC
299299
KEEP(*(.tss))
300300
. = ALIGN(8);
301301
_gdt = .;
302-
#ifdef LINKER_PASS2
302+
#ifdef LINKER_ZEPHYR_FINAL
303303
KEEP(*(gdt))
304-
#else /* LINKER_PASS2 */
304+
#else /* LINKER_ZEPHYR_FINAL */
305305

306306
#ifdef CONFIG_USERSPACE
307307
#define GDT_NUM_ENTRIES 7
@@ -311,7 +311,7 @@ SECTIONS
311311
#define GDT_NUM_ENTRIES 3
312312
#endif /* CONFIG_X86_USERSPACE */
313313
. += GDT_NUM_ENTRIES * 8;
314-
#endif /* LINKER_PASS2 */
314+
#endif /* LINKER_ZEPHYR_FINAL */
315315
#endif /* CONFIG_GDT_DYNAMIC */
316316

317317
#ifdef CONFIG_X86_KPTI
@@ -354,7 +354,7 @@ SECTIONS
354354

355355
GROUP_END(RAMABLE_REGION)
356356

357-
#ifndef LINKER_PASS2
357+
#ifndef LINKER_ZEPHYR_FINAL
358358
/* static interrupts */
359359
SECTION_PROLOGUE(intList,,)
360360
{

include/arch/x86/pagetables.ld

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
{
1414
. = ALIGN(4096);
1515
z_x86_pagetables_start = .;
16-
#ifdef LINKER_PASS2
16+
#ifdef LINKER_ZEPHYR_FINAL
1717
KEEP(*(pagetables)) /* gen_mmu.py */
1818
#else
1919
KEEP(*(.dummy_pagetables)) /* from x86_mmu.c, just an empty array */
20-
#endif /* LINKER_PASS2 */
20+
#endif /* LINKER_ZEPHYR_FINAL */
2121

2222
/* Top-level paging structure is the last thing in this section */
2323
#if CONFIG_X86_PAE
@@ -29,11 +29,11 @@
2929
#endif /* CONFIG_X86_PAE */
3030
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
3131

32-
#ifdef LINKER_PASS2
32+
#ifdef LINKER_ZEPHYR_FINAL
3333
/DISCARD/ :
3434
{
3535
/* We have the real ones in this build */
3636
*(.dummy_pagetables)
3737
}
38-
#endif /* LINKER_PASS2 */
38+
#endif /* LINKER_ZEPHYR_FINAL */
3939
#endif /* CONFIG_MMU */

include/linker/common-rom.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@
193193
SECTION_DATA_PROLOGUE(device_handles,,)
194194
{
195195
__device_handles_start = .;
196-
#ifdef LINKER_PASS2
196+
#ifdef LINKER_ZEPHYR_FINAL
197197
KEEP(*(SORT(.__device_handles_pass2*)));
198-
#else /* LINKER_PASS2 */
198+
#else /* LINKER_ZEPHYR_FINAL */
199199
KEEP(*(SORT(.__device_handles_pass1*)));
200-
#endif /* LINKER_PASS2 */
200+
#endif /* LINKER_ZEPHYR_FINAL */
201201
__device_handles_end = .;
202202
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)

include/linker/intlist.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* }
3232
*/
3333

34-
#ifndef LINKER_PASS2
34+
#ifndef LINKER_ZEPHYR_FINAL
3535
SECTION_PROLOGUE(.intList,,)
3636
{
3737
KEEP(*(.irq_info))

include/linker/kobject-text.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*(".kobject_data.text*")
1313
_kobject_text_area_end = .;
1414
_kobject_text_area_used = _kobject_text_area_end - _kobject_text_area_start;
15-
#ifndef LINKER_PASS2
15+
#ifndef LINKER_ZEPHYR_FINAL
1616
#ifdef CONFIG_DYNAMIC_OBJECTS
1717
PROVIDE(z_object_gperf_find = .);
1818
PROVIDE(z_object_gperf_wordlist_foreach = .);

include/linker/kobject.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{
2727
*(".kobject_data.data*")
2828

29-
#ifndef LINKER_PASS2
29+
#ifndef LINKER_ZEPHYR_FINAL
3030
#ifdef CONFIG_DYNAMIC_OBJECTS
3131
PROVIDE(_thread_idx_map = .);
3232
. += CONFIG_MAX_THREAD_BYTES;

0 commit comments

Comments
 (0)