public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ld: PROVIDE, undefined symbols, and mapfiles.
@ 2015-01-07 12:15 Andrew Burgess
  2015-01-07 12:15 ` [PATCH 2/2] ld: Don't evaluate unneeded PROVIDE expressions Andrew Burgess
  2015-01-07 12:15 ` [PATCH 1/2] ld/testing: run_dump_test can now check linker mapfiles Andrew Burgess
  0 siblings, 2 replies; 16+ messages in thread
From: Andrew Burgess @ 2015-01-07 12:15 UTC (permalink / raw)
  To: binutils; +Cc: Andrew Burgess

Consider the following snippet of linker script:

  PROVIDE (foo = 0x10);
  PROVIDE (bar = foo);

If both 'foo' and 'bar' are not needed then both of these PROVIDE
statements will have no effect.

However, when creating a linker mapfile, the expressions in both
PROVIDE statements are, currently, evaluated.  This is fine for the
'foo' case, but in the 'bar' case the foo symbol is undefined, and so
we get a fatal, undefined symbol, error.

The first patch in this series adds a new option to run_dump_test
called 'map' that allows for easier testing of generated linker scripts.

The second patch resolves the above problem by not evaluating the
PROVIDE expression when the symbol being provided is not needed.

Thanks,
Andrew

Andrew Burgess (2):
  ld/testing: run_dump_test can now check linker mapfiles.
  ld: Don't evaluate unneeded PROVIDE expressions.

 ld/ChangeLog                             |  7 +++++++
 ld/ldlang.c                              | 14 +++++++++++--
 ld/testsuite/ChangeLog                   | 14 +++++++++++++
 ld/testsuite/ld-scripts/overlay-size.d   |  1 +
 ld/testsuite/ld-scripts/overlay-size.exp |  9 ---------
 ld/testsuite/ld-scripts/provide-4-map.d  | 26 ++++++++++++++++++++++++
 ld/testsuite/ld-scripts/provide-4.d      | 10 ++++++++++
 ld/testsuite/ld-scripts/provide-4.t      | 16 +++++++++++++++
 ld/testsuite/ld-scripts/provide.exp      |  1 +
 ld/testsuite/lib/ld-lib.exp              | 34 ++++++++++++++++++++++++++++++++
 10 files changed, 121 insertions(+), 11 deletions(-)
 create mode 100644 ld/testsuite/ld-scripts/provide-4-map.d
 create mode 100644 ld/testsuite/ld-scripts/provide-4.d
 create mode 100644 ld/testsuite/ld-scripts/provide-4.t

-- 
1.9.3

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-01-20 16:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 12:15 [PATCH 0/2] ld: PROVIDE, undefined symbols, and mapfiles Andrew Burgess
2015-01-07 12:15 ` [PATCH 2/2] ld: Don't evaluate unneeded PROVIDE expressions Andrew Burgess
2015-01-08  1:25   ` Hans-Peter Nilsson
2015-01-08 10:18     ` Andrew Burgess
2015-01-08 11:08       ` Hans-Peter Nilsson
2015-01-08 20:03         ` Andrew Burgess
2015-01-12  0:39           ` Alan Modra
2015-01-19 11:06             ` Andrew Burgess
2015-01-19 12:50               ` Alan Modra
2015-01-20 10:21               ` Andrew Burgess
2015-01-20 14:21               ` Hans-Peter Nilsson
2015-01-20 16:08                 ` Andrew Burgess
2015-01-07 12:15 ` [PATCH 1/2] ld/testing: run_dump_test can now check linker mapfiles Andrew Burgess
2015-01-08  1:21   ` Hans-Peter Nilsson
2015-01-08 10:16     ` Andrew Burgess
2015-01-12  0:38       ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).