Fourth attempt at unifying the various GCC linker scripts for different
architectures, GCC versions and minimum alignments.

Changes since v3:
- added patch #5 which updates the various IA32/X86 linker scripts to take their
  PE/COFF header size and section alignment from the command line, before
  switching to the unified version which does the same
- added Jordan's Reviewed-by, which he gave on the condition that patch #5
  be added
- added Liming's Tested-by to the patches that apply to IA32 and X86
- added Leif's Tested-by to the patches that apply to AARCH64 (except the
  ArmVirtPkg which he didn't test, but this was my testbed during development)
Changes since v2:
- for easier bisection, factor out the differences between the original
  and the unified linker scripts for X86 before making the switch
  (patches #1 - #4 and #6)
- add Intel copyright notice to unified version (patch #5)
- avoid defining *_*_*_DLINK2_FLAGS so that we don't pollute the variable
  definition space of non-GCC toolchains (patches #8 and #12)
- added Laszlo's ack to patch #10

---------------------------- v2 blurb ---------------------------------
This time, I have added only a single unified GCC linker script that
can be parametrised by ld command line options:
- --defsym=PECOFF_HEADER_SIZE sets the size of the PE/COFF header
- -z common-page-size sets the minimum alignment

This use of common-page-size is entirely legal: it sets an internal LD
constant which can be referred to as CONSTANT(COMMONPAGESIZE) in linker
scripts, and is otherwise unused internally by the linker.

Tested with ArmVirtQemu/AARCH64 and Ovmf/X64

Branch is here
(now correctly based on the GitHub repo)

Ard Biesheuvel (13):
  BaseTools IA32/X64: remove NOP padding from X86/IA32 GCC linker
  BaseTools IA32/X64: move .rodata to PE/COFF .text section
  BaseTools IA32/X64: drop redundant alignment from linker script
  BaseTools IA32/X64: move .got contents to the PE/COFF .text section
  BaseTools IA32/X64: get header size and alignment from ld commandline
  BaseTools GCC: add unified GCC linker script for all archs and
  BaseTools GCC: align start of .data to .text alignment
  BaseTools GCC: move AutoGen.obj contents to .text section
  BaseTools AARCH64: move to unified GCC linker script
  ArmPlatformPkg/ArmVExpressPkg: move to unified GCC linker script
  ArmVirtPkg: move to unified GCC linker script
  BaseTools AARCH64: remove incremental linker script for 64K alignment
  BaseTools IA32/X64: Use instead of gcc*-ld-script

 ArmPlatformPkg/ArmVExpressPkg/ |  2 +-
 ArmVirtPkg/                        |  2 +-
 BaseTools/Conf/tools_def.template                 | 37 ++++++++++-
 BaseTools/Scripts/                     | 70 ++++++++++++++++++++
 BaseTools/Scripts/gcc-4K-align-ld-script          | 44 ------------
 BaseTools/Scripts/gcc-aarch64-64K-align-ld-script |  4 --
 BaseTools/Scripts/gcc-aarch64-ld-script           | 39 -----------
 BaseTools/Scripts/gcc4.4-ld-script                | 44 ------------
 BaseTools/Scripts/gcc4.9-ld-script                | 44 ------------
 9 files changed, 106 insertions(+), 180 deletions(-)
 create mode 100644 BaseTools/Scripts/
 delete mode 100644 BaseTools/Scripts/gcc-4K-align-ld-script
 delete mode 100644 BaseTools/Scripts/gcc-aarch64-64K-align-ld-script
 delete mode 100644 BaseTools/Scripts/gcc-aarch64-ld-script
 delete mode 100644 BaseTools/Scripts/gcc4.4-ld-script
 delete mode 100644 BaseTools/Scripts/gcc4.9-ld-script


edk2-devel mailing list

Reply via email to