Add windres to TOOL_PROGS

Message ID 20251204100217.1368966-1-peter0x44@disroot.org
State New
Headers
Series Add windres to TOOL_PROGS |

Commit Message

Peter Damianov Dec. 4, 2025, 10:02 a.m. UTC
  I sent a patch to GCC adding support for passing .rc and .res files to the
driver directly, allowing support for doing things like:

gcc file.c file.rc -o file.exe

However, binutils doesn't install windres into the tooldir, so by default, gcc
will be unable to find windres. This patch adds windres to TOOL_PROGS so this
can work.

binutils/ChangeLog:

	* Makefile.am (TOOL_PROGS): Add windres.
	* Makefile.in: Regenerate.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
---
 binutils/Makefile.am | 2 +-
 binutils/Makefile.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Peter Damianov Dec. 15, 2025, 3:08 p.m. UTC | #1
The patch to gcc has now been applied. I'm pinging this for another 
review.
Thanks.

On 2025-12-04 11:02, Peter Damianov wrote:
> I sent a patch to GCC adding support for passing .rc and .res files to 
> the
> driver directly, allowing support for doing things like:
> 
> gcc file.c file.rc -o file.exe
> 
> However, binutils doesn't install windres into the tooldir, so by 
> default, gcc
> will be unable to find windres. This patch adds windres to TOOL_PROGS 
> so this
> can work.
> 
> binutils/ChangeLog:
> 
> 	* Makefile.am (TOOL_PROGS): Add windres.
> 	* Makefile.in: Regenerate.
> 
> Signed-off-by: Peter Damianov <peter0x44@disroot.org>
> ---
>  binutils/Makefile.am | 2 +-
>  binutils/Makefile.in | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/binutils/Makefile.am b/binutils/Makefile.am
> index 1528302ea61..4be0971b3d2 100644
> --- a/binutils/Makefile.am
> +++ b/binutils/Makefile.am
> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) 
> @BUILD_MISC@
>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) 
> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
> 
>  # Stuff that goes in tooldir/ if appropriate.
> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy 
> readelf
> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump 
> objcopy readelf
> 
>  BASEDIR = $(srcdir)/..
>  BFDDIR = $(BASEDIR)/bfd
> diff --git a/binutils/Makefile.in b/binutils/Makefile.in
> index a374e805576..471b9f310dc 100644
> --- a/binutils/Makefile.in
> +++ b/binutils/Makefile.in
> @@ -696,7 +696,7 @@ TEST_PROGS = $(BFDTEST1_PROG) $(BFDTEST2_PROG) 
> $(GENTESTDLLS_PROG)
>  RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
> 
>  # Stuff that goes in tooldir/ if appropriate.
> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy 
> readelf
> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump 
> objcopy readelf
>  BASEDIR = $(srcdir)/..
>  BFDDIR = $(BASEDIR)/bfd
>  INCDIR = $(BASEDIR)/include
  
Jan Beulich Dec. 15, 2025, 4:04 p.m. UTC | #2
On 04.12.2025 11:02, Peter Damianov via Binutils wrote:
> --- a/binutils/Makefile.am
> +++ b/binutils/Makefile.am
> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) @BUILD_MISC@
>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
>  
>  # Stuff that goes in tooldir/ if appropriate.
> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy readelf
> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump objcopy readelf

Doesn't $(WINDRES_PROG) then need taking off of $(EXTRA_PROGRAMS) (and shouldn't
$(DLLTOOL_PROG) have been taken off of there when it was added to $(TOOL_PROGS))?

Related, what about $(WINDMC_PROG)? To allow .mc files to be passed to the driver
(once it would recognize them), wouldn't that also want moving over?

Jan
  
