Skip to content

[LLVM][TargetParser] Handle -msys targets the same as -cygwin. #136817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

jeremyd2019
Copy link
Contributor

MSYS2 uses i686-pc-msys and x86_64-pc-msys as target, and is a fork of Cygwin. There's an effort underway to try to switch as much as possible to use -pc-cygwin targets, but the -msys target will be hanging around for the forseeable future.

@jeremyd2019
Copy link
Contributor Author

/cc @mstorsjo @mati865

@mstorsjo
Copy link
Member

This would require a change to a test; I think the main relevant tests for this class are in some unittest - see llvm/unittests/TargetParser. They work a bit differently than the usual llvm-lit tests (but are included when you run e.g. check-llvm); these build a regular gtest binary which can be executed.

If msys2 is moving towards using cygwin triples instead of msys, that's probably good. But it would be good to mention, just for context, how widespread and acknowledged these triples are. IIRC very little of the upstream GNU tools mention msys(2) directly - IIRC support for such triples is patched in, in many of the packages?

(If that's still the case, that's not necessarily a blocker for this change, but it may give valuable contextual info. Even if not handled upstream there, the msys2 ecosystem is a large and nontrivial establishment in itself, so it's definitely not a blocker for accepting it here, I'd say.)

I'm not sure who would be the most authoritative reviewer of this area, I think @MaskRay may be one.

@mstorsjo mstorsjo requested a review from MaskRay April 23, 2025 06:43
@mati865
Copy link
Contributor

mati865 commented Apr 23, 2025

FYI there is a tracking issue for moving closer to Cygwin: msys2/MSYS2-packages#3012

@jeremyd2019
Copy link
Contributor Author

I was looking for a test, but didn't find one looking under llvm/tests.

Copy link

github-actions bot commented Apr 23, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@jeremyd2019
Copy link
Contributor Author

Notably, the msys triple is generated by the config.guess in this repo via llvm/modules/GetHostTriple.cmake:

*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;

MSYS2 uses i686-pc-msys and x86_64-pc-msys as target, and is a fork of
Cygwin.  There's an effort underway to try to switch as much as possible
to use -pc-cygwin targets, but the -msys target will be hanging around
for the forseeable future.
@mstorsjo
Copy link
Member

Notably, the msys triple is generated by the config.guess in this repo via llvm/modules/GetHostTriple.cmake:

*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;

Oh, good point. (And that bit is also available in upstream config.guess - the one we have here is an old copy of the upstream, with local modifications on top at this point.)

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, and doesn't seem controversial.

I'll leave it open for 24h after approving, in case someone else (across all timezones) want to chime in still - I'll try to merge it after that if I remember (or @mati865 also should be able to).

@mati865
Copy link
Contributor

mati865 commented Apr 23, 2025

I don't have write access (never asked for it though).

@mstorsjo
Copy link
Member

I don't have write access (never asked for it though).

Oh, sorry, I misremembered then!

@mstorsjo mstorsjo merged commit 6900e90 into llvm:main Apr 24, 2025
9 of 11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 24, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16564

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-dap/server/TestDAP_server.py (1194 of 2127)
PASS: lldb-api :: tools/lldb-dap/stop-hooks/TestDAP_stop_hooks.py (1195 of 2127)
PASS: lldb-api :: tools/lldb-dap/attach/TestDAP_attach.py (1196 of 2127)
PASS: lldb-api :: tools/lldb-dap/terminated-event/TestDAP_terminatedEvent.py (1197 of 2127)
PASS: lldb-api :: tools/lldb-dap/progress/TestDAP_Progress.py (1198 of 2127)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestAppleSimulatorOSType.py (1199 of 2127)
PASS: lldb-api :: tools/lldb-dap/step/TestDAP_step.py (1200 of 2127)
PASS: lldb-api :: tools/lldb-dap/module/TestDAP_module.py (1201 of 2127)
PASS: lldb-api :: tools/lldb-dap/threads/TestDAP_threads.py (1202 of 2127)
UNRESOLVED: lldb-api :: tools/lldb-dap/variables/children/TestDAP_variables_children.py (1203 of 2127)
******************** TEST 'lldb-api :: tools/lldb-dap/variables/children/TestDAP_variables_children.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/variables/children -p TestDAP_variables_children.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 6900e9026516963ae625b28dded2cdf0bd16e590)
  clang revision 6900e9026516963ae625b28dded2cdf0bd16e590
  llvm revision 6900e9026516963ae625b28dded2cdf0bd16e590
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']
[{'$__lldb_extensions': {'declaration': {'line': 16, 'path': '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/variables/children/main.cpp'}}, 'declarationLocationReference': 8, 'evaluateName': 'indexed', 'id': 4, 'indexedVariables': 1, 'memoryReference': '0xFFFFC6475CBB', 'name': 'indexed', 'type': 'Indexed', 'value': 'Indexed @ 0xffffc6475cbb', 'variablesReference': 4}, {'$__lldb_extensions': {'declaration': {'line': 17, 'path': '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/variables/children/main.cpp'}}, 'declarationLocationReference': 10, 'evaluateName': 'not_indexed', 'id': 5, 'memoryReference': '0xFFFFC6475CBA', 'name': 'not_indexed', 'type': 'NotIndexed', 'value': 'NotIndexed @ 0xffffc6475cba', 'variablesReference': 5}, {'$__lldb_extensions': {'declaration': {'line': 18, 'path': '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/variables/children/main.cpp'}}, 'declarationLocationReference': 12, 'evaluateName': 'non_primitive_result', 'id': 6, 'memoryReference': '0xFFFFC6475C98', 'name': 'non_primitive_result', 'type': 'NonPrimitive', 'value': 'NonPrimitive @ 0xffffc6475c98', 'variablesReference': 6}]

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_get_num_children (TestDAP_variables_children.TestDAP_variables_children)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_return_variable_with_children (TestDAP_variables_children.TestDAP_variables_children) (skipping due to the following parameter(s): architecture) 
======================================================================
ERROR: test_get_num_children (TestDAP_variables_children.TestDAP_variables_children)
   Test that GetNumChildren is not called for formatters not producing indexed children.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2065, in tearDown
    Base.tearDown(self)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1105, in tearDown
    hook()  # try the plain call and hope it works
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py", line 404, in cleanup
    self.dap_server.request_disconnect(terminateDebuggee=True)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py", line 702, in request_disconnect
    return self.send_recv(command_dict)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py", line 332, in send_recv
    raise ValueError(desc)
ValueError: no response for "disconnect"
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang
----------------------------------------------------------------------
Ran 2 tests in 0.696s

@jeremyd2019 jeremyd2019 deleted the llvm-msys-target branch April 24, 2025 17:04
@mati865
Copy link
Contributor

mati865 commented Apr 24, 2025

I don't have write access (never asked for it though).

Oh, sorry, I misremembered then!

No worries, thank you for handling it.

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.

4 participants