This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/2] ld: PROVIDE, undefined symbols, and mapfiles.

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.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]