Skip to content

Use response files with all the toolchains - #151

Merged
dra27 merged 1 commit into
ocaml:masterfrom
punchagan:mingw-response-file
Mar 31, 2025
Merged

dra27 merged 1 commit into
ocaml:masterfrom
punchagan:mingw-response-file

Conversation

@punchagan

@punchagan punchagan commented Jan 25, 2025 •

Copy link
Copy Markdown
Contributor

Response files were added to gcc 4.2.0 [1], but Cygwin was stuck on gcc
3.4.4 for ages until mingw-w64 was introduced at gcc 4.5 (Cygwin's gcc
itself still lagged for a while) cf. [2]. (Based on inputs from @dra27).

So, in 2008 [3], it was correct to avoid using response files with
CYGWIN & MINGW. Later, support was added for the GNAT toolchain based on
the MINGW toolchain, also avoiding the use of response files. But, now
all the platforms could benefit from using response files. This commit
enables the use of response files for all toolchains, including GNAT
since the GNAT compiler is based on gcc [4].

The UTF-16 conversion of paths seems to have been primarily implemented
for MSVC[5] and causes issues with MINGW64. The linker fails with a
"file not found" error with a weird 2 character file path, which seems
like an encoding issue when reading the Byte Order Mark written during
the conversion. This commit turns off the UTF-16 conversion when not
using the MSVC or LIGHTLD toolchains.

[1] - gcc-mirror/gcc@9d53053
[2] - http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2010/09/14/020013/index.html
[3] -
fb84938
[4] - #151 (comment)
[5] - #36

@yakobowski

Copy link
Copy Markdown
Contributor

The support for GNAT has been added for AdaCore, butt I think we've actually stopped using this codepath entirely. Unfortunately I've left AdaCore recently, so you will need to double-check with e.g. @kanigsson.

In any case, GNAT is based on GCC, and is only lagging a few versions behind. Typically, the latest versions are GCC-13 based. So I would suggest using response files in all cases.

@punchagan

Copy link
Copy Markdown
Contributor Author

In any case, GNAT is based on GCC, and is only lagging a few versions behind. Typically, the latest versions are GCC-13 based. So I would suggest using response files in all cases.

Thank you for your suggestion! I'll update the PR

punchagan added a commit to punchagan/flexdll that referenced this pull request Jan 28, 2025
Response files were added to gcc 4.2.0 [1], but Cygwin was stuck on gcc
3.4.4 for ages until mingw-w64 was introduced at gcc 4.5 (Cygwin's gcc
itself still lagged for a while) cf. [2]. (Based on inputs from @dra27).

So, in 2008 [3], it was correct to avoid using response files with
CYGWIN & MINGW. Later, support was added for the GNAT toolchain based on
the MINGW toolchain, also avoiding the use of response files. But, now
all the platforms could benefit from using response files. This commit
enables the use of response files for all toolchains, including GNAT
since the GNAT compiler is based on gcc [4].

The UTF-16 conversion of paths seems to have been primarily implemented
for MSVC[5] and causes issues with MINGW64. The linker fails with a
"file not found" error with a weird 2 character file path, which seems
like an encoding issue when reading the Byte Order Mark written during
the conversion. This commit turns off the UTF-16 conversion when not
using the MSVC or LIGHTLD toolchains.

[1] - gcc-mirror/gcc@9d53053
[2] - http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2010/09/14/020013/index.html
[3] -
ocaml@fb84938
[4] - ocaml#151 (comment)
[5] - ocaml#36
@punchagan
punchagan force-pushed the mingw-response-file branch from 510fdb1 to 124facc Compare January 28, 2025 08:49
@punchagan punchagan changed the title Use response files with MINGW, MINGW64 and CYGWIN toolchains Use response files with all the toolchains Jan 28, 2025
@punchagan

Copy link
Copy Markdown
Contributor Author

In any case, GNAT is based on GCC, and is only lagging a few versions behind. Typically, the latest versions are GCC-13 based. So I would suggest using response files in all cases.

