sections.c 1.8 KB

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