binutils-gdb/ld
Jakub Jelinek 4a50820ee8 libiberty, ld: Use x86 HW optimized sha1
The following patch attempts to use x86 SHA ISA if available to speed
up in my testing about 2.5x sha1 build-id processing (in my case on
AMD Ryzen 5 3600) while producing the same result.
I believe AArch64 has similar HW acceleration for SHA1, perhaps it
could be added similarly.

Note, seems lld uses BLAKE3 rather than md5/sha1.  I think it would be
a bad idea to lie to users, if they choose --buildid=sha1, we should
be using SHA1, not some other checksum, but perhaps we could add some other
--buildid= styles and perhaps make one of the new the default.

Tested on x86_64-linux, both on Intel i9-7960X (which doesn't have
sha_ni ISA support) without/with the patch and on AMD Ryzen 5 3600
(which does have it) without/with the patch.

2023-11-28  Jakub Jelinek  <jakub@redhat.com>

include/
	* sha1.h (sha1_process_bytes_fn): New typedef.
	(sha1_choose_process_bytes): Declare.
libiberty/
	* configure.ac (HAVE_X86_SHA1_HW_SUPPORT): New check.
	* sha1.c: If HAVE_X86_SHA1_HW_SUPPORT is defined, include x86intrin.h
	and cpuid.h.
	(sha1_hw_process_bytes, sha1_hw_process_block,
	sha1_choose_process_bytes): New functions.
	* config.in: Regenerated.
	* configure: Regenerated.
ld/
	* ldbuildid.c (generate_build_id): Use sha1_choose_process_bytes ()
	instead of &sha1_process_bytes.
