ld: Don't evaluate unneeded PROVIDE expressions.
When creating a linker mapfile (using -Map=MAPFILE), we previously would
always try to evaluate the expression from a PROVIDE statement.
However, this is not always safe, consider:
PROVIDE (foo = 0x10);
PROVIDE (bar = foo);
In this example, if neither 'foo' or 'bar' is needed, then while
generating the linker mapfile evaluating the expression for 'foo' is
harmless (just the value 0x10). However, evaluating the expression for
'bar' requires the symbol 'foo', which is undefined. This used to cause
a fatal error.
This patch changes the behaviour, so that when the destination of the
PROVIDE is not defined (that is the PROVIDE is not going to provide
anything) the expression is not evaluated, and instead a special string
is displayed to indicate that the linker is discarding the PROVIDE
statement.
This change not only fixes the spurious undefined symbol error, but also
means that a user can now tell if a PROVIDE statement has provided
anything by inspecting the linker mapfile, something that could not be
done before.
ld/ChangeLog:
* ldlang.c (print_assignment): Only evaluate the expression for a
PROVIDE'd assignment when the destination is being defined.
Display a special message for PROVIDE'd symbols that are not being
provided.
ld/testsuite/ChangeLog:
* ld-scripts/provide-4.d: New file.
* ld-scripts/provide-4-map.d: New file.
* ld-scripts/provide-4.t: New file.
* ld-scripts/provide-5.d: New file.
* ld-scripts/provide-5.s: New file.
* ld-scripts/provide-5-map.d: New file.
* ld-scripts/provide-5.t: New file.
* ld-scripts/provide.exp: Run the provide-4.d and provide-5.d
tests.
2015-01-07 11:51:35 +01:00
|
|
|
|
2015-01-20 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* ld-scripts/provide-4.d: New file.
|
|
|
|
|
* ld-scripts/provide-4-map.d: New file.
|
|
|
|
|
* ld-scripts/provide-4.t: New file.
|
|
|
|
|
* ld-scripts/provide-5.d: New file.
|
|
|
|
|
* ld-scripts/provide-5.s: New file.
|
|
|
|
|
* ld-scripts/provide-5-map.d: New file.
|
|
|
|
|
* ld-scripts/provide-5.t: New file.
|
|
|
|
|
* ld-scripts/provide.exp: Run the provide-4.d and provide-5.d
|
|
|
|
|
tests.
|
|
|
|
|
|
2015-01-07 00:40:48 +01:00
|
|
|
|
2015-01-20 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* ld-scripts/overlay-size.d: Add 'map' option.
|
|
|
|
|
* ld-scripts/overlay-size.exp: Remove manual check of mapfile.
|
|
|
|
|
* lib/ld-lib.exp (run_dump_test): Add support for new 'map'
|
|
|
|
|
option, checking linker mapfile output.
|
|
|
|
|
|
Reorder more powerpc64 sections for -z relro
This moves .got too, which requires .sdata and .sbss to move with it,
because these sections share addressing via the toc pointer and with
small-model code must be within a 16-bit signed offset. .plt, .iplt
and .branch_lt must also be moved since they are addressed via a
32-bit offset from the toc pointer, and we might have a very large
.data section.
This change means we may have some bss style sections before the data
segment, necessitating another PT_LOAD header. Also, since _edata is
defined at the end of the data segment it's possible with an empty
.data to have _edata at the end of .plt which looks a little unusual
since .plt is a bss style section. That should only happen rarely in
real world binaries, but does occur in the ld testsuite.
ld/
* emulparams/elf64ppc.sh (BSS_PLT): Don't define.
(OTHER_READWRITE_SECTIONS): Move .branch_lt to..
(OTHER_RELRO_SECTIONS_2): ..here.
(DATA_GOT, SEPARATE_GOTPLT, DATA_SDATA, DATA_PLT,
PLT_BEFORE_GOT): Define.
* scripttempl/elf.sc: Handle DATA_SDATA and DATA_GOT/DATA_PLT/
PLT_BEFORE_GOT combination.
(DATA_GOT, SDATA_GOT): Don't define if either is already defined.
ld/testsuite/
* ld-powerpc/ambiguousv1.d,
* ld-powerpc/ambiguousv1b.d,
* ld-powerpc/ambiguousv2.d,
* ld-powerpc/ambiguousv2b.d,
* ld-powerpc/elfv2exe.d,
* ld-powerpc/elfv2so.d,
* ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r,
* ld-powerpc/tlstocso.r: Update.
2015-01-20 07:49:15 +01:00
|
|
|
|
2015-01-20 Alan Modra <amodra@gmail.com>
|
|
|
|
|
|
|
|
|
|
* ld-powerpc/ambiguousv1.d,
|
|
|
|
|
* ld-powerpc/ambiguousv1b.d,
|
|
|
|
|
* ld-powerpc/ambiguousv2.d,
|
|
|
|
|
* ld-powerpc/ambiguousv2b.d,
|
|
|
|
|
* ld-powerpc/elfv2exe.d,
|
|
|
|
|
* ld-powerpc/elfv2so.d,
|
|
|
|
|
* ld-powerpc/tlsexe.r,
|
|
|
|
|
* ld-powerpc/tlsexetoc.r,
|
|
|
|
|
* ld-powerpc/tlsso.r,
|
|
|
|
|
* ld-powerpc/tlstocso.r: Update.
|
|
|
|
|
|
2015-01-20 01:41:38 +01:00
|
|
|
|
2015-01-20 Alan Modra <amodra@gmail.com>
|
|
|
|
|
|
|
|
|
|
PR ld/17615
|
|
|
|
|
* ld-elf/pr17615.d: Match .sbss too.
|
|
|
|
|
|
2015-01-19 18:23:29 +01:00
|
|
|
|
2015-01-19 H.J. Lu <hongjiu.lu@intel.com>
|
|
|
|
|
|
|
|
|
|
PR ld/17615
|
|
|
|
|
* ld-elf/pr17615.d: New file.
|
|
|
|
|
* ld-elf/pr17615.s: Likewise.
|
|
|
|
|
|
Fix garbage collection of common symbols
Running lang_common before garbage collection means slightly less work
in garbage collection code, since common symbols should no longer
appear there. It does have the side effect of keeping linker script
symbols (at least those defined outside of sections) global too,
hence some testsuite churn.
bfd/
PR 17165
* elf-bfd.h (ELF_COMMON_DEF): Note that this might be true for
linker script assignments too.
* elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
(bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
ld/
PR 17165
* ldlang.c (lang_process): Run lang_common before lang_gc_sections.
ld/testsuite/
* ld-gc/pr14265.d,
* ld-cris/tls-gc-68.d,
* ld-cris/tls-gc-69.d,
* ld-cris/tls-gc-70.d,
* ld-cris/tls-gc-71.d,
* ld-cris/tls-gc-75.d,
* ld-cris/tls-gc-76.d,
* ld-cris/tls-gc-79.d,
* ld-mmix/bpo-10.d,
* ld-mmix/bpo-11.d: Update.
2015-01-17 12:03:43 +01:00
|
|
|
|
2015-01-19 Alan Modra <amodra@gmail.com>
|
|
|
|
|
|
|
|
|
|
* ld-gc/pr14265.d,
|
|
|
|
|
* ld-cris/tls-gc-68.d,
|
|
|
|
|
* ld-cris/tls-gc-69.d,
|
|
|
|
|
* ld-cris/tls-gc-70.d,
|
|
|
|
|
* ld-cris/tls-gc-71.d,
|
|
|
|
|
* ld-cris/tls-gc-75.d,
|
|
|
|
|
* ld-cris/tls-gc-76.d,
|
|
|
|
|
* ld-cris/tls-gc-79.d,
|
|
|
|
|
* ld-mmix/bpo-10.d,
|
|
|
|
|
* ld-mmix/bpo-11.d: Update.
|
|
|
|
|
|
2015-01-16 12:19:21 +01:00
|
|
|
|
2015-01-16 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
|
* ld-s390/tlsbin.dd: The nopr register operand is optional and not
|
|
|
|
|
printed if 0 anymore.
|
|
|
|
|
|
2015-01-15 20:06:33 +01:00
|
|
|
|
2015-01-15 H.J. Lu <hongjiu.lu@intel.com>
|
|
|
|
|
|
|
|
|
|
PR ld/17847
|
|
|
|
|
* ld-x86-64/pie1.d: New file.
|
|
|
|
|
* ld-x86-64/pie1.s: Likwise.
|
|
|
|
|
* ld-x86-64/x86-64.exp: Run pie1.
|
|
|
|
|
|
2015-01-13 12:36:54 +01:00
|
|
|
|
2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
|
|
|
|
|
|
|
|
|
* ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test.
|
|
|
|
|
* ld-aarch64/relocs-257-symbolic-func.d: New file.
|
|
|
|
|
* ld-aarch64/relocs-257-symbolic-func.s: Likewise.
|
|
|
|
|
|
2015-01-13 12:21:43 +01:00
|
|
|
|
2015-01-13 Jiong Wang <jiong.wang@arm.com>
|
|
|
|
|
|
|
|
|
|
* ld-aarch64/tprel_g2_overflow.s: New testcase.
|
|
|
|
|
* ld-aarch64/tprel_g2_overflow.d: New expectation file.
|
|
|
|
|
* ld-aarch64/aarch64-elf.exp: Run new testcase.
|
|
|
|
|
|
2015-01-13 12:18:10 +01:00
|
|
|
|
2015-01-13 Jiong Wang <jiong.wang@arm.com>
|
|
|
|
|
|
|
|
|
|
PR ld/17415
|
|
|
|
|
* ld-aarch64/pr17415.s: Source file for new test.
|
|
|
|
|
* ld-aarch64/pr17415.d: Expect file for new test.
|
|
|
|
|
* ld-aarch64/aarch64-elf.exp: Run the new test.
|
|
|
|
|
|
2015-01-11 17:04:27 +01:00
|
|
|
|
2015-01-11 H.J. Lu <hongjiu.lu@intel.com>
|
|
|
|
|
|
|
|
|
|
PR ld/17827
|
|
|
|
|
* ld-x86-64/pr17689.out: Updated.
|
|
|
|
|
* ld-x86-64/pr17689b.S: Likewise.
|
|
|
|
|
|
|
|
|
|
* ld-x86-64/pr17827.rd: New file.
|
|
|
|
|
|
|
|
|
|
* ld-x86-64/x86-64.exp: Run PR ld/17827 test.
|
|
|
|
|
|
2015-01-08 14:10:36 +01:00
|
|
|
|
2015-01-08 Jan Beulich <jbeulich@suse.com>
|
|
|
|
|
|
|
|
|
|
* ld-x86-64/pr14207.d: Adjust expecations to cover the
|
|
|
|
|
enable_initfini_array=no case.
|
|
|
|
|
|
2015-01-06 16:58:57 +01:00
|
|
|
|
2015-01-06 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* lib/ld-lib.exp (run_dump_test): Extend comment to mention
|
|
|
|
|
readelf.
|
|
|
|
|
|
2015-01-01 15:15:26 +01:00
|
|
|
|
2015-01-01 Alan Modra <amodra@gmail.com>
|
2014-12-31 04:09:11 +01:00
|
|
|
|
|
2015-01-01 15:15:26 +01:00
|
|
|
|
Update year range in copyright notice of all files.
|
2014-12-31 04:09:11 +01:00
|
|
|
|
|
2015-01-01 15:15:26 +01:00
|
|
|
|
For older changes see ChangeLog-2014
|
2004-01-02 12:16:21 +01:00
|
|
|
|
|
2015-01-01 15:15:26 +01:00
|
|
|
|
Copyright (C) 2015 Free Software Foundation, Inc.
|
2012-12-10 13:48:03 +01:00
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
2004-01-02 12:16:21 +01:00
|
|
|
|
Local Variables:
|
|
|
|
|
mode: change-log
|
|
|
|
|
left-margin: 8
|
|
|
|
|
fill-column: 74
|
|
|
|
|
version-control: never
|
|
|
|
|
End:
|