[PATCH v2] ld: Find files relative to the current linker script for INPUT() and GROUP()

Nick Clifton nickc@redhat.com
Wed Apr 22 15:41:12 GMT 2020


Hi Fangrui,

  Thanks - I have applied your v2 patch.

> # RUN: rm -rf %t.dir && mkdir %t.dir && cd %t.dir
> [...]

It sounds like the run_ld_link_tests proc will do most of
what you need.  (See ld/testsuite/lib/ld-lib.exp).  Something like:

  run_ld_link_tests [list \
    [list "Build libb.a" "rc" "" "" {b1.s b2.s} {} "tmpdir/libb.a"] \
    [list "Link with script in TMPDIR that INPUTS libb.a", "-T tmpdir/script.t" "" "" {a.s} {} "test.exe"] \
  ]

I have not actually tested this, but I think that it shows what might work.
Take a look in ld/testsuite/ld-x86_64/x86_64.exp for examples of using
run_ld_link_tests to build libraries and then test them.

You might also need to use "exec cp ..." to copy the linker script into
the temporary directory.  See ld/testsuite/ld-elfvers/vers.exp for an
example of copying a file.

Cheers
  Nick




More information about the Binutils mailing list