bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/32359] New: --dependency-file: wrong error message if `fop


From: pobrn at protonmail dot com
Subject: [Bug binutils/32359] New: --dependency-file: wrong error message if `fopen()` fails
Date: Wed, 13 Nov 2024 23:46:16 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=32359

            Bug ID: 32359
           Summary: --dependency-file: wrong error message if `fopen()`
                    fails
           Product: binutils
           Version: 2.43
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: pobrn at protonmail dot com
  Target Milestone: ---

See
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/ldmain.c;h=037099b9d37352437744c3507757df096250de24;hb=HEAD#l197
:

 194   out = fopen (config.dependency_file, FOPEN_WT);
 195   if (out == NULL)
 196     {
 197       einfo (_("%F%P: cannot open dependency file %s: %E\n"),
 198              config.dependency_file);
 199     }

`fopen()` sets `errno` on failure, but `bfd_error` is not set to
`bfd_error_system_call`.
So such error messages are possible:

  /usr/bin/ld: cannot open dependency file CMakeFiles/yuv_shared.dir/link.d: no
error


Probably something like this needed:

diff --git a/ld/ldmain.c b/ld/ldmain.c
index 037099b9d37..2790f2fa06a 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -194,6 +194,7 @@ write_dependency_file (void)
   out = fopen (config.dependency_file, FOPEN_WT);
   if (out == NULL)
     {
+      bfd_set_error (bfd_error_system_call);
       einfo (_("%F%P: cannot open dependency file %s: %E\n"),
             config.dependency_file);
     }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]