binutils-gdb/ld/testsuite/ld-elf/audit.exp
Alan Modra 7ee314faa4 bfd/
* 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.
ld/
	* 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.
ld/testsuite/
	* ld-elf/audit.exp: New.
	* ld-elf/audit.rd: New.
	* ld-elf/depaudit.rd: New.
	* ld-elf/depaudit2.rd: New.
2009-09-23 13:54:29 +00:00

66 lines
2.1 KiB
Plaintext

# 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