xref: /OK3568_Linux_fs/u-boot/arch/arm/lib/sections.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun /**
8*4882a593Smuzhiyun  * These two symbols are declared in a C file so that the linker
9*4882a593Smuzhiyun  * uses R_ARM_RELATIVE relocation, rather than the R_ARM_ABS32 one
10*4882a593Smuzhiyun  * it would use if the symbols were defined in the linker file.
11*4882a593Smuzhiyun  * Using only R_ARM_RELATIVE relocation ensures that references to
12*4882a593Smuzhiyun  * the symbols are correct after as well as before relocation.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * We need a 0-byte-size type for these symbols, and the compiler
15*4882a593Smuzhiyun  * does not allow defining objects of C type 'void'. Using an empty
16*4882a593Smuzhiyun  * struct is allowed by the compiler, but causes gcc versions 4.4 and
17*4882a593Smuzhiyun  * below to complain about aliasing. Therefore we use the next best
18*4882a593Smuzhiyun  * thing: zero-sized arrays, which are both 0-byte-size and exempt from
19*4882a593Smuzhiyun  * aliasing warnings.
20*4882a593Smuzhiyun  */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun char __bss_start[0] __attribute__((section(".__bss_start")));
23*4882a593Smuzhiyun char __bss_end[0] __attribute__((section(".__bss_end")));
24*4882a593Smuzhiyun char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
25*4882a593Smuzhiyun char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
26*4882a593Smuzhiyun char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
27*4882a593Smuzhiyun char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
28*4882a593Smuzhiyun char __secure_start[0] __attribute__((section(".__secure_start")));
29*4882a593Smuzhiyun char __secure_end[0] __attribute__((section(".__secure_end")));
30*4882a593Smuzhiyun char __secure_stack_start[0] __attribute__((section(".__secure_stack_start")));
31*4882a593Smuzhiyun char __secure_stack_end[0] __attribute__((section(".__secure_stack_end")));
32*4882a593Smuzhiyun char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start")));
33*4882a593Smuzhiyun char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop")));
34*4882a593Smuzhiyun char __efi_runtime_rel_start[0] __attribute__((section(".__efi_runtime_rel_start")));
35*4882a593Smuzhiyun char __efi_runtime_rel_stop[0] __attribute__((section(".__efi_runtime_rel_stop")));
36*4882a593Smuzhiyun char _end[0] __attribute__((section(".__end")));
37