Browse Source
Prior to
commit 1e3b96fd6c
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.
gdb-10-branch
7 changed files with 99 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||
#... |
|||
.*: tmpdir/libpr26590b.so: undefined reference to `f1' |
|||
#pass |
|||
@ -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; |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
int select (void) { return 2; } |
|||
|
|||
extern int f1 (int); |
|||
|
|||
int f2 (int x) |
|||
{ |
|||
if (x > 0) |
|||
return x * f1 (x - 1); |
|||
return 22222; |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
#include <stdio.h> |
|||
|
|||
extern int select (); |
|||
extern int f2 (int); |
|||
|
|||
int main (void) |
|||
{ |
|||
if (select () == 0 && f2 (0) == 22222) |
|||
printf ("PASS\n"); |
|||
return 0; |
|||
} |
|||
@ -0,0 +1 @@ |
|||
int select (void) { return 0; } |
|||
Loading…
Reference in new issue