binutils-gdb/ld
Alan Modra 93d1b056cb Rewrite ppc32 backend .sdata and .sdata2 handling
1) _SDA_BASE_ and _SDA2_BASE_ and defined automatically, in a similar
   manner to the way _GLOBAL_OFFSET_TABLE_ is handled.  It's a little
   more complicated to remove the symbols because _SDA_BASE_ needs to
   be there if either .sdata or .sbss is present, and similarly for
   _SDA2_BASE.
2) The linker created .sdata and .sdata2 sections used for
   R_PPC_EMB_SDAI16 and R_PPC_EMB_SDA2I16 pointers are created early.
   Nowadays we strip unneeded sections from the output, so it isn't
   necessary to delay creating the sections.
3) The output section for targets of various SDA relocs is now checked
   as per the ABI(s).  We previously allowed .sdata.foo and similar,
   most likely because at some stage we were checking input sections.

Also, the patch fixes a long-standing bug in size_input_sections
that affects the values of symbols defined in stripped input
sections.

	PR 16952
bfd/
	* elf32-ppc.c (ppc_elf_create_linker_section): Move earlier.
	Remove redundant setting of htab->elf.dynobj.  Don't align.
	Define .sdata symbols using _bfd_elf_define_linkage_sym.
	(ppc_elf_create_glink): Call ppc_elf_create_linker_section.
	(create_sdata_sym): Delete.
	(elf_allocate_pointer_linker_section): Rename from
	elf_create_pointer_linker_section.  Align section.
	(ppc_elf_check_relocs): Don't call ppc_elf_creat_linker_section
	directly here, or create_sdata_sym.  Set ref_regular on _SDA_BASE_
	and _SDA2_BASE_.
	(ppc_elf_size_dynamic_sections): Remove ATTRIBUTE_UNUSED on param.
	Remove unnecessary tests on _SDA_BASE_ sym.
	(maybe_strip_sdasym, ppc_elf_maybe_strip_sdata_syms): New functions.
	(ppc_elf_relocate_section): Tighten SDA reloc symbol section checks.
	* elf32-ppc.h (ppc_elf_set_sdata_syms): Delete.
	(ppc_elf_maybe_strip_sdata_syms): Declare.
ld/
	* emulparams/elf32ppccommon.sh (_SDA_BASE_, _SDA2_BASE_): Delete.
	* emultempl/ppc32elf.em (ppc_before_allocation): Call
	ppc_elf_maybe_strip_sdata_syms.
	* ldlang.c (size_input_section): Correct output_offset value
	for excluded input sections.
2014-05-20 13:13:23 +09:30
..
emulparams Rewrite ppc32 backend .sdata and .sdata2 handling 2014-05-20 13:13:23 +09:30
emultempl Rewrite ppc32 backend .sdata and .sdata2 handling 2014-05-20 13:13:23 +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 Don't link FreeBSD tests with -ldl. 2014-05-19 08:49:55 +02:00
.gitignore
ChangeLog Rewrite ppc32 backend .sdata and .sdata2 handling 2014-05-20 13:13:23 +09:30
ChangeLog-0001
ChangeLog-0203
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008 strip off +x bits on non-executable/script files 2013-12-07 02:03:03 -05:00
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013 New Year - binutils ChangeLog rotation 2014-01-08 05:32:12 -08:00
ChangeLog-9197
ChangeLog-9899
MAINTAINERS Update copyright years 2014-03-05 22:16:15 +10:30
Makefile.am Remove support for the (deprecated) openrisc and or32 configurations and replace 2014-04-22 15:57:47 +01:00
Makefile.in Remove support for the (deprecated) openrisc and or32 configurations and replace 2014-04-22 15:57:47 +01:00
NEWS Remove support for the (deprecated) openrisc and or32 configurations and replace 2014-04-22 15:57:47 +01:00
README Update copyright years 2014-03-05 22:16:15 +10:30
TODO
aclocal.m4
config.in
configure Remove remaining default manifest support. 2014-04-09 17:12:30 +01:00
configure.host Update copyright years 2014-03-05 22:16:15 +10:30
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 Update copyright years 2014-03-05 22:16:15 +10:30
deffilep.y Update copyright years 2014-03-05 22:16:15 +10:30
dep-in.sed
elf-hints-local.h
fdl.texi
gen-doc.texi Update copyright years 2014-03-05 22:16:15 +10:30
genscrba.sh
genscripts.sh Update copyright years 2014-03-05 22:16:15 +10:30
h8-doc.texi Update copyright years 2014-03-05 22:16:15 +10:30
ld.h Update copyright years 2014-03-05 22:16:15 +10:30
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 Update copyright years 2014-03-05 22:16:15 +10:30
ldctor.c Update copyright years 2014-03-05 22:16:15 +10:30
ldctor.h Update copyright years 2014-03-05 22:16:15 +10:30
ldemul.c Update copyright years 2014-03-05 22:16:15 +10:30
ldemul.h Update copyright years 2014-03-05 22:16:15 +10:30
ldexp.c Update copyright years 2014-03-05 22:16:15 +10:30
ldexp.h Update copyright years 2014-03-05 22:16:15 +10:30
ldfile.c Remove search path from -l:namespec DT_NEEDED 2014-03-14 12:54:24 +10:30
ldfile.h Update copyright years 2014-03-05 22:16:15 +10:30
ldgram.y Update copyright years 2014-03-05 22:16:15 +10:30
ldint.texinfo Update copyright years 2014-03-05 22:16:15 +10:30
ldlang.c Rewrite ppc32 backend .sdata and .sdata2 handling 2014-05-20 13:13:23 +09:30
ldlang.h Fix freeing of link_info.hash 2014-05-10 02:52:14 +02:00
ldlex-wrapper.c Update copyright years 2014-03-05 22:16:15 +10:30
ldlex.h Update copyright years 2014-03-05 22:16:15 +10:30
ldlex.l Update copyright years 2014-03-05 22:16:15 +10:30
ldmain.c Fix freeing of link_info.hash 2014-05-10 02:52:14 +02:00
ldmain.h Update copyright years 2014-03-05 22:16:15 +10:30
ldmisc.c Update copyright years 2014-03-05 22:16:15 +10:30
ldmisc.h Update copyright years 2014-03-05 22:16:15 +10:30
ldver.c Update copyright years 2014-03-05 22:16:15 +10:30
ldver.h Update copyright years 2014-03-05 22:16:15 +10:30
ldwrite.c Update copyright years 2014-03-05 22:16:15 +10:30
ldwrite.h Update copyright years 2014-03-05 22:16:15 +10:30
lexsup.c Update copyright years 2014-03-05 22:16:15 +10:30
mri.c Update copyright years 2014-03-05 22:16:15 +10:30
mri.h Update copyright years 2014-03-05 22:16:15 +10:30
pe-dll.c Update copyright years 2014-03-05 22:16:15 +10:30
pe-dll.h Update copyright years 2014-03-05 22:16:15 +10:30
pep-dll.c Update copyright years 2014-03-05 22:16:15 +10:30
pep-dll.h Update copyright years 2014-03-05 22:16:15 +10:30
plugin.c Update copyright years 2014-03-05 22:16:15 +10:30
plugin.h Update copyright years 2014-03-05 22:16:15 +10:30
stamp-h.in
sysdep.h Update copyright years 2014-03-05 22:16:15 +10:30
testplug.c Update copyright years 2014-03-05 22:16:15 +10:30

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.