This is the mail archive of the binutils@sourceware.org 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/4] Allow EXCLUDE_FILE outside section list


My interest in EXCLUDE_FILE started with the question, why does this
construct, placed within the SECTIONS part of a linker script:

   * ( EXCLUDE_FILE (foo.o) .text .text.blah )

still allow the .text.blah section for foo.o to be included.  It turns
out that the EXCLUDE_FILE only applies to the next section within the
section list, this wasn't explained in the manual, which lead to this
patch:

  https://sourceware.org/ml/binutils/2016-09/msg00130.html

Having updated the manual, the next question was, is there a neater
way to exclude both .text and .text.blah than this:

   * ( EXCLUDE_FILE (foo.o) .text EXCLUDE_FILE (foo.o) .text.blah )

the manual didn't offer any advice, so I took a look at the linker
grammar file, which suggested that the following construct was valid
in a linker script, and I wondered if this was what I was looking for:

   EXCLUDE_FILE (foo.o) * ( .text .text.blah )

I tried this, and it is accepted by the linker, but it didn't seem to
help.  I dug a little deeper, and it turns out that though this is
valid grammar, it really doesn't do anything.

So, we probably should do something with the second EXCLUDE_FILE
syntax, having it accepted but meaningless could cause confusion.

What I'd like to do is make the second EXCLUDE_FILE apply over the
entire section list, and this is what this patch series does.

In summary the patches do the following:

1. Renames a rule within the linker grammar, this is just a small
   cleanup.

2. While testing this series I noticed that the xc16x-elf target was
   failing most tests due to a minor error.  Fixed in this patch.

3. In order to test EXCLUDE_FILE it's nicer if the linker test
   framework doesn't name all the object files dump0.o, dump1.o, etc.
   This patch makes the linker test framework give the object files
   better names, based on the source file name.

4. Finally, the last patch gives meaning to EXCLUDE_FILE when it
   appears outside the section list.

Thanks,
Andrew

---

Andrew Burgess (4):
  ld: Rename pattern within yacc grammar file
  ld/xc16x: This target does not support -shared
  ld: Create test object files based on source file name
  ld: Allow EXCLUDE_FILE to be used outside of the section list

 ld/ChangeLog                               | 48 ++++++++++++++++++++++++
 ld/NEWS                                    |  4 ++
 ld/ld.texinfo                              | 28 +++++++++++---
 ld/ldgram.y                                | 14 +++----
 ld/ldlang.c                                | 59 ++++++++++++++++++++++--------
 ld/ldlang.h                                |  1 +
 ld/testsuite/ld-discard/extern.d           |  2 +-
 ld/testsuite/ld-discard/start.d            |  2 +-
 ld/testsuite/ld-discard/static.d           |  2 +-
 ld/testsuite/ld-elf/orphan-8.map           |  4 +-
 ld/testsuite/ld-scripts/exclude-file-1.d   |  5 +++
 ld/testsuite/ld-scripts/exclude-file-1.map |  8 ++++
 ld/testsuite/ld-scripts/exclude-file-1.t   | 10 +++++
 ld/testsuite/ld-scripts/exclude-file-2.d   |  5 +++
 ld/testsuite/ld-scripts/exclude-file-2.map |  7 ++++
 ld/testsuite/ld-scripts/exclude-file-2.t   | 10 +++++
 ld/testsuite/ld-scripts/exclude-file-3.d   |  5 +++
 ld/testsuite/ld-scripts/exclude-file-3.map |  7 ++++
 ld/testsuite/ld-scripts/exclude-file-3.t   | 10 +++++
 ld/testsuite/ld-scripts/exclude-file-4.d   |  5 +++
 ld/testsuite/ld-scripts/exclude-file-4.map |  7 ++++
 ld/testsuite/ld-scripts/exclude-file-4.t   | 10 +++++
 ld/testsuite/ld-scripts/exclude-file-a.s   |  5 +++
 ld/testsuite/ld-scripts/exclude-file-b.s   |  5 +++
 ld/testsuite/ld-scripts/exclude-file.exp   | 32 ++++++++++++++++
 ld/testsuite/lib/ld-lib.exp                | 23 +++++++++++-
 26 files changed, 283 insertions(+), 35 deletions(-)
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-1.d
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-1.map
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-1.t
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-2.d
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-2.map
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-2.t
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-3.d
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-3.map
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-3.t
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-4.d
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-4.map
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-4.t
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-a.s
 create mode 100644 ld/testsuite/ld-scripts/exclude-file-b.s
 create mode 100644 ld/testsuite/ld-scripts/exclude-file.exp

-- 
2.5.1


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