Skip to content

Commit 27f69f4

Browse files
committed
Update: Unusing ldc conf parser since it may not be needed if it was only used for web assembly
1 parent 88566fe commit 27f69f4

File tree

5 files changed

+40
-35
lines changed

5 files changed

+40
-35
lines changed

source/redub/api.d

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ ProjectDetails buildProject(ProjectDetails d)
211211
ProjectNode tree = d.tree;
212212
if(d.useExistingObjFiles)
213213
tree.requirements.cfg.changedBuildFiles = getChangedBuildFiles(tree, session);
214-
int uses = tree.isUsingGnuLinker();
215-
if(uses != -1)
216-
session.compiler.usesGnuLinker = uses ? true : false;
214+
///TODO: Might be reactivated if that issue shows again.
215+
// int uses = tree.isUsingGnuLinker();
216+
// if(uses != -1)
217+
// session.compiler.usesGnuLinker = uses ? true : false;
217218
startHandlingConsoleControl();
218219

219220
auto result = timed(()

source/redub/buildapi.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import redub.package_searching.api;
88

99

1010
///vX.X.X
11-
enum RedubVersionOnly = "v1.21.5";
11+
enum RedubVersionOnly = "v1.21.6";
1212
///Redub vX.X.X
1313
enum RedubVersionShort = "Redub "~RedubVersionOnly;
1414
///Redub vX.X.X - Description

source/redub/command_generators/linkers.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ string[] parseLinkConfiguration(const ThreadBuildData data, CompilingSession s,
1212
string[] commands;
1313
bool isUsingGNULinker = s.compiler.usesGnuLinker;
1414

15+
1516
const BuildConfiguration b = data.cfg;
1617
with(b)
1718
{
@@ -40,14 +41,14 @@ string[] parseLinkConfiguration(const ThreadBuildData data, CompilingSession s,
4041
if (targetType.isLinkedSeparately)
4142
{
4243
//Only linux supports start/end group and no-as-needed. OSX does not
43-
if(isUsingGNULinker)
44+
if(s.isa != ISA.webAssembly)
4445
{
4546
commands~= "-L--no-as-needed";
4647
commands~= "-L--start-group";
4748
}
4849
///Use library full path for the base file
4950
commands = mapAppendReverse(commands, data.extra.librariesFullPath, (string l) => "-L"~getOutputName(TargetType.staticLibrary, l, s.os));
50-
if(isUsingGNULinker)
51+
if(s.isa != ISA.webAssembly)
5152
commands~= "-L--end-group";
5253
commands = mapAppendPrefix(commands, linkFlags, "-L", false);
5354
commands = mapAppendPrefix(commands, libraryPaths, "-L-L", true);

source/redub/compiler_identification.d

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ struct Compiler
5858

5959
bool usesIncremental = false;
6060

61+
///Currently unused. Was used before for checking whether --start-group should be emitted or not. Since it is emitted
62+
///by default, only on webAssembly which is not, it lost its usage for now.
6163
bool usesGnuLinker = false;
6264

6365

@@ -218,12 +220,13 @@ Compiler getCompiler(string compilerOrPath = "dmd", string compilerAssumption =
218220
ret.usesGnuLinker = compilersInfo["defaultsToGnuLd"].boolean;
219221

220222
//Checks for ldc.conf switches to see if it is using gnu linker by default
221-
if(ret.compiler == AcceptedCompiler.ldc2)
222-
{
223-
int res = isUsingGnuLinker(ret.binOrPath, arch);
224-
if(res != UsesGnuLinker.unknown)
225-
ret.usesGnuLinker = res == UsesGnuLinker.yes ? true : false;
226-
}
223+
///TODO: Might be reactivated if that issue shows again.
224+
// if(ret.compiler == AcceptedCompiler.ldc2)
225+
// {
226+
// int res = isUsingGnuLinker(ret.binOrPath, arch);
227+
// if(res != UsesGnuLinker.unknown)
228+
// ret.usesGnuLinker = res == UsesGnuLinker.yes ? true : false;
229+
// }
227230

228231

229232
return ret;
@@ -236,28 +239,28 @@ Compiler getCompiler(string compilerOrPath = "dmd", string compilerAssumption =
236239
* arch = Which architecture this compiler run is running with
237240
* Returns: -1 for can't tell. 0 if false and 1 if true
238241
*/
239-
private UsesGnuLinker isUsingGnuLinker(string ldcPath, string arch)
240-
{
241-
import redub.misc.ldc_conf_parser;
242-
import std.file;
243-
import std.algorithm.searching;
244-
ConfigSection section = getLdcConfig(std.file.getcwd(), ldcPath, arch);
245-
if(section == ConfigSection.init)
246-
return UsesGnuLinker.unknown;
247-
string* switches = "switches" in section.values;
248-
if(!switches)
249-
return UsesGnuLinker.unknown;
250-
string s = *switches;
251-
ptrdiff_t linkerStart = s.countUntil("-link");
252-
if(linkerStart == -1)
253-
return UsesGnuLinker.unknown;
254-
s = s[linkerStart..$];
255-
256-
if(countUntil(s, "-link-internally") != -1 || countUntil(s, "-linker=lld"))
257-
return UsesGnuLinker.no;
258-
259-
return countUntil(s, "-linker=ld") != -1 ? UsesGnuLinker.yes : UsesGnuLinker.unknown;
260-
}
242+
// private UsesGnuLinker isUsingGnuLinker(string ldcPath, string arch)
243+
// {
244+
// import redub.misc.ldc_conf_parser;
245+
// import std.file;
246+
// import std.algorithm.searching;
247+
// ConfigSection section = getLdcConfig(std.file.getcwd(), ldcPath, arch);
248+
// if(section == ConfigSection.init)
249+
// return UsesGnuLinker.unknown;
250+
// string* switches = "switches" in section.values;
251+
// if(!switches)
252+
// return UsesGnuLinker.unknown;
253+
// string s = *switches;
254+
// ptrdiff_t linkerStart = s.countUntil("-link");
255+
// if(linkerStart == -1)
256+
// return UsesGnuLinker.unknown;
257+
// s = s[linkerStart..$];
258+
259+
// if(countUntil(s, "-link-internally") != -1 || countUntil(s, "-linker=lld"))
260+
// return UsesGnuLinker.no;
261+
262+
// return countUntil(s, "-linker=ld") != -1 ? UsesGnuLinker.yes : UsesGnuLinker.unknown;
263+
// }
261264

262265

263266
private Compiler getCompilerFromGlobalPath(string compilerOrPath, JSONValue compilersInfo)

source/redub/misc/ldc_conf_parser.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ ConfigSection parseLDCConfig(string configText, string confToMatch)
133133
unittest
134134
{
135135
string ldc2example = q"EOS
136-
`// See comments in driver/config.d in ldc source tree for grammar description of
136+
// See comments in driver/config.d in ldc source tree for grammar description of
137137
// this config file.
138138
139139
// For cross-compilation, you can add sections for specific target triples by

0 commit comments

Comments
 (0)