aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-10-26 08:57:49 +1030
committerAlan Modra <amodra@gmail.com>2024-10-26 10:25:38 +1030
commit6ecc44f6980c0f8c0f0934bc10412c1d7fa3c544 (patch)
tree295df2ab4dbdc9efc584a5e87073bf754d85ff61 /ld/testsuite/ld-plugin
parent3d17c8817216343179f64d1a682311a70774ccb4 (diff)
downloadgdb-6ecc44f6980c0f8c0f0934bc10412c1d7fa3c544.zip
gdb-6ecc44f6980c0f8c0f0934bc10412c1d7fa3c544.tar.gz
gdb-6ecc44f6980c0f8c0f0934bc10412c1d7fa3c544.tar.bz2
PR32300, --dependency-file: link dependencies are not all collected
PR 32300 PR 31904 Revert patch accidentally committed with 057a2b4c4b
Diffstat (limited to 'ld/testsuite/ld-plugin')
-rw-r--r--ld/testsuite/ld-plugin/libdep-a.c7
-rw-r--r--ld/testsuite/ld-plugin/libdep-b.c5
-rw-r--r--ld/testsuite/ld-plugin/libdep-main.c7
-rw-r--r--ld/testsuite/ld-plugin/libdep.exp124
4 files changed, 0 insertions, 143 deletions
diff --git a/ld/testsuite/ld-plugin/libdep-a.c b/ld/testsuite/ld-plugin/libdep-a.c
deleted file mode 100644
index 5a01ce8..0000000
--- a/ld/testsuite/ld-plugin/libdep-a.c
+++ /dev/null
@@ -1,7 +0,0 @@
-extern int g (void);
-
-int
-f (void)
-{
- return g();
-}
diff --git a/ld/testsuite/ld-plugin/libdep-b.c b/ld/testsuite/ld-plugin/libdep-b.c
deleted file mode 100644
index d2ca7e0..0000000
--- a/ld/testsuite/ld-plugin/libdep-b.c
+++ /dev/null
@@ -1,5 +0,0 @@
-int
-g (void)
-{
- return 4;
-}
diff --git a/ld/testsuite/ld-plugin/libdep-main.c b/ld/testsuite/ld-plugin/libdep-main.c
deleted file mode 100644
index 7563a7d..0000000
--- a/ld/testsuite/ld-plugin/libdep-main.c
+++ /dev/null
@@ -1,7 +0,0 @@
-extern int f (void);
-
-int
-main (void)
-{
- return f();
-}
diff --git a/ld/testsuite/ld-plugin/libdep.exp b/ld/testsuite/ld-plugin/libdep.exp
deleted file mode 100644
index 83b0872..0000000
--- a/ld/testsuite/ld-plugin/libdep.exp
+++ /dev/null
@@ -1,124 +0,0 @@
-# Expect script for ld-plugin LIBDEP tests
-# Copyright (C) 2024 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.
-
-# These tests require the plugin API.
-if { ![check_plugin_api_available] } {
- return
-}
-
-# Check to see if the C compiler works
-# FIXME: This is being lazy, we could create assembler equivalents instead.
-if { ![check_compiler_available] } {
- return
-}
-
-proc run_test { } {
- global CC_FOR_TARGET
- global srcdir
- global subdir
- global ar
- global ld
- global libdep
- global base_dir
-
- set testname "libdep test"
-
- # Create temporary directories if they do not already exist.
- file mkdir -p libdep-a libdep-b
-
- # Delete old versions of the files we are about to build, just in case.
- file delete libdep-a/a.o libdep-a/liba.a libdep-b/b.o libdep-b/libc.a libdep-main.o
-
- # Build object files.
- if {![ld_compile $CC_FOR_TARGET $srcdir/$subdir/libdep-a.c libdep-a/a.o]} {
- fail "$testname: could not compile source file 1"
- return
- }
- if {![ld_compile $CC_FOR_TARGET $srcdir/$subdir/libdep-b.c libdep-b/b.o]} {
- fail "$testname: could not compile source file 2"
- return
- }
- if {![ld_compile $CC_FOR_TARGET $srcdir/$subdir/libdep-main.c libdep-main.o]} {
- fail "$testname: could not compile source file 3"
- return
- }
-
- # Create static archives from the objects.
-
- # For the first archive we add a libdep element that loads the second library.
- if {![ar_simple_create $ar {--record-libdeps "-Llibdep-b -lc"} libdep-a/liba.a libdep-a/a.o]} {
- fail "$testname: could not create archive 1"
- return
- }
-
- # For the second archive we choose a name - libc.a - that is likely to clash
- # with a system library. This will help to check that the library loaded by
- # following the libdep element in the first library is the one that we expect.
- if {![ar_simple_create $ar {} libdep-b/libc.a libdep-b/b.o]} {
- fail "$testname: could not create archive 2"
- return
- }
-
- # Find the libdep plugin.
- # Use libtool to find the path to the plugin rather
- # than worrying about run paths or anything like that.
- catch "exec $base_dir/libtool --config" lt_config
- verbose "Full lt config: $lt_config" 2
- # Look for "objdir=.libs"
- regexp -line "^objdir=.*$" "$lt_config" lt_objdir
- verbose "lt_objdir line is '$lt_objdir'" 2
- set lt_objdir [regsub "objdir=" "$lt_objdir" ""]
-
- if { [ file exists "$base_dir/$lt_objdir/libdep.so" ] } {
- set libdep_plugin "$base_dir/$lt_objdir/libdep.so"
- } else {
- # FIXME: Check in the system bfd-plugin directory ?
- fail "$testname - could not locate libdep plugin"
- return
- }
-
- verbose "Full plugin path: $libdep_plugin" 1
-
- # Link the main object file with the liba.a library.
- # Use the libdep plugin to read the __.LIBDEP element in the liba.a library
- # and so bring in the libdep-b.o object file from the libc.a library.
- # Failure to locate the libc.a library, or loading the wrong libc.a library
- # will result in an unresolved reference error.
- set exec_output [run_host_cmd "$ld" "-plugin $libdep_plugin -o libdep.exe libdep-main.o -L libdep-a -la -e 0"]
- set exec_output [prune_warnings $exec_output]
-
- set expected_output "got deps for library libdep-a/liba.a: -Llibdep-b -lc\n"
-
- if ![string match $expected_output $exec_output] then {
- fail "$testname: did not get expected output from the linker"
- return
- }
-
- regsub -all "$expected_output" $exec_output "\\1" exec_output
-
- if {![string match "" $exec_output]} {
- fail "$testname: unexpected output from linker: $exec_output"
- return
- }
-
- pass "$testname"
-}
-
-run_test