Thread overview
[Issue 18014] DMD test suite fails to link on Linux distros where PIC/PIE is enforced
[Issue 18014] DMD test suite fails to build/run on Ubuntu 17.04 due to PIC
Nov 26, 2017
ZombineDev
[Issue 18014] DMD test suite fails to build/run on Ubuntu 17.04 because -fPIC is not properly set
Nov 26, 2017
ZombineDev
Nov 27, 2017
ZombineDev
Dec 12, 2017
Seb
November 26, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody@puremagic.com        |petar.p.kirov@gmail.com

--
November 26, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|DMD test suite fails to     |DMD test suite fails to
                   |build/run on Ubuntu 17.04   |build/run on Ubuntu 17.04
                   |due to PIC                  |because -fPIC is not
                   |                            |properly set

--
November 27, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|DMD test suite fails to     |DMD test suite fails to
                   |build/run on Ubuntu 17.04   |link on Linux distros where
                   |because -fPIC is not        |PIC/PIE is enforced
                   |properly set                |

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

Seb <greensunny12@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |greensunny12@gmail.com

--- Comment #1 from Seb <greensunny12@gmail.com> ---
I'm sorry - I didn't see this issue.
I'm linking to the PR I opened for posterity:
https://github.com/dlang/dmd/pull/7420

--
December 15, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

--- Comment #2 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/818f27d0b969d08b7e705541e9524ce906fdc709 Fix issue 18014 - dmd test suite fails to link (part 1/2)

... 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:
* https://github.com/dlang/dmd/pull/7002

* https://github.com/dlang/druntime/pull/1880
* https://github.com/dlang/druntime/pull/1974

* https://github.com/dlang/phobos/pull/5586
* https://github.com/dlang/phobos/pull/5868

https://github.com/dlang/dmd/commit/64424027452125693483b36022827e6c401e2307 Merge pull request #7433 from wilzbach/hardening-part-1

Fix issue 18014 - dmd test suite fails to link (part 1/2) merged-on-behalf-of: Mike Franklin <JinShil@users.noreply.github.com>

--
December 15, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
December 18, 2017
https://issues.dlang.org/show_bug.cgi?id=18014

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/818f27d0b969d08b7e705541e9524ce906fdc709 Fix issue 18014 - dmd test suite fails to link (part 1/2)

https://github.com/dlang/dmd/commit/64424027452125693483b36022827e6c401e2307 Merge pull request #7433 from wilzbach/hardening-part-1

--
January 24, 2018
https://issues.dlang.org/show_bug.cgi?id=18014

--- Comment #4 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/252ab44d00f3427d6ed35d7823cd0844ba5f909a Allow to run the DMD testsuite on hardened systems (#7420)

* Use a special D docker image for CircleCi

* Fix Issue 18014 - Allow to run the DMD testsuite on hardened systems

--