diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-09-10 07:52:03 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-09-10 07:52:20 -0700 |
commit | 93d49941edbb5274bee6ce3e547a07c7ce4c4301 (patch) | |
tree | 9e66ff2bbcbe51f28f785c2de76638b2738d5bac /ld/testsuite/ld-elf/pr26590a.c | |
parent | 918619e5e591c492b1a67f8ce125aa8728eb4497 (diff) | |
download | gdb-93d49941edbb5274bee6ce3e547a07c7ce4c4301.zip gdb-93d49941edbb5274bee6ce3e547a07c7ce4c4301.tar.gz gdb-93d49941edbb5274bee6ce3e547a07c7ce4c4301.tar.bz2 |
ld: Add more tests for --as-needed
Prior to
commit 1e3b96fd6cf0c7d018083994ad951ccf92aba582
Author: Alan Modra <amodra@gmail.com>
Date: Fri Sep 4 13:54:21 2020 +0930
Allow plugin syms to mark as-needed shared libs needed
when removing unused IR symbol references, ld didn't add unnecessary
DT_NEEDED libraries which may lead to undefined symbol reference in a
--as-needed library when the symbol is defined in a prior --as-needed
library and there is no reference in relocatable inputs. This behavior
is desirable since it ensures that both lazy and non-lazy bindings work
the same way. The problem is with --as-needed libraries, which happens
with and without LTO. Now, the linker may add many unnecessary DT_NEEDED
libraries for IR inputs.
PR ld/26590
* testsuite/ld-elf/pr26590.err: New file.
* testsuite/ld-elf/pr26590a.c: Likewise.
* testsuite/ld-elf/pr26590b.c: Likewise.
* testsuite/ld-elf/pr26590c.c: Likewise.
* testsuite/ld-elf/pr26590d.c: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/26590 tests.
Diffstat (limited to 'ld/testsuite/ld-elf/pr26590a.c')
-rw-r--r-- | ld/testsuite/ld-elf/pr26590a.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/pr26590a.c b/ld/testsuite/ld-elf/pr26590a.c new file mode 100644 index 0000000..0ae3a20 --- /dev/null +++ b/ld/testsuite/ld-elf/pr26590a.c @@ -0,0 +1,10 @@ +int select (void) { return 1; } + +extern int f2 (int); + +int f1 (int x) +{ + if (x > 0) + return x * f2 (x - 1); + return 1; +} |