Updated the PR to use toolchains for GNAT too!

Comment thread reloc.ml Resolved
@kanigsson

Copy link
Copy Markdown
Contributor

Sorry I missed this mention by @yakobowski. GNAT behaves like GCC here.
Contrary to what he said, I believe we still use the GNAT-specific flexdll changes, so we would be grateful if they could be maintained. Thank you!

punchagan added a commit to punchagan/flexdll that referenced this pull request Feb 17, 2025
Response files were added to gcc 4.2.0 [1], but Cygwin was stuck on gcc
3.4.4 for ages until mingw-w64 was introduced at gcc 4.5 (Cygwin's gcc
itself still lagged for a while) cf. [2]. (Based on inputs from @dra27).

So, in 2008 [3], it was correct to avoid using response files with
CYGWIN & MINGW. Later, support was added for the GNAT toolchain based on
the MINGW toolchain, also avoiding the use of response files. But, now
all the platforms could benefit from using response files. This commit
enables the use of response files for all toolchains, including GNAT
since the GNAT compiler is based on gcc [4].

The UTF-16 conversion of paths seems to have been primarily implemented
for MSVC[5] and causes issues with MINGW64. The linker fails with a
"file not found" error with a weird 2 character file path, which seems
like an encoding issue when reading the Byte Order Mark written during
the conversion. This commit turns off the UTF-16 conversion when not
using the MSVC or LIGHTLD toolchains.

[1] - gcc-mirror/gcc@9d53053
[2] - http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2010/09/14/020013/index.html
[3] -
ocaml@fb84938
[4] - ocaml#151 (comment)
[5] - ocaml#36
@shonfeder

Copy link
Copy Markdown
Member

Hello! I thought it was worth checking in here to see if we may be OK merging this, or if there additional validation we may do to build the needed confidence.

@dra27 dra27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the time it's taken me to sit down with this - semantically, this is good to go, thank you.

Please could you push an update to the CHANGES file, and I'd prefer either the full change I suggest below or at least for the wildcard in the match to be replaced with the full expansion of the other linkers.

Comment thread reloc.ml Resolved
Comment thread reloc.ml Resolved
punchagan added a commit to punchagan/flexdll that referenced this pull request Mar 31, 2025
Response files were added to gcc 4.2.0 [1], but Cygwin was stuck on gcc
3.4.4 for ages until mingw-w64 was introduced at gcc 4.5 (Cygwin's gcc
itself still lagged for a while) cf. [2]. (Based on inputs from @dra27).

So, in 2008 [3], it was correct to avoid using response files with
CYGWIN & MINGW. Later, support was added for the GNAT toolchain based on
the MINGW toolchain, also avoiding the use of response files. But, now
all the platforms could benefit from using response files. This commit
enables the use of response files for all toolchains, including GNAT
since the GNAT compiler is based on gcc [4].

The UTF-16 conversion of paths seems to have been primarily implemented
for MSVC[5] and causes issues with MINGW64. The linker fails with a
"file not found" error with a weird 2 character file path, which seems
like an encoding issue when reading the Byte Order Mark written during
the conversion. This commit turns off the UTF-16 conversion when not
using the MSVC or LIGHTLD toolchains.

[1] - gcc-mirror/gcc@9d53053
[2] - http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2010/09/14/020013/index.html
[3] -
ocaml@fb84938
[4] - ocaml#151 (comment)
[5] - ocaml#36
@punchagan
punchagan force-pushed the mingw-response-file branch from 4b71b44 to 5e527ee Compare March 31, 2025 04:07
Response files were added to gcc 4.2.0 [1], but Cygwin was stuck on gcc
3.4.4 for ages until mingw-w64 was introduced at gcc 4.5 (Cygwin's gcc
itself still lagged for a while) cf. [2]. (Based on inputs from @dra27).

So, in 2008 [3], it was correct to avoid using response files with
CYGWIN & MINGW. Later, support was added for the GNAT toolchain based on
the MINGW toolchain, also avoiding the use of response files. But, now
all the platforms could benefit from using response files. This commit
enables the use of response files for all toolchains, including GNAT
since the GNAT compiler is based on gcc [4].

The UTF-16 conversion of paths seems to have been primarily implemented
for MSVC[5] and causes issues with MINGW64. The linker fails with a
"file not found" error with a weird 2 character file path, which seems
like an encoding issue when reading the Byte Order Mark written during
the conversion. This commit turns off the UTF-16 conversion when not
using the MSVC or LIGHTLD toolchains.

[1] - gcc-mirror/gcc@9d53053
[2] - http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2010/09/14/020013/index.html
[3] -
ocaml@fb84938
[4] - ocaml#151 (comment)
[5] - ocaml#36
@punchagan
punchagan force-pushed the mingw-response-file branch from 5e527ee to 834230f Compare March 31, 2025 04:44
@punchagan

Copy link
Copy Markdown
Contributor Author

Apologies for the time it's taken me to sit down with this - semantically, this is good to go, thank you.

No worries at all. Thanks for taking the time to review it!

Please could you push an update to the CHANGES file, and I'd prefer either the full change I suggest below or at least for the wildcard in the match to be replaced with the full expansion of the other linkers.

I've incorporated your suggestions and updated the CHANGES file. Thanks!

@dra27
dra27 merged commit 8130915 into ocaml:master Mar 31, 2025
@dra27

dra27 commented Mar 31, 2025

Copy link
Copy Markdown
Member

Thank you!

@punchagan
punchagan deleted the mingw-response-file branch March 31, 2025 11:12
semgrep-ci Bot pushed a commit to semgrep/semgrep that referenced this pull request Dec 19, 2025
Seems like this workaround isn't needed as both
             - ocaml/flexdll#151
             - ocaml/flexdll#152
have been merged and release sometime ago.

Test plan: CI + CI in
https://github.com/semgrep/semgrep/actions/runs/20310940953?pr=11381

synced from Pro a5ece9662f81c8f261a772cdaa11d6bef57d5830
semgrep-ci Bot pushed a commit to semgrep/semgrep that referenced this pull request Dec 22, 2025
Seems like this workaround isn't needed as both
             - ocaml/flexdll#151
             - ocaml/flexdll#152
have been merged and release sometime ago.

Test plan: CI + CI in
https://github.com/semgrep/semgrep/actions/runs/20310940953?pr=11381

synced from Pro a5ece9662f81c8f261a772cdaa11d6bef57d5830
semgrep-ci Bot pushed a commit to semgrep/semgrep that referenced this pull request Dec 22, 2025
Seems like this workaround isn't needed as both
             - ocaml/flexdll#151
             - ocaml/flexdll#152
have been merged and release sometime ago.

Test plan: CI + CI in
https://github.com/semgrep/semgrep/actions/runs/20310940953?pr=11381

synced from Pro a5ece9662f81c8f261a772cdaa11d6bef57d5830
semgrep-ci Bot pushed a commit to semgrep/semgrep that referenced this pull request Dec 22, 2025
Seems like this workaround isn't needed as both
             - ocaml/flexdll#151
             - ocaml/flexdll#152
have been merged and release sometime ago.

Test plan: CI + CI in
https://github.com/semgrep/semgrep/actions/runs/20310940953?pr=11381

synced from Pro a5ece9662f81c8f261a772cdaa11d6bef57d5830
yosefAlsuhaibani added a commit to semgrep/semgrep that referenced this pull request Dec 22, 2025
Seems like this workaround isn't needed as both
             - ocaml/flexdll#151
             - ocaml/flexdll#152
have been merged and release sometime ago.

Test plan: CI + CI in
https://github.com/semgrep/semgrep/actions/runs/20310940953?pr=11381

synced from Pro a5ece9662f81c8f261a772cdaa11d6bef57d5830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants