It is confusing to have a camel-case indentifier in the these files. Rename them to fit with U-Boot's snake-case style.
The image_base symbol is already used in the x86 link-scripts. Signed-off-by: Simon Glass <s...@chromium.org> --- Changes in v2: - Rework the commit message to clarify the relationship to link-scripts arch/arm/lib/crt0_aarch64_efi.S | 26 +++++++++++++------------- arch/riscv/lib/crt0_riscv_efi.S | 28 ++++++++++++++-------------- include/asm-generic/sections.h | 2 ++ 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/arch/arm/lib/crt0_aarch64_efi.S b/arch/arm/lib/crt0_aarch64_efi.S index f1d5de6a93d..c1030e5392a 100644 --- a/arch/arm/lib/crt0_aarch64_efi.S +++ b/arch/arm/lib/crt0_aarch64_efi.S @@ -15,12 +15,12 @@ /* * Magic "MZ" signature for PE/COFF */ - .globl ImageBase -ImageBase: + .globl image_base +image_base: .short IMAGE_DOS_SIGNATURE /* 'MZ' */ .skip 54 /* 'MZ' + pad + offset == 64 */ .long LINUX_ARM64_MAGIC /* For GRUB's linux command */ - .long pe_header - ImageBase /* Offset to the PE header */ + .long pe_header - image_base /* Offset to the PE header */ pe_header: .long IMAGE_NT_SIGNATURE /* 'PE' */ coff_header: @@ -43,11 +43,11 @@ optional_header: .long _etext - _start /* SizeOfCode */ .long 0 /* SizeOfInitializedData */ .long 0 /* SizeOfUninitializedData */ - .long _start - ImageBase /* AddressOfEntryPoint */ - .long _start - ImageBase /* BaseOfCode */ + .long _start - image_base /* AddressOfEntryPoint */ + .long _start - image_base /* BaseOfCode */ extra_header_fields: - .quad 0 /* ImageBase */ + .quad 0 /* image_base */ .long 0x1000 /* SectionAlignment */ .long 0x200 /* FileAlignment */ .short 0 /* MajorOperatingSystemVersion */ @@ -58,12 +58,12 @@ extra_header_fields: .short 0 /* MinorSubsystemVersion */ .long 0 /* Win32VersionValue */ - .long _edata - ImageBase /* SizeOfImage */ + .long _edata - image_base /* SizeOfImage */ /* * Everything before the kernel image is considered part of the header */ - .long _start - ImageBase /* SizeOfHeaders */ + .long _start - image_base /* SizeOfHeaders */ .long 0 /* CheckSum */ .short IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */ #if CONFIG_ARCH_EFI @@ -114,9 +114,9 @@ section_table: .byte 0 .byte 0 /* end of 0 padding of section name */ .long _etext - _start /* VirtualSize */ - .long _start - ImageBase /* VirtualAddress */ + .long _start - image_base /* VirtualAddress */ .long _etext - _start /* SizeOfRawData */ - .long _start - ImageBase /* PointerToRawData */ + .long _start - image_base /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLineNumbers */ .short 0 /* NumberOfRelocations */ @@ -131,9 +131,9 @@ section_table: .byte 0 .byte 0 /* end of 0 padding of section name */ .long _data_size /* VirtualSize */ - .long _data - ImageBase /* VirtualAddress */ + .long _data - image_base /* VirtualAddress */ .long _data_size /* SizeOfRawData */ - .long _data - ImageBase /* PointerToRawData */ + .long _data - image_base /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLineNumbers */ .short 0 /* NumberOfRelocations */ @@ -149,7 +149,7 @@ _start: mov x29, sp stp x0, x1, [sp, #16] - adr x0, ImageBase + adr x0, image_base adrp x1, _DYNAMIC add x1, x1, #:lo12:_DYNAMIC bl _relocate diff --git a/arch/riscv/lib/crt0_riscv_efi.S b/arch/riscv/lib/crt0_riscv_efi.S index 424f18480fa..909d9e793d3 100644 --- a/arch/riscv/lib/crt0_riscv_efi.S +++ b/arch/riscv/lib/crt0_riscv_efi.S @@ -41,14 +41,14 @@ /* * Magic "MZ" signature for PE/COFF */ - .globl ImageBase -ImageBase: + .globl image_base +image_base: .short IMAGE_DOS_SIGNATURE /* 'MZ' */ .skip 46 /* 'MZ' + pad + offset == 64 */ .long 0x43534952 /* Linux magic "RISCV */ .long 0x00000056 .long 0x05435352 /* Linux magic2 "RSC\x05*/ - .long pe_header - ImageBase /* Offset to the PE header */ + .long pe_header - image_base /* Offset to the PE header */ pe_header: .long IMAGE_NT_SIGNATURE /* 'PE' */ coff_header: @@ -66,17 +66,17 @@ optional_header: .long _edata - _start /* SizeOfCode */ .long 0 /* SizeOfInitializedData */ .long 0 /* SizeOfUninitializedData */ - .long _start - ImageBase /* AddressOfEntryPoint */ - .long _start - ImageBase /* BaseOfCode */ + .long _start - image_base /* AddressOfEntryPoint */ + .long _start - image_base /* BaseOfCode */ #if __riscv_xlen == 32 .long 0 /* BaseOfData */ #endif extra_header_fields: #if __riscv_xlen == 32 - .long 0 /* ImageBase */ + .long 0 /* image_base */ #else - .quad 0 /* ImageBase */ + .quad 0 /* image_base */ #endif .long 0x200 /* SectionAlignment */ .long 0x200 /* FileAlignment */ @@ -88,12 +88,12 @@ extra_header_fields: .short 0 /* MinorSubsystemVersion */ .long 0 /* Win32VersionValue */ - .long _edata - ImageBase /* SizeOfImage */ + .long _edata - image_base /* SizeOfImage */ /* * Everything before the kernel image is considered part of the header */ - .long _start - ImageBase /* SizeOfHeaders */ + .long _start - image_base /* SizeOfHeaders */ .long 0 /* CheckSum */ .short IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */ #if CONFIG_ARCH_EFI @@ -149,9 +149,9 @@ section_table: .byte 0 .byte 0 /* end of 0 padding of section name */ .long _etext - _start /* VirtualSize */ - .long _start - ImageBase /* VirtualAddress */ + .long _start - image_base /* VirtualAddress */ .long _etext - _start /* SizeOfRawData */ - .long _start - ImageBase /* PointerToRawData */ + .long _start - image_base /* PointerToRawData */ .long 0 /* PointerToRelocations (0 for executables) */ .long 0 /* PointerToLineNumbers (0 for executables) */ .short 0 /* NumberOfRelocations (0 for executables) */ @@ -166,9 +166,9 @@ section_table: .byte 0 .byte 0 /* end of 0 padding of section name */ .long _edata - _data /* VirtualSize */ - .long _data - ImageBase /* VirtualAddress */ + .long _data - image_base /* VirtualAddress */ .long _edata - _data /* SizeOfRawData */ - .long _data - ImageBase /* PointerToRawData */ + .long _data - image_base /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLineNumbers */ .short 0 /* NumberOfRelocations */ @@ -185,7 +185,7 @@ _start: SAVE_LONG(a1, 1) SAVE_LONG(ra, 2) - lla a0, ImageBase + lla a0, image_base lla a1, _DYNAMIC call _relocate bne a0, zero, 0f diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 5b040d0acd0..606fce65adc 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -72,6 +72,8 @@ extern char __rel_dyn_start[], __rel_dyn_end[]; extern char _image_binary_end[]; extern char __dtb[]; +extern char image_base[]; + /* * This is the U-Boot entry point - prior to relocation it should be same * as __text_start -- 2.43.0