aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog26
-rw-r--r--bfd/bfd-in.h4
-rw-r--r--bfd/bfd-in2.h4
-rw-r--r--bfd/elf-bfd.h5
-rw-r--r--bfd/elflink.c35
-rw-r--r--ld/ChangeLog20
-rw-r--r--ld/emultempl/elf32.em93
-rw-r--r--ld/ld.texinfo22
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-elf/audit.exp65
-rw-r--r--ld/testsuite/ld-elf/audit.rd3
-rw-r--r--ld/testsuite/ld-elf/depaudit.rd3
-rw-r--r--ld/testsuite/ld-elf/depaudit2.rd3
13 files changed, 275 insertions, 19 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 09194ce..8e108ac 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,15 @@
+2009-09-23 Matt Rice <ratmice@gmail.com>
+
+ * bfd-in.h (bfd_elf_size_dynamic_sections): Add audit and depaudit
+ arguments.
+ * elflink.c (bfd_elf_size_dynamic_sections): Generate DT_AUDIT,
+ DT_DEPAUDIT from audit/depaudit arguments.
+ (elf_finalize_dynstr): Finalize DT_AUDIT and DT_DEPAUDIT strtab entries.
+ (elf_link_add_object_symbols): Set dt_audit target data when finding a
+ DT_AUDIT.
+ * bfd-in2.h: Regenerate.
+ * bfd-elf.h: Add dt_audit to elf_obj_tdata, and elf_dt_audit macro.
+
2009-09-23 Jie Zhang <jie.zhang@analog.com>
* elf32-bfin.c (_bfinfdpic_size_got_plt): Make sure empty
@@ -110,7 +122,7 @@
assignments in test.
2009-09-16 Tristan Gingold <gingold@adacore.com>
-
+
* mach-o.h (bfd_mach_o_filetype): Add new constants from darwin10.
Reindent.
* mach-o.c (bfd_mach_o_cpu_name): Reindent.
@@ -625,7 +637,7 @@
bfinfdpic_gc_sweep_hook, bfinfdpic_check_relocs,
bfin_finish_dynamic_symbol, bfd_bfin_elf32_create_embedded_relocs):
Adjust to match the renamed reloc definitions.
-
+
2009-08-08 Alan Modra <amodra@bigpond.net.au>
PR 10494
@@ -1146,7 +1158,7 @@
(bfd_mach_o_print_thread): Define.
* mach-o.c (text_section_names_xlat): Add an entry for __const.
- (bfd_mach_o_canonicalize_one_reloc, bfd_mach_o_canonicalize_relocs):
+ (bfd_mach_o_canonicalize_one_reloc, bfd_mach_o_canonicalize_relocs):
New functions extracted from ...
(bfd_mach_o_canonicalize_reloc): ... This. Simplified.
(bfd_mach_o_get_dynamic_reloc_upper_bound): New function.
@@ -1793,7 +1805,7 @@
(bfd_mach_o_scan_read_dysymtab_symbol): Ditto.
(bfd_mach_o_get_reloc_upper_bound): New prototype.
(bfd_mach_o_canonicalize_reloc): Ditto.
-
+
* mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove
duplicated macro. Now defined to _bfd_generic_is_local_label.
(TARGET_NAME_BACKEND): New macro...
@@ -1830,15 +1842,15 @@
Clean up copyright notice.
2009-06-10 Paul Pluzhnikov <ppluzhnikov@google.com>
-
+
* bfd-in2.h: bfd_mmap prototype.
* bfdio.c (bfd_mmap): New function.
* libbfd.h (bfd_iovec): Add bmmap.
* cache.c (cache_bmmap): New function.
(cache_iovec): Initialize bmmap member.
* opencls.c (opncls_bmmap): New function.
- (opncls_iovec): Initialize bmmap member.
-
+ (opncls_iovec): Initialize bmmap member.
+
2009-06-09 Tristan Gingold <gingold@adacore.com>
* mach-o.h (bfd_mach_o_symtab_command): Remove stabs_segment
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 516102e..c3d2d97 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -635,8 +635,8 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list
extern bfd_boolean bfd_elf_get_bfd_needed_list
(bfd *, struct bfd_link_needed_list **);
extern bfd_boolean bfd_elf_size_dynamic_sections
- (bfd *, const char *, const char *, const char *, const char * const *,
- struct bfd_link_info *, struct bfd_section **,
+ (bfd *, const char *, const char *, const char *, const char *, const char *,
+ const char * const *, struct bfd_link_info *, struct bfd_section **,
struct bfd_elf_version_tree *);
extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
(bfd *, struct bfd_link_info *);
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 40d3b7a..b5fceb7 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -642,8 +642,8 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list
extern bfd_boolean bfd_elf_get_bfd_needed_list
(bfd *, struct bfd_link_needed_list **);
extern bfd_boolean bfd_elf_size_dynamic_sections
- (bfd *, const char *, const char *, const char *, const char * const *,
- struct bfd_link_info *, struct bfd_section **,
+ (bfd *, const char *, const char *, const char *, const char *, const char *,
+ const char * const *, struct bfd_link_info *, struct bfd_section **,
struct bfd_elf_version_tree *);
extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
(bfd *, struct bfd_link_info *);
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3f2d528..7cc420c 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1503,6 +1503,10 @@ struct elf_obj_tdata
one. */
const char *dt_name;
+ /* The linker emulation needs to know what audit libs
+ are used by a dynamic object. */
+ const char *dt_audit;
+
/* Records the result of `get_program_header_size'. */
bfd_size_type program_header_size;
@@ -1632,6 +1636,7 @@ struct elf_obj_tdata
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
+#define elf_dt_audit(bfd) (elf_tdata(bfd) -> dt_audit)
#define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class)
#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
diff --git a/bfd/elflink.c b/bfd/elflink.c
index c42c6e1..b99acea 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3234,6 +3234,8 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
case DT_RUNPATH:
case DT_FILTER:
case DT_AUXILIARY:
+ case DT_AUDIT:
+ case DT_DEPAUDIT:
dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
break;
default:
@@ -3525,6 +3527,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
asection *s;
const char *soname = NULL;
+ char *audit = NULL;
struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
int ret;
@@ -3653,6 +3656,11 @@ error_free_dyn:
;
*pn = n;
}
+ if (dyn.d_tag == DT_AUDIT)
+ {
+ unsigned int tagv = dyn.d_un.d_val;
+ audit = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
+ }
}
free (dynbuf);
@@ -3705,6 +3713,9 @@ error_free_dyn:
particular dynamic object more than once. */
if (ret > 0)
return TRUE;
+
+ /* Save the DT_AUDIT entry for the linker emulation code. */
+ elf_dt_audit (abfd) = audit;
}
/* If this is a dynamic object, we always link against the .dynsym
@@ -5451,6 +5462,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
const char *soname,
const char *rpath,
const char *filter_shlib,
+ const char *audit,
+ const char *depaudit,
const char * const *auxiliary_filters,
struct bfd_link_info *info,
asection **sinterpptr,
@@ -5603,6 +5616,28 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
}
}
+ if (audit != NULL)
+ {
+ bfd_size_type indx;
+
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, audit,
+ TRUE);
+ if (indx == (bfd_size_type) -1
+ || !_bfd_elf_add_dynamic_entry (info, DT_AUDIT, indx))
+ return FALSE;
+ }
+
+ if (depaudit != NULL)
+ {
+ bfd_size_type indx;
+
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, depaudit,
+ TRUE);
+ if (indx == (bfd_size_type) -1
+ || !_bfd_elf_add_dynamic_entry (info, DT_DEPAUDIT, indx))
+ return FALSE;
+ }
+
eif.info = info;
eif.verdefs = verdefs;
eif.failed = FALSE;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 0bcb74d..7e8c310 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2009-09-23 Matt Rice <ratmice@gmail.com>
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_add_options): Add --audit,
+ --depaudit, and -P options.
+ (gld${EULATION_NAME}_handle_options): Ditto.
+ (gld${EULATION_NAME}_list_options): Ditto.
+ (gld${EMULATION_NAME}_append_to_separated_string): New function for
+ handling rpath-like colon separated strings.
+ (gld${EMULATION_NAME}_before_allocation): Pass the audit and depaudit
+ libs to bfd. Propagate DT_AUDIT from needed libs to depaudit.
+ * ld.texinfo: Document new options.
+
2009-09-23 Nick Clifton <nickc@redhat.com>
* po/vi.po: Updated Vietnamese translation.
@@ -311,13 +323,13 @@
2009-08-06 Michael Eager <eager@eagercon.com>
- * Makefile.am: Add eelf32mb_linux.o, eelf32microblaze.o to
+ * Makefile.am: Add eelf32mb_linux.o, eelf32microblaze.o to
ALL_EMULATIONS, targets.
* Makefile.in: Regenerate.
* configure.tgt: Add microblaze*-linux*, microblaze* targets.
* emulparams/elf32mb_linux.sh: New.
* emulparams/elf32microblaze.sh. New.
- * scripttempl/elfmicroblaze.sc: New.
+ * scripttempl/elfmicroblaze.sc: New.
2009-08-05 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
@@ -408,7 +420,7 @@
* scripttempl/pep.sc: Put .eh_frame in its own section.
* scripttempl/pe.sc: Ditto.
-
+
2009-06-26 Kai Tietz <kai.tietz@onevision.com>
* scripttempl/pe.sc (.debug_pubtypes): Added section rule.
@@ -941,7 +953,7 @@
2009-02-24 Sandra Loosemore <sandra@codesourcery.com>
* ld.texinfo (Options): Correct typos in example. Recommend
- using joined forms of syntax for passing options with arguments
+ using joined forms of syntax for passing options with arguments
from a driver.
(-a): Use consistent syntax for documenting option arguments.
Clean up indexing and markup.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 9518714..f7b70ac 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -157,6 +157,10 @@ static lang_input_statement_type *global_found;
static struct bfd_link_needed_list *global_vercheck_needed;
static bfd_boolean global_vercheck_failed;
+/* These variables are used to implement target options */
+
+static char *audit; /* colon (typically) separated list of libs */
+static char *depaudit; /* colon (typically) separated list of libs */
/* On Linux, it's possible to have different versions of the same
shared library linked against different versions of libc. The
@@ -1396,6 +1400,46 @@ if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation;
fi
fragment <<EOF
+/* used by before_allocation and handle_option. */
+static void
+gld${EMULATION_NAME}_append_to_separated_string (char **to, char *optarg)
+{
+ if (*to == NULL)
+ *to = xstrdup (optarg);
+ else
+ {
+ size_t to_len = strlen (*to);
+ size_t optarg_len = strlen (optarg);
+ char *buf;
+ char *cp = *to;
+
+ /* First see whether OPTARG is already in the path. */
+ do
+ {
+ if (strncmp (optarg, cp, optarg_len) == 0
+ && (cp[optarg_len] == 0
+ || cp[optarg_len] == config.rpath_separator))
+ /* We found it. */
+ break;
+
+ /* Not yet found. */
+ cp = strchr (cp, config.rpath_separator);
+ if (cp != NULL)
+ ++cp;
+ }
+ while (cp != NULL);
+
+ if (cp == NULL)
+ {
+ buf = xmalloc (to_len + optarg_len + 2);
+ sprintf (buf, "%s%c%s", *to,
+ config.rpath_separator, optarg);
+ free (*to);
+ *to = buf;
+ }
+ }
+}
+
/* This is called after the sections have been attached to output
sections, but before any sizes or addresses have been set. */
@@ -1404,6 +1448,7 @@ gld${EMULATION_NAME}_before_allocation (void)
{
const char *rpath;
asection *sinterp;
+ bfd *abfd;
if (link_info.hash->type == bfd_link_elf_hash_table)
_bfd_elf_tls_setup (link_info.output_bfd, &link_info);
@@ -1418,9 +1463,39 @@ gld${EMULATION_NAME}_before_allocation (void)
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+
+ for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
+ {
+ const char *audit_libs = elf_dt_audit (abfd);
+
+ /* If the input bfd contains an audit entry, we need to add it as
+ a dep audit entry. */
+ if (audit_libs && *audit_libs != '\0')
+ {
+ char *cp = xstrdup (audit_libs);
+ do
+ {
+ int more = 0;
+ char *cp2 = strchr (cp, config.rpath_separator);
+
+ if (cp2)
+ {
+ *cp2 = '\0';
+ more = 1;
+ }
+
+ if (cp != NULL && *cp != '\0')
+ gld${EMULATION_NAME}_append_to_separated_string (&depaudit, cp);
+
+ cp = more ? ++cp2 : NULL;
+ }
+ while (cp != NULL);
+ }
+ }
+
if (! (bfd_elf_size_dynamic_sections
(link_info.output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
+ command_line.filter_shlib, audit, depaudit,
(const char * const *) command_line.auxiliary_filters,
&link_info, &sinterp, lang_elf_version_info)))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
@@ -2007,15 +2082,18 @@ fragment <<EOF
#define OPTION_EXCLUDE_LIBS (OPTION_EH_FRAME_HDR + 1)
#define OPTION_HASH_STYLE (OPTION_EXCLUDE_LIBS + 1)
#define OPTION_BUILD_ID (OPTION_HASH_STYLE + 1)
+#define OPTION_AUDIT (OPTION_BUILD_ID + 1)
static void
gld${EMULATION_NAME}_add_options
(int ns, char **shortopts, int nl, struct option **longopts,
int nrl ATTRIBUTE_UNUSED, struct option **really_longopts ATTRIBUTE_UNUSED)
{
- static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:";
+ static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:P:";
static const struct option xtra_long[] = {
{"build-id", optional_argument, NULL, OPTION_BUILD_ID},
+ {"audit", required_argument, NULL, OPTION_AUDIT},
+ {"depaudit", required_argument, NULL, 'P'},
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
@@ -2067,6 +2145,12 @@ gld${EMULATION_NAME}_handle_option (int optc)
if (strcmp (optarg, "none"))
link_info.emit_note_gnu_build_id = xstrdup (optarg);
break;
+ case OPTION_AUDIT:
+ gld${EMULATION_NAME}_append_to_separated_string (&audit, optarg);
+ break;
+ case 'P':
+ gld${EMULATION_NAME}_append_to_separated_string (&depaudit, optarg);
+ break;
EOF
@@ -2218,6 +2302,11 @@ gld${EMULATION_NAME}_list_options (FILE * file)
{
fprintf (file, _("\
--build-id[=STYLE] Generate build ID note\n"));
+ fprintf (file, _("\
+ --audit=AUDITLIB Specify a library to use for auditing\n"));
+ fprintf (file, _("\
+ -P AUDITLIB, --depaudit=AUDITLIB\n" "\
+ Specify a library to use for auditing dependencies\n"));
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index dca4068..e17d3fc 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -364,6 +364,17 @@ argument must be one of the strings @samp{archive}, @samp{shared}, or
@samp{-Bstatic}, and the other two keywords are functionally equivalent
to @samp{-Bdynamic}. This option may be used any number of times.
+@kindex --audit @var{AUDITLIB}
+@item --audit @var{AUDITLIB}
+Adds @var{AUDITLIB} to the @code{DT_AUDIT} entry of the dynamic section.
+@var{AUDITLIB} is not checked for existence, nor will it use the DT_SONAME
+specified in the library. If specified multiple times @code{DT_AUDIT}
+will contain a colon separated list of audit interfaces to use. If the linker
+finds an object with an audit entry while searching for shared libraries,
+it will add a corresponding @code{DT_DEPAUDIT} entry in the output file.
+This option is only meaningful on ELF platforms supporting the rtld-audit
+interface.
+
@ifset I960
@cindex architectures
@kindex -A @var{arch}
@@ -451,6 +462,17 @@ even if a relocatable output file is specified (with @samp{-r}). The
script command @code{FORCE_COMMON_ALLOCATION} has the same effect.
@xref{Miscellaneous Commands}.
+@kindex --depaudit @var{AUDITLIB}
+@kindex -P @var{AUDITLIB}
+@item --depaudit @var{AUDITLIB}
+@itemx -P @var{AUDITLIB}
+Adds @var{AUDITLIB} to the @code{DT_DEPAUDIT} entry of the dynamic section.
+@var{AUDITLIB} is not checked for existence, nor will it use the DT_SONAME
+specified in the library. If specified multiple times @code{DT_DEPAUDIT}
+will contain a colon separated list of audit interfaces to use. This
+option is only meaningful on ELF platforms supporting the rtld-audit interface.
+The -P option is provided for Solaris compatibility.
+
@cindex entry point, from command line
@kindex -e @var{entry}
@kindex --entry=@var{entry}
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 3ac902d..32d11f3 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2009-09-23 Matt Rice <ratmice@gmail.com>
+
+ * ld-elf/audit.exp: New.
+ * ld-elf/audit.rd: New.
+ * ld-elf/depaudit.rd: New.
+ * ld-elf/depaudit2.rd: New.
+
2009-09-23 Jie Zhang <jie.zhang@analog.com>
* ld-srec/srec.exp: Add xfails for bfin-*-linux-uclibc.
@@ -136,7 +143,7 @@
two new link tests.
* ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
* ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
- * ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
+ * ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r: Likewise.
@@ -792,7 +799,7 @@
* ld-arm/arm-elf.exp (armeabitests): Add thumb2-bl-blx-interwork test.
* ld-arm/thumb2-bl-blx-interwork.s: New.
- * ld-arm/thumb2-bl-blx-interwork.d: New.
+ * ld-arm/thumb2-bl-blx-interwork.d: New.
2009-04-30 Nick Clifton <nickc@redhat.com>
diff --git a/ld/testsuite/ld-elf/audit.exp b/ld/testsuite/ld-elf/audit.exp
new file mode 100644
index 0000000..407c61a
--- /dev/null
+++ b/ld/testsuite/ld-elf/audit.exp
@@ -0,0 +1,65 @@
+# Expect script for various ELF tests.
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+# Check if compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+set build_tests {
+ {"Run with -paudit.so"
+ "-Wl,--audit=tmpdir/audit.so" ""
+ {main.c} {{"readelf" {-d} "audit.rd"}} "audit.out"}
+ {"Run with -Paudit.so"
+ "-Wl,-Ptmpdir/audit.so" ""
+ {main.c} {{"readelf" {-d} "depaudit.rd"}} "depaudit.out"}
+ {"Run with --depaudit=audit.so"
+ "-Wl,--depaudit=tmpdir/audit.so" ""
+ {main.c} {{"readelf" {-d} "depaudit.rd"}} "depaudit2.out"}
+ {"Run with shared with --audit"
+ "-shared -Wl,--audit=tmpdir/audit.so" "-fPIC"
+ {main.c} {} "libusesaudit.so"}
+ {"Run with shared with --audit"
+ "-shared -Wl,--audit=tmpdir/audit.so -Wl,--audit=tmpdir/audit2.so \
+ -Wl,--audit=tmpdir/audit3.so"
+ "-fPIC"
+ {main.c} {} "libusesaudit2.so"}
+ {"Run with -lusesaudit"
+ "-Ltmpdir/ -lusesaudit" ""
+ {main.c} {{"readelf" {-d} "depaudit.rd"}} "useslibusesaudit.out"}
+ {"Run with -lusesaudit -lusesaudit2"
+ "-Ltmpdir/ -lusesaudit -lusesaudit2" ""
+ {main.c} {{"readelf" {-d} "depaudit2.rd"}} "useslibusesaudit2.out"}
+}
+
+run_cc_link_tests $build_tests
+
diff --git a/ld/testsuite/ld-elf/audit.rd b/ld/testsuite/ld-elf/audit.rd
new file mode 100644
index 0000000..fd3b941
--- /dev/null
+++ b/ld/testsuite/ld-elf/audit.rd
@@ -0,0 +1,3 @@
+#...
+.*Audit library: \[tmpdir/audit.so\].*
+#pass
diff --git a/ld/testsuite/ld-elf/depaudit.rd b/ld/testsuite/ld-elf/depaudit.rd
new file mode 100644
index 0000000..98a2692
--- /dev/null
+++ b/ld/testsuite/ld-elf/depaudit.rd
@@ -0,0 +1,3 @@
+#...
+.*Dependency audit library: \[tmpdir/audit.so\].*
+#pass
diff --git a/ld/testsuite/ld-elf/depaudit2.rd b/ld/testsuite/ld-elf/depaudit2.rd
new file mode 100644
index 0000000..3554416
--- /dev/null
+++ b/ld/testsuite/ld-elf/depaudit2.rd
@@ -0,0 +1,3 @@
+#...
+.*Dependency audit library: \[tmpdir/audit.so:tmpdir/audit2.so:tmpdir/audit3.so\].*
+#pass