d: Fix order of precedence for -defaultlib and -debuglib
authorIain Buclaw <ibuclaw@gdcproject.org>
Fri, 24 Apr 2020 21:39:32 +0000 (23:39 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Fri, 24 Apr 2020 21:39:32 +0000 (23:39 +0200)
commit0b4718956d6a3030dacd0e65f6a21c674593b9ca
treefe0aff5a3b463dbc2be7987281aa3e301337df98
parent28b733ea04f4f5d85cab621e901aa8ba7b6b1ae4
d: Fix order of precedence for -defaultlib and -debuglib

The order of precedence used by the upstream reference compiler for
determining what library to link against is:
- No library if -nophoboslib or -fno-druntime was seen.
- The library passed to -debuglib if -g was also seen.
- The library passed to -defaultlib
- The in-tree libgphobos library.

This aligns the D language driver to follow the same rules.

gcc/d/ChangeLog:

* d-spec.cc (need_phobos): Remove.
(lang_specific_driver): Replace need_phobos with phobos_library.
Reorder -debuglib and -defaultlib to have precedence over libphobos.
(lang_specific_pre_link): Remove test for need_phobos.
gcc/d/ChangeLog
gcc/d/d-spec.cc