[v3,0/4] Add lto and none-lto output support for ld -r

Message ID 20250112070752.2883068-1-hjl.tools@gmail.com
Headers
Series Add lto and none-lto output support for ld -r |

Message

H.J. Lu Jan. 12, 2025, 7:07 a.m. UTC
  Changes in v3:

1. Change the commit message from "lto and none-lto intput" to "lto and
none-lto output".
2. Fix ld_parse_linker_script for Clang build.
3. Update documentation for mixing IR and non-IR objects for "ld -r".
4. Use $CC_FOR_TARGET for nm --plugin test.

Changes in v2:

1. Mention https://gitlab.com/x86-psABIs/Linux-ABI
2. Document mixing IR and non-IR objects for "ld -r".

H.J. Lu (4):
  ld: Add lto and none-lto output support for ld -r
  ld: Document mixing IR and non-IR objects for -r
  ld: Don't check the plugin target twice
  h8300: Handle .gnu_object_only section

 bfd/bfd-in2.h                     |   16 +-
 bfd/bfd.c                         |   46 +-
 bfd/elf.c                         |    1 +
 bfd/format.c                      |   37 +-
 bfd/opncls.c                      |   66 ++
 bfd/plugin.c                      |  193 +++++-
 bfd/plugin.h                      |    2 +
 bfd/section.c                     |    3 +
 binutils/objcopy.c                |   32 +-
 binutils/readelf.c                |    1 +
 gas/config/tc-h8300.c             |    6 +-
 gas/testsuite/gas/elf/section9.d  |    1 +
 gas/testsuite/gas/elf/section9.s  |    2 +
 include/elf/common.h              |    1 +
 ld/emultempl/aarch64elf.em        |    2 +-
 ld/emultempl/alphaelf.em          |    2 +-
 ld/emultempl/armelf.em            |    2 +-
 ld/emultempl/avrelf.em            |    2 +-
 ld/emultempl/elf.em               |    1 +
 ld/emultempl/ppc32elf.em          |    2 +-
 ld/emultempl/ppc64elf.em          |    2 +-
 ld/emultempl/spuelf.em            |    2 +-
 ld/ld.h                           |    6 +
 ld/ld.texi                        |   11 +
 ld/ldelf.c                        |   26 +-
 ld/ldelf.h                        |    1 +
 ld/ldexp.c                        |   16 +-
 ld/ldexp.h                        |    4 +-
 ld/ldfile.c                       |    2 +
 ld/ldlang.c                       | 1027 ++++++++++++++++++++++++++++-
 ld/ldlang.h                       |   44 +-
 ld/ldmain.c                       |   80 ++-
 ld/ldmain.h                       |    2 +
 ld/plugin.c                       |    3 +
 ld/scripttempl/elf.sc             |    2 +-
 ld/scripttempl/elf64hppa.sc       |    2 +-
 ld/scripttempl/elfxtensa.sc       |    2 +-
 ld/scripttempl/mep.sc             |    2 +-
 ld/scripttempl/pe.sc              |    1 +
 ld/scripttempl/pep.sc             |    1 +
 ld/testsuite/ld-plugin/lto-10.out |    1 +
 ld/testsuite/ld-plugin/lto-10a.c  |    6 +
 ld/testsuite/ld-plugin/lto-10b.c  |    7 +
 ld/testsuite/ld-plugin/lto-10r.d  |    9 +
 ld/testsuite/ld-plugin/lto-4.out  |    2 +
 ld/testsuite/ld-plugin/lto-4a.c   |    7 +
 ld/testsuite/ld-plugin/lto-4b.c   |    9 +
 ld/testsuite/ld-plugin/lto-4c.c   |    6 +
 ld/testsuite/ld-plugin/lto-4r-a.d |    7 +
 ld/testsuite/ld-plugin/lto-4r-b.d |    7 +
 ld/testsuite/ld-plugin/lto-4r-c.d |    7 +
 ld/testsuite/ld-plugin/lto-4r-d.d |    7 +
 ld/testsuite/ld-plugin/lto.exp    |   66 ++
 53 files changed, 1668 insertions(+), 127 deletions(-)
 create mode 100644 ld/testsuite/ld-plugin/lto-10.out
 create mode 100644 ld/testsuite/ld-plugin/lto-10a.c
 create mode 100644 ld/testsuite/ld-plugin/lto-10b.c
 create mode 100644 ld/testsuite/ld-plugin/lto-10r.d
 create mode 100644 ld/testsuite/ld-plugin/lto-4.out
 create mode 100644 ld/testsuite/ld-plugin/lto-4a.c
 create mode 100644 ld/testsuite/ld-plugin/lto-4b.c
 create mode 100644 ld/testsuite/ld-plugin/lto-4c.c
 create mode 100644 ld/testsuite/ld-plugin/lto-4r-a.d
 create mode 100644 ld/testsuite/ld-plugin/lto-4r-b.d
 create mode 100644 ld/testsuite/ld-plugin/lto-4r-c.d
 create mode 100644 ld/testsuite/ld-plugin/lto-4r-d.d