binutils-gdb/ld
Alan Modra caa4096e84 Don't call bfd_link_hash_table_free
Freeing the linker hash table is a royal pain.  It can't be freed
before the _bfd_write_contents call in bfd_close, because some target
bfd_write_contents functions access the hash table.  It can't be freed
after bfd_close either, since bfd_alloc memory holding side data
structures disappears (PR17047).  Clearly the only place it can be freed
is actually in bfd_close.  This patch doesn't do that, but kills off
the existing means of freeing the hash table via a bfd target xvec call.

bfd/
	PR 17047
	* targets.c (BFD_JUMP_TABLE): Delete NAME##_bfd_link_hash_table_free.
	(struct bfd_target <_bfd_link_hash_table_free>): Delete.
	* bfd.c (bfd_link_hash_table_free): Don't define.
	* aout-adobe.c, * aout-target.h, * aout-tic30.c, * binary.c, * bout.c,
	* coff64-rs6000.c, * coffcode.h, * elf-m10300.c, * elf32-arm.c,
	* elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc11.c,
	* elf32-m68hc12.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c,
	* elf32-sparc.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c,
	* elf64-sparc.c, * elf64-x86-64.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* elfxx-target.h, * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c,
	* libbfd-in.h, * libecoff.h, * mach-o-target.c, * mmo.c,
	* nlm-target.h, * oasys.c, * pef.c, * plugin.c, * ppcboot.c, * som.c,
	* srec.c, * tekhex.c, * verilog.c, * versados.c, * vms-alpha.c,
	* xsym.c: Don't define various link_hash_table_free defines, and
	remove from bfd_target vars.  Temporarily reference some of the
	target link_hash_table_free functions to avoid warnings.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
ld/
	PR 17047
	* ldlang.c (output_bfd_hash_table_free_fn): Delete.
	(open_output): Don't set it..
	* ldmain.c (ld_cleanup): ..or call it.
2014-06-13 19:11:29 +09:30
..
emulparams fix 2014-05-28 ld Makefile.am changes 2014-06-02 14:52:52 +09:30
emultempl Make bfd.link_next field a union 2014-06-13 19:10:57 +09:30
po Fix fallout from splitting ldbuildid.[ch] off elf32.em. 2014-04-09 13:49:05 +09:30
scripttempl Remove support for the (deprecated) openrisc and or32 configurations and replace 2014-04-22 15:57:47 +01:00
testsuite Remove reference to GASp from linker testsuite configuration. 2014-06-09 15:09:02 +01:00
.gitignore
ChangeLog Don't call bfd_link_hash_table_free 2014-06-13 19:11:29 +09:30
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-9197
ChangeLog-9899
MAINTAINERS
Makefile.am Add missing ld makefile dependency for nios. 2014-06-13 18:58:53 +09:30
Makefile.in Add missing ld makefile dependency for nios. 2014-06-13 18:58:53 +09:30
NEWS Remove support for the (deprecated) openrisc and or32 configurations and replace 2014-04-22 15:57:47 +01:00
README
TODO
aclocal.m4
config.in
configure Make it easy to make --disable-werror the default for both binutils and gdb 2014-06-05 05:47:29 -07:00
configure.host
configure.in Remove remaining default manifest support. 2014-04-09 17:12:30 +01:00
configure.tgt * configure.tgt: Add /lib to dragonfly NATIVE_LIB_DIRS. 2014-05-16 15:39:47 +01:00
deffile.h
deffilep.y
dep-in.sed
elf-hints-local.h
fdl.texi
gen-doc.texi
genscrba.sh
genscripts.sh fix 2014-05-28 ld Makefile.am changes 2014-06-02 14:52:52 +09:30
h8-doc.texi
ld.h
ld.texinfo Remove remaining default manifest support. 2014-04-09 17:12:30 +01:00
ldbuildid.c 2014-04-16 Steve Ellcey <sellcey@mips.com> 2014-04-16 10:45:08 -07:00
ldbuildid.h Add support for generating and inserting build IDs into COFF binaries. 2014-04-08 10:59:43 +01:00
ldcref.c
ldctor.c
ldctor.h
ldemul.c Add new link-map-text hook and RX auto-vector support. 2014-05-27 17:14:49 -04:00
ldemul.h Add new link-map-text hook and RX auto-vector support. 2014-05-27 17:14:49 -04:00
ldexp.c PROVIDE in linker script vs. built-in symbols 2014-06-07 14:55:12 +09:30
ldexp.h
ldfile.c Remove search path from -l:namespec DT_NEEDED 2014-03-14 12:54:24 +10:30
ldfile.h
ldgram.y
ldint.texinfo
ldlang.c Don't call bfd_link_hash_table_free 2014-06-13 19:11:29 +09:30
ldlang.h Localize varible to avoid warning 2014-05-25 00:54:22 +09:30
ldlex-wrapper.c
ldlex.h
ldlex.l
ldmain.c Don't call bfd_link_hash_table_free 2014-06-13 19:11:29 +09:30
ldmain.h
ldmisc.c
ldmisc.h
ldver.c
ldver.h
ldwrite.c
ldwrite.h
lexsup.c
mri.c Localize varible to avoid warning 2014-05-25 00:54:22 +09:30
mri.h
pe-dll.c Make bfd.link_next field a union 2014-06-13 19:10:57 +09:30
pe-dll.h
pep-dll.c
pep-dll.h
plugin.c
plugin.h
stamp-h.in
sysdep.h
testplug.c

README

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.texinfo), as well as the
  beginnings of an internals manual (ldint.texinfo).

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.texinfo 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-2014 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.