Peter Damianov Dec. 15, 2025, 4:15 p.m. UTC | #3
On 2025-12-15 17:04, Jan Beulich wrote:
> On 04.12.2025 11:02, Peter Damianov via Binutils wrote:
>> --- a/binutils/Makefile.am
>> +++ b/binutils/Makefile.am
>> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) 
>> @BUILD_MISC@
>>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) 
>> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
>> 
>>  # Stuff that goes in tooldir/ if appropriate.
>> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy 
>> readelf
>> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump 
>> objcopy readelf
> 
> Doesn't $(WINDRES_PROG) then need taking off of $(EXTRA_PROGRAMS) (and 
> shouldn't
> $(DLLTOOL_PROG) have been taken off of there when it was added to 
> $(TOOL_PROGS))?

Honestly not sure, I haven't checked this. What effect would that have?

> 
> Related, what about $(WINDMC_PROG)? To allow .mc files to be passed to 
> the driver
> (once it would recognize them), wouldn't that also want moving over?

I have no plans to implement this. windmc actually outputs two files (a 
.h you are meant to include and a .rc you are meant to pass to windres). 
It would probably be a little strange/tricky for the driver to handle 
it.

> 
> Jan

Thanks for reviewing.
  
Jan Beulich Dec. 15, 2025, 4:44 p.m. UTC | #4
On 15.12.2025 17:15, Peter0x44 wrote:
> On 2025-12-15 17:04, Jan Beulich wrote:
>> On 04.12.2025 11:02, Peter Damianov via Binutils wrote:
>>> --- a/binutils/Makefile.am
>>> +++ b/binutils/Makefile.am
>>> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) 
>>> @BUILD_MISC@
>>>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) 
>>> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
>>>
>>>  # Stuff that goes in tooldir/ if appropriate.
>>> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy 
>>> readelf
>>> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump 
>>> objcopy readelf
>>
>> Doesn't $(WINDRES_PROG) then need taking off of $(EXTRA_PROGRAMS) (and 
>> shouldn't
>> $(DLLTOOL_PROG) have been taken off of there when it was added to 
>> $(TOOL_PROGS))?
> 
> Honestly not sure, I haven't checked this. What effect would that have?

Afaict there would be no present noticeable effect, but according to
"EXTRA_PROGRAMS in Automake lists programs that should be built but not
installed, often for helper tools or optional components, ..." it looks
wrong to me to list programs you want installed in $(EXTRA_PROGRAMS).

Elsewhere, however, it is said "..., while listing all optionally built
programs in EXTRA_PROGRAMS." Not knowing much automake, I fear I'm
simply confused. Still it doesn't look right to me to have a program
in both places.

Jan
  
Peter Damianov Dec. 16, 2025, 12:48 a.m. UTC | #5
On 2025-12-15 17:44, Jan Beulich wrote:
> On 15.12.2025 17:15, Peter0x44 wrote:
>> On 2025-12-15 17:04, Jan Beulich wrote:
>>> On 04.12.2025 11:02, Peter Damianov via Binutils wrote:
>>>> --- a/binutils/Makefile.am
>>>> +++ b/binutils/Makefile.am
>>>> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS)
>>>> @BUILD_MISC@
>>>>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG)
>>>> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
>>>> 
>>>>  # Stuff that goes in tooldir/ if appropriate.
>>>> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy
>>>> readelf
>>>> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump
>>>> objcopy readelf
>>> 
>>> Doesn't $(WINDRES_PROG) then need taking off of $(EXTRA_PROGRAMS) 
>>> (and
>>> shouldn't
>>> $(DLLTOOL_PROG) have been taken off of there when it was added to
>>> $(TOOL_PROGS))?
>> 
>> Honestly not sure, I haven't checked this. What effect would that 
>> have?
> 
> Afaict there would be no present noticeable effect, but according to
> "EXTRA_PROGRAMS in Automake lists programs that should be built but not
> installed, often for helper tools or optional components, ..." it looks
> wrong to me to list programs you want installed in $(EXTRA_PROGRAMS).
> 
> Elsewhere, however, it is said "..., while listing all optionally built
> programs in EXTRA_PROGRAMS." Not knowing much automake, I fear I'm
> simply confused. Still it doesn't look right to me to have a program
> in both places.

OK, I'll trust your judgment and do this in v2.

> 
> Jan

Regards,
Peter Damianov
  
Peter Damianov Dec. 16, 2025, 2:09 a.m. UTC | #6
On 2025-12-15 17:44, Jan Beulich wrote:
> On 15.12.2025 17:15, Peter0x44 wrote:
>> On 2025-12-15 17:04, Jan Beulich wrote:
>>> On 04.12.2025 11:02, Peter Damianov via Binutils wrote:
>>>> --- a/binutils/Makefile.am
>>>> +++ b/binutils/Makefile.am
>>>> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS)
>>>> @BUILD_MISC@
>>>>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG)
>>>> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
>>>> 
>>>>  # Stuff that goes in tooldir/ if appropriate.
>>>> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy
>>>> readelf
>>>> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump
>>>> objcopy readelf
>>> 
>>> Doesn't $(WINDRES_PROG) then need taking off of $(EXTRA_PROGRAMS) 
>>> (and
>>> shouldn't
>>> $(DLLTOOL_PROG) have been taken off of there when it was added to
>>> $(TOOL_PROGS))?
>> 
>> Honestly not sure, I haven't checked this. What effect would that 
>> have?
> 
> Afaict there would be no present noticeable effect, but according to
> "EXTRA_PROGRAMS in Automake lists programs that should be built but not
> installed, often for helper tools or optional components, ..." it looks
> wrong to me to list programs you want installed in $(EXTRA_PROGRAMS).
> 
> Elsewhere, however, it is said "..., while listing all optionally built
> programs in EXTRA_PROGRAMS." Not knowing much automake, I fear I'm
> simply confused. Still it doesn't look right to me to have a program
> in both places.
> 
> Jan

-EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) 
$(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
+EXTRA_PROGRAMS = srconv sysdump coffdump $(WINDMC_PROG) $(DLLWRAP_PROG)

-TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy readelf
+TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump objcopy 
readelf

I tried adding this change on top of my previous change.

When I go to regenerate Makefile.in, I get this:

autoreconf-2.69: configure.ac: AM_GNU_GETTEXT is used, but not 
AM_GNU_GETTEXT_VERSION
Makefile.am:487: warning: variable 'dlltool_SOURCES' is defined but no 
program or
Makefile.am:487: library has 'dlltool' as canonical name (possible typo)
Makefile.am:519: warning: variable 'windres_SOURCES' is defined but no 
program or
Makefile.am:519: library has 'windres' as canonical name (possible typo)
Makefile.am:488: warning: variable 'dlltool_LDADD' is defined but no 
program or
Makefile.am:488: library has 'dlltool' as canonical name (possible typo)
Makefile.am:521: warning: variable 'windres_LDADD' is defined but no 
program or
Makefile.am:521: library has 'windres' as canonical name (possible typo)
Makefile.am:244: warning: variable 'dlltool_DEPENDENCIES' is defined but 
no program or
Makefile.am:244: library has 'dlltool' as canonical name (possible typo)
Makefile.am:245: warning: variable 'windres_DEPENDENCIES' is defined but 
no program or
Makefile.am:245: library has 'windres' as canonical name (possible typo)

So I do think it has to exist in both and this patch is correct.

Let me know if you still think otherwise.

Regards,
Peter Damianov.
  
Jan Beulich Dec. 16, 2025, 8:02 a.m. UTC | #7
On 16.12.2025 03:09, Peter0x44 wrote:
> On 2025-12-15 17:44, Jan Beulich wrote:
>> On 15.12.2025 17:15, Peter0x44 wrote:
>>> On 2025-12-15 17:04, Jan Beulich wrote:
>>>> On 04.12.2025 11:02, Peter Damianov via Binutils wrote:
>>>>> --- a/binutils/Makefile.am
>>>>> +++ b/binutils/Makefile.am
>>>>> @@ -110,7 +110,7 @@ noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS)
>>>>> @BUILD_MISC@
>>>>>  EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG)
>>>>> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
>>>>>
>>>>>  # Stuff that goes in tooldir/ if appropriate.
>>>>> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy
>>>>> readelf
>>>>> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump
>>>>> objcopy readelf
>>>>
>>>> Doesn't $(WINDRES_PROG) then need taking off of $(EXTRA_PROGRAMS) 
>>>> (and
>>>> shouldn't
>>>> $(DLLTOOL_PROG) have been taken off of there when it was added to
>>>> $(TOOL_PROGS))?
>>>
>>> Honestly not sure, I haven't checked this. What effect would that 
>>> have?
>>
>> Afaict there would be no present noticeable effect, but according to
>> "EXTRA_PROGRAMS in Automake lists programs that should be built but not
>> installed, often for helper tools or optional components, ..." it looks
>> wrong to me to list programs you want installed in $(EXTRA_PROGRAMS).
>>
>> Elsewhere, however, it is said "..., while listing all optionally built
>> programs in EXTRA_PROGRAMS." Not knowing much automake, I fear I'm
>> simply confused. Still it doesn't look right to me to have a program
>> in both places.
>>
>> Jan
> 
> -EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) 
> $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
> +EXTRA_PROGRAMS = srconv sysdump coffdump $(WINDMC_PROG) $(DLLWRAP_PROG)
> 
> -TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy readelf
> +TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump objcopy 
> readelf
> 
> I tried adding this change on top of my previous change.
> 
> When I go to regenerate Makefile.in, I get this:
> 
> autoreconf-2.69: configure.ac: AM_GNU_GETTEXT is used, but not 
> AM_GNU_GETTEXT_VERSION
> Makefile.am:487: warning: variable 'dlltool_SOURCES' is defined but no 
> program or
> Makefile.am:487: library has 'dlltool' as canonical name (possible typo)
> Makefile.am:519: warning: variable 'windres_SOURCES' is defined but no 
> program or
> Makefile.am:519: library has 'windres' as canonical name (possible typo)
> Makefile.am:488: warning: variable 'dlltool_LDADD' is defined but no 
> program or
> Makefile.am:488: library has 'dlltool' as canonical name (possible typo)
> Makefile.am:521: warning: variable 'windres_LDADD' is defined but no 
> program or
> Makefile.am:521: library has 'windres' as canonical name (possible typo)
> Makefile.am:244: warning: variable 'dlltool_DEPENDENCIES' is defined but 
> no program or
> Makefile.am:244: library has 'dlltool' as canonical name (possible typo)
> Makefile.am:245: warning: variable 'windres_DEPENDENCIES' is defined but 
> no program or
> Makefile.am:245: library has 'windres' as canonical name (possible typo)
> 
> So I do think it has to exist in both and this patch is correct.

Obviously you're right (i.e. patch is okay as is). One of the various things
about automake that apparently I don't understand.

Jan
  

Patch

diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 1528302ea61..4be0971b3d2 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -110,7 +110,7 @@  noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) @BUILD_MISC@
 EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
 
 # Stuff that goes in tooldir/ if appropriate.
-TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy readelf
+TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump objcopy readelf
 
 BASEDIR = $(srcdir)/..
 BFDDIR = $(BASEDIR)/bfd
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index a374e805576..471b9f310dc 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -696,7 +696,7 @@  TEST_PROGS = $(BFDTEST1_PROG) $(BFDTEST2_PROG) $(GENTESTDLLS_PROG)
 RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
 
 # Stuff that goes in tooldir/ if appropriate.
-TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy readelf
+TOOL_PROGS = nm-new strip-new ar ranlib dlltool windres objdump objcopy readelf
 BASEDIR = $(srcdir)/..
 BFDDIR = $(BASEDIR)/bfd
 INCDIR = $(BASEDIR)/include