Some packages (gnulib) pass COFF object files with .res extension
directly to gcc, expecting them to be passed through to the linker,
instead of windres.  However, the current EXTRA_DEFAULT_COMPILERS spec
intercepts all .res files and runs them through windres, which fails for
COFF files that are not Windows resource files (Microsoft Visual C
binary resource file as identified by libmagic/file).

This patch removes the .res file specs, leaving only the .rc
support specs active. At a later date, this can be reviewed.

The driver could inspect the .res file to see if it's a object file or,
but, it's somewhat questionable if handling .res is even useful.

gcc/ChangeLog:

        PR driver/123504
        * config/i386/cygming.h (EXTRA_DEFAULT_COMPILERS): Comment out
        .res spec to allow COFF files with .res extension to pass
        through to the linker.
        * config/aarch64/cygming.h (EXTRA_DEFAULT_COMPILERS): Likewise.
---

v2: better commit message. Supercedes:
https://inbox.sourceware.org/gcc-patches/[email protected]/T/#u

 gcc/config/aarch64/cygming.h | 8 ++++++--
 gcc/config/i386/cygming.h    | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 3b2c5955fc1..bb3c750df69 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -261,11 +261,15 @@ still needed for compilation.  */
    "%{!E:%{!M:%{!MM:windres -J rc -O coff -F pe-aarch64 \
       %{I*:-I%*} %{D*:-D%*} %{U*:-U%*} \
       %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} %i}}}", \
-   0, 0, 0}, \
+   0, 0, 0}, /*
   {".res", "@windres-res", 0, 0, 0}, \
   {"@windres-res", \
    "%{!E:%{!M:%{!MM:windres -J res -O coff -F pe-aarch64 \
       %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} %i}}}", \
-   0, 0, 0},
+   0, 0, 0}, */
+
+/* For now, do not handle .res because some packages pass
+COFF files named .res to gcc directly, expecting them to
+be passed to the linker, not windres. See PR123504.  */
 
 #endif
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index a63286b6f72..00d11063c72 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -491,10 +491,14 @@ do {                                              \
       WINDRES_FORMAT_SPEC \
       "%{I*:-I%*} %{D*:-D%*} %{U*:-U%*} \
       %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} %i}}}", \
-   0, 0, 0}, \
+   0, 0, 0}, /* \
   {".res", "@windres-res", 0, 0, 0}, \
   {"@windres-res", \
    "%{!E:%{!M:%{!MM:windres -J res -O coff " \
       WINDRES_FORMAT_SPEC \
       "%{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} %i}}}", \
-   0, 0, 0},
+   0, 0, 0}, */
+
+/* For now, do not handle .res because some packages pass
+COFF files named .res to gcc directly, expecting them to
+be passed to the linker, not windres. See PR123504.  */
-- 
2.52.0

Reply via email to