2023-11-28 13:29:58 +01:00
..
emulparams x86-64: Add -z mark-plt and -z nomark-plt 2023-09-29 07:58:53 -07:00
emultempl LoongArch: Modify link_info.relax_pass from 3 to 2 2023-11-17 16:38:55 +08:00
po New Romanian translation for ld 2023-11-28 10:16:36 +00:00
scripttempl Revert "arc: Add new linker emulation and scripts for ARCv3 ISA." 2023-09-25 17:02:55 +03:00
testsuite LoongArch: Add more relaxation testcases 2023-11-17 16:38:55 +08:00
.gitignore
aclocal.m4 Finalized intl-update patches 2023-11-15 12:53:04 +00:00
ChangeLog libiberty, ld: Use x86 HW optimized sha1 2023-11-28 13:29:58 +01:00
ChangeLog-0001
ChangeLog-0203
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-9197
ChangeLog-9899
config.in Finalized intl-update patches 2023-11-15 12:53:04 +00:00
configure Finalized intl-update patches 2023-11-15 12:53:04 +00:00
configure.ac Add ability to change linker warning messages into errors when reporting executable stacks and/or executable segments. 2023-11-10 11:37:27 +00:00
configure.host
configure.tgt ld: microblaze: ignore rwx segments 2023-10-04 08:38:58 -07:00
deffile.h
deffilep.y
dep-in.sed
elf-hints-local.h
fdl.texi
gen-doc.texi
genscrba.sh
genscripts.sh ld .deps/*.Pc files 2023-08-26 09:20:45 +09:30
h8-doc.texi
ld.h ld: Support input section description keyword: REVERSE 2023-11-01 13:51:17 +00:00
ld.texi Fix: symbols eliminated by --gc-sections still trigger warnings for gnu.warning.SYM 2023-11-21 11:30:03 +00:00
ldbuildid.c libiberty, ld: Use x86 HW optimized sha1 2023-11-28 13:29:58 +01:00
ldbuildid.h
ldcref.c
ldctor.c Revert "2.41 Release sources" 2023-08-02 12:06:23 +01:00
ldctor.h
ldelf.c PR30984, assertion fail elf.c:8485 2023-10-20 08:57:34 +10:30
ldelf.h
ldelfgen.c Revert "2.41 Release sources" 2023-08-02 12:06:23 +01:00
ldelfgen.h
ldemul.c
ldemul.h
ldexp.c Revert "2.41 Release sources" 2023-08-02 12:06:23 +01:00
ldexp.h Revert "2.41 Release sources" 2023-08-02 12:06:23 +01:00
ldfile.c ld: write resolved path to included file to dependency-file 2023-09-21 08:03:09 +02:00
ldfile.h
ldgram.y ld: Support input section description keyword: REVERSE 2023-11-01 13:51:17 +00:00
ldint.texi
ldlang.c ld: Support input section description keyword: REVERSE 2023-11-01 13:51:17 +00:00
ldlang.h ld: Support input section description keyword: REVERSE 2023-11-01 13:51:17 +00:00
ldlex-wrapper.c
ldlex.h Add ability to change linker warning messages into errors when reporting executable stacks and/or executable segments. 2023-11-10 11:37:27 +00:00
ldlex.l ld: Support input section description keyword: REVERSE 2023-11-01 13:51:17 +00:00
ldmain.c
ldmain.h
ldmisc.c
ldmisc.h Revert "2.41 Release sources" 2023-08-02 12:06:23 +01:00
ldver.c
ldver.h
ldwrite.c
ldwrite.h
lexsup.c Fix another linker command line option that was not being recognised in its long form. 2023-11-14 11:24:58 +00:00
libdep_plugin.c
MAINTAINERS
Makefile.am Revert "arc: Add new linker emulation and scripts for ARCv3 ISA." 2023-09-25 17:02:55 +03:00
Makefile.in Finalized intl-update patches 2023-11-15 12:53:04 +00:00
mri.c
mri.h
NEWS Add ability to change linker warning messages into errors when reporting executable stacks and/or executable segments. 2023-11-10 11:37:27 +00:00
pdb.c warn unused result for bfd IO functions 2023-08-11 16:36:11 +09:30
pdb.h
pe-dll.c Use bfd_get_current_time in places where it is suitable 2023-10-02 13:24:05 +01:00
pe-dll.h
pep-dll-aarch64.c
pep-dll-x86_64.c
pep-dll.c
pep-dll.h
plugin.c
plugin.h
README
sysdep.h ld: sprintf sanitizer null destination pointer 2023-08-03 21:19:54 +09:30
testplug2.c
testplug3.c
testplug4.c
testplug.c
TODO

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

		README for LD

This is the GNU linker.  It is distributed with other "binary
utilities" which should be in ../binutils.  See ../binutils/README for
more general notes, including where to send bug reports.

There are many features of the linker:

* The linker uses a Binary File Descriptor library (../bfd)
  that it uses to read and write object files.  This helps
  insulate the linker itself from the format of object files.

* The linker supports a number of different object file
  formats.  It can even handle multiple formats at once:
  Read two input formats and write a third.

* The linker can be configured for cross-linking.

* The linker supports a control language.

* There is a user manual (ld.texi), as well as the
  beginnings of an internals manual (ldint.texi).

Installation
============

See ../binutils/README.

If you want to make a cross-linker, you may want to specify
a different search path of -lfoo libraries than the default.
You can do this by setting the LIB_PATH variable in ./Makefile
or using the --with-lib-path configure switch.

To build just the linker, make the target all-ld from the top level
directory (one directory above this one).

Porting to a new target
=======================

See the ldint.texi manual.

Reporting bugs etc
===========================

See ../binutils/README.

Known problems
==============

The Solaris linker normally exports all dynamic symbols from an
executable.  The GNU linker does not do this by default.  This is
because the GNU linker tries to present the same interface for all
similar targets (in this case, all native ELF targets).  This does not
matter for normal programs, but it can make a difference for programs
which try to dlopen an executable, such as PERL or Tcl.  You can make
the GNU linker export all dynamic symbols with the -E or
--export-dynamic command line option.

HP/UX 9.01 has a shell bug that causes the linker scripts to be
generated incorrectly.  The symptom of this appears to be "fatal error
- scanner input buffer overflow" error messages.  There are various
workarounds to this:
  * Build and install bash, and build with "make SHELL=bash".
  * Update to a version of HP/UX with a working shell (e.g., 9.05).
  * Replace "(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc)" in
    genscripts.sh with "sh ${srcdir}..." (no parens) and make sure the
    emulparams script used exports any shell variables it sets.

Copyright (C) 2012-2023 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.