[binutils-gdb] ld: testsuite: Fix "PR ld/28138 (build only)" on Solaris

Rainer Orth ro@sourceware.org
Mon Jul 28 21:00:56 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=89ccd18ef6ed3e7146ea4b1b89815c907caefa08

commit 89ccd18ef6ed3e7146ea4b1b89815c907caefa08
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Mon Jul 28 23:00:26 2025 +0200

    ld: testsuite: Fix "PR ld/28138 (build only)" on Solaris
    
    The
    
    FAIL: PR ld/28138 (build only)
    
    test FAILs on Solaris:
    
    ld/tmpdir/ld/collect-ld: plugin framework: out of file descriptors. Try using fewer objects/archives
    
    ld/tmpdir/ld/collect-ld: cannot find -lgcc: Too many open files
    [...]
    
    I found that the test PASSes when using ulimit -n 21 instead of the
    current 20.  Looking with strace/truss, on Linux/i686 the following
    files are opened:
    
    301543 openat(AT_FDCWD, "tmpdir/pr28138", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
    301543 openat(AT_FDCWD, "/lib/../lib32/crt1.o", O_RDONLY|O_LARGEFILE) = 4
    301543 openat(AT_FDCWD, "/lib/../lib32/crt1.o", O_RDONLY|O_LARGEFILE) = 5
    301543 openat(AT_FDCWD, "/lib/../lib32/crti.o", O_RDONLY|O_LARGEFILE) = 5
    301543 openat(AT_FDCWD, "/lib/../lib32/crti.o", O_RDONLY|O_LARGEFILE) = 6
    301543 openat(AT_FDCWD, "lib/gcc/i686-pc-linux-gnu/12.1.0/crtbegin.o", O_RDONLY|O_LARGEFILE) = 6
    301543 openat(AT_FDCWD, "lib/gcc/i686-pc-linux-gnu/12.1.0/crtbegin.o", O_RDONLY|O_LARGEFILE) = 7
    301543 openat(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY|O_LARGEFILE) = 7
    301543 openat(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY|O_LARGEFILE) = 8
    301543 openat(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY|O_LARGEFILE) = 8
    301543 openat(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY|O_LARGEFILE) = 9
    301543 openat(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY|O_LARGEFILE) = 9
    301543 openat(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY|O_LARGEFILE) = 10
    301543 openat(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY|O_LARGEFILE) = 10
    301543 openat(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY|O_LARGEFILE) = 11
    301543 openat(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY|O_LARGEFILE) = 11
    301543 openat(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY|O_LARGEFILE) = 12
    301543 openat(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY|O_LARGEFILE) = 12
    301543 openat(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY|O_LARGEFILE) = 13
    301543 openat(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY|O_LARGEFILE) = 13
    301543 openat(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY|O_LARGEFILE) = 3
    301543 openat(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY|O_LARGEFILE) = 3
    301543 openat(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY|O_LARGEFILE) = 4
    301543 openat(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY|O_LARGEFILE) = 4
    301543 openat(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY|O_LARGEFILE) = 5
    
    while on Solaris/i386 there are a couple more:
    
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138", O_RDWR|O_CREAT|O_TRUNC, 0666) = 4
    27726:  openat64(AT_FDCWD, "/usr/lib/crt1.o", O_RDONLY) = 5
    27726:  openat64(AT_FDCWD, "/usr/lib/crt1.o", O_RDONLY) = 6
    27726:  openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtp.o", O_RDONLY) = 6
    27726:  openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtp.o", O_RDONLY) = 7
    27726:  openat64(AT_FDCWD, "/usr/lib/crti.o", O_RDONLY) = 7
    27726:  openat64(AT_FDCWD, "/usr/lib/crti.o", O_RDONLY) = 8
    27726:  openat64(AT_FDCWD, "/usr/lib/values-Xa.o", O_RDONLY) = 8
    27726:  openat64(AT_FDCWD, "/usr/lib/values-Xa.o", O_RDONLY) = 9
    27726:  openat64(AT_FDCWD, "/usr/lib/values-xpg6.o", O_RDONLY) = 9
    27726:  openat64(AT_FDCWD, "/usr/lib/values-xpg6.o", O_RDONLY) = 10
    27726:  openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtbegin.o", O_RDONLY) = 10
    27726:  openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtbegin.o", O_RDONLY) = 11
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY) = 11
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY) = 12
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY) = 12
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY) = 13
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY) = 13
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY) = 14
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY) = 14
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY) = 15
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY) = 15
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY) = 16
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY) = 16
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY) = 17
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY) = 17
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY) = 18
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY) = 18
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY) = 19
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY) = 19
    27726:  openat64(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY) Err#24 EMFILE
    
    While it seems weird that the same files are opened twice for reading,
    it's no wonder that 20 fds aren't enough on Solaris.
    
    To avoid this, I've raised the limit to 25, hoping that this will be
    enough on more targets.
    
    Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.
    
    2025-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
    
            ld:
            * testsuite/ld-plugin/lto.exp (PR ld/28138 test): Raise fd limit
            to 25.

Diff:
---
 ld/ChangeLog                   | 5 +++++
 ld/testsuite/ld-plugin/lto.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index d4a058874fe..37c745acd5d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2025-07-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* testsuite/ld-plugin/lto.exp (PR ld/28138 test): Raise fd limit
+	to 25.
+
 2025-07-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* testsuite/ld-elf/indirect.exp (Run with libpr19553c.so):
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index d68e5f44397..9ac3cf6b9f1 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -1009,7 +1009,7 @@ run_cc_link_tests [list \
 
 set board_flags [get_board_flags]
 set exec_output [run_host_cmd "sh" \
-			      "-c \"ulimit -n 20; \
+			      "-c \"ulimit -n 25; \
 			      $CC_FOR_TARGET $gcc_B_opt $CFLAGS_FOR_TARGET \
 			      $board_flags $ld_L_opt -o tmpdir/pr28138 \
 			      tmpdir/pr28138.o tmpdir/pr28138.a\""]


More information about the Binutils-cvs mailing list