-
-
Notifications
You must be signed in to change notification settings - Fork 668
Fix issue 18014 - dmd test suite fails to link (part 1/2) #7433
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
Conversation
| @echo "OS: '$(OS)'" | ||
| @echo "MODEL: '$(MODEL)'" | ||
| @echo "PIC: '$(PIC_FLAG)'" | ||
| $(DMD) -conf= $(MODEL_FLAG) $(DEBUG_FLAGS) -unittest -run d_do_test.d -unittest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't added PIC_FLAG here. Without this you still can't build the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above: DEBUG_FLAGS=$(PIC_FLAG) -g
|
Though if you're in a hurry I'm ok with doing things step-by-step as I don't have time at the moment. |
Well, I cherry-picked your commit to this PR because it's ready now & already allows to run the test suite. |
Seems like we should either make the switch no-op on Windows or change the PIC code to be used on Posix only. Though I am interested why it passed before and on the other Windows machine ... |
7785da6 to
aad0faa
Compare
... on Linux x86_64 distros where PIC/PIE is enforced. For more details, see: * https://wiki.gentoo.org/wiki/Hardened/Position_Independent_Code_internals * https://fedoraproject.org/wiki/Packaging:Guidelines#PIE * https://wiki.debian.org/Hardening/PIEByDefaultTransition * https://wiki.ubuntu.com/SecurityTeam/PIE * non-PIE linker support removed in Android 5.0: https://source.android.com/security/enhancements/enhancements50 * https://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/ We addressed the issues in the `dmd.conf` generated when dmd is build, the `dmd.conf` files we ship in the release packages, and the makefiles of druntime and phobos, but we haven't (yet) fixed the test suite build system. Because of that, on Linux x86_64 distros where PIC is enforced, the dmd test suite (the d_do_test.d test runner, as well as all test cases that require linking) fails to link and as a result is completely unusable. The first commit of this pull-request does the following: * adds a `PIC` variable to `test/Makefile`, which defaults to `1`, on x86_64 * exports a `PIC_FLAG` environment variable, which is set to `-fPIC` when `PIC` is set to `1` * adds `$(PIC_FLAG)` to `d_do_test.d`'s build command-line * appends `$(PIC_FLAG)` to the `REQUIRED_ARGS` variable, which is expanded in each `*.d` test case command-line The second and final commit adds the `$PIC_FLAG` environment variable to the dmd command-line in the shell-driven test cases, where the object files were linked. This was done by trial and error, by amending each failing test case, until I got the whole test suite to pass on my Ubuntu 17.10 system, minus two unrelated test failures: * `runnable/test_cdvecfill.d` - see https://issues.dlang.org/show_bug.cgi?id=18013 * runnable/test17559.d - stack traces don't work properly on my system, but I have yet to investigate the root cause. See also: * dlang#7002 * dlang/druntime#1880 * dlang/druntime#1974 * dlang/phobos#5586 * dlang/phobos#5868
aad0faa to
818f27d
Compare
|
I'm for making it a no-op. |
I assume you're referring to the So, I suggest the following:
Am I not understanding something? |
Oh, I already moved the regarding bits
Oh I was talking about the fact that we can't pass |
|
This PR was merged too quickly. This half of the commit message is wrong: |
... on Linux x86_64 distros where PIC/PIE is enforced.
(cherry-picked from #7427 by @ZombineDev)
This is the non-controversial part and common part of #7240 and #7427.
@ZombineDev I did two minor modifications:
REQUIRED_ARGSfor now as the test suite is still failing. Obviously we should let one CI run the test suite afterwards thoughDEBUG_ARGS=-g -fPICinstead of directly adding$(PIC_FLAG)to thed_do_testcompile invocations as this looks more general purpose.Original commit message:
For more details, see:
https://source.android.com/security/enhancements/enhancements50
We addressed the issues in the
dmd.confgenerated when dmd is build, thedmd.conffiles we ship in the release packages, and the makefiles ofdruntime and phobos, but we haven't (yet) fixed the test suite build
system. Because of that, on Linux x86_64 distros where PIC is enforced,
the dmd test suite (the d_do_test.d test runner, as well as all test
cases that require linking) fails to link and as a result is completely
unusable.
This pull-request does the following:
PICvariable totest/Makefile, which defaults to1, on x86_64PIC_FLAGenvironment variable, which is set to-fPICwhenPICis set to1$(PIC_FLAG)tod_do_test.d's build command-line$(PIC_FLAG)to theREQUIRED_ARGSvariable, which isexpanded in each
*.dtest case command-lineSee also:
Use -fPIC by default #7002
Enable -fPIC by default druntime#1880
fix Issue 17966 - don't build libphobos2.a with PIC for i386 druntime#1974
Issue 17375 - use -fPIC by default for Phobos on Posix phobos#5586
fix Issue 17996 - don't build libphobos2.a with PIC for i386 phobos#5868