GccBase.lds 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /** @file
  2. Unified linker script for GCC based builds
  3. Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
  4. Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
  5. (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. SECTIONS {
  9. /*
  10. * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
  11. * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
  12. * between 32-bit and 64-bit builds). The actual start of the .text section
  13. * will be rounded up based on its actual alignment.
  14. */
  15. . = PECOFF_HEADER_SIZE;
  16. .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
  17. *(.text .text.* .stub .gnu.linkonce.t.*)
  18. *(.rodata .rodata.* .gnu.linkonce.r.*)
  19. *(.got .got.*)
  20. /*
  21. * The contents of AutoGen.c files are mostly constant from the POV of the
  22. * program, but most of it ends up in .data or .bss by default since few of
  23. * the variable definitions that get emitted are declared as CONST.
  24. * Unfortunately, we cannot pull it into the .text section entirely, since
  25. * patchable PCDs are also emitted here, but we can at least move all of the
  26. * emitted GUIDs here.
  27. */
  28. *:AutoGen.obj(.data.g*Guid)
  29. }
  30. /*
  31. * The alignment of the .data section should be less than or equal to the
  32. * alignment of the .text section. This ensures that the relative offset
  33. * between these sections is the same in the ELF and the PE/COFF versions of
  34. * this binary.
  35. */
  36. .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
  37. *(.data .data.* .gnu.linkonce.d.*)
  38. *(.bss .bss.*)
  39. }
  40. .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
  41. KEEP (*(.eh_frame))
  42. }
  43. .rela (INFO) : {
  44. *(.rela .rela.*)
  45. }
  46. .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {
  47. KEEP (*(.hii))
  48. }
  49. /*
  50. * Retain the GNU build id but in a non-allocatable section so GenFw
  51. * does not copy it into the PE/COFF image.
  52. */
  53. .build-id (INFO) : { *(.note.gnu.build-id) }
  54. /DISCARD/ : {
  55. *(.note.GNU-stack)
  56. *(.gnu_debuglink)
  57. *(.interp)
  58. *(.dynsym)
  59. *(.dynstr)
  60. *(.dynamic)
  61. *(.hash .gnu.hash)
  62. *(.comment)
  63. *(COMMON)
  64. }
  65. }