Skip to content
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

test: Disable dshell/dll.d test on OSX #14208

Merged
merged 2 commits into from
Jun 13, 2022
Merged

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 12, 2022

When running the dll test, the following warning is written to console.

user@darwin20:~/src/dlang/dmd/test$ ./test_results/dshell/dll/testdll
Shared libraries are not yet supported on OSX.

This is correct, as when you link druntime into a shared library on OSX, all the symbols of libphobos.a are copied into the DSO/image for that library. Then, linking an executable with both libphobos and that library means there are now two copies of all globals present at run-time.

i.e:

user@darwin20:~/src/dlang/dmd/test$ otool -L test_results/dshell/dll/testdll
test_results/dshell/dll/testdll:
	test_results/dshell/dll/mydll.so (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)

user@darwin20:~/src/dlang/dmd/test$ nm test_results/dshell/dll/testdll | grep __D4core6thread10threadbase10ThreadBase6_slockG96v
00000001000399e8 B __D4core6thread10threadbase10ThreadBase6_slockG96v

user@darwin20:~/src/dlang/dmd/test$ nm test_results/dshell/dll/mydll.so | grep __D4core6thread10threadbase10ThreadBase6_slockG96v
0000000000057c58 B __D4core6thread10threadbase10ThreadBase6_slockG96v

Unlike ELF DSOs, where at run-time these are resolved as-if the symbol is weak. On OSX, depending on which DSO/image a referencing function is resolved/called from, you could get either version of these symbols. i.e: Thread.initLocks() is called from testdll.exe, initializing the Thread.slock@1000399e8 handle in that image, but thread_suspendAll is called from mydll.so, which tries to use the uninitialized Thread.slock@000057c58 and throws an Error as a result.

Until DMD sorts out symbol emission to avoid this (GDC annotates these __gshared variables with @weak IIRC), or gains proper support for shared libraries, it can only be considered a fluke that this test even passes. Disabling it unblocks #14194.

@ibuclaw ibuclaw added the Review:Blocking Other Work review and pulling should be a priority label Jun 12, 2022
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#14208"

test/dshell/dll.d Outdated Show resolved Hide resolved
@WalterBright
Copy link
Member

I added a bugzilla for it: https://issues.dlang.org/show_bug.cgi?id=23180

test/dshell/dll.d Outdated Show resolved Hide resolved
@dlang-bot dlang-bot merged commit 13f9d97 into dlang:master Jun 13, 2022
@ibuclaw ibuclaw deleted the disable-dll-osx branch June 13, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge:auto-merge Review:Blocking Other Work review and pulling should be a priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants