MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / runLinker

Method runLinker

lib/compilers/assembly.ts:115–142  ·  view source on GitHub ↗
(fullResult: BuildResult, inputArch: Arch, objectFilename: string, outputFilename: string)

Source from the content-addressed store, hash-verified

113 }
114
115 async runLinker(fullResult: BuildResult, inputArch: Arch, objectFilename: string, outputFilename: string) {
116 const execOptions = this.getDefaultExecOptions();
117 execOptions.customCwd = path.dirname(objectFilename);
118
119 const options = ['-o', outputFilename];
120 if (inputArch === 'x86') {
121 options.push('-m', 'elf_i386');
122 } else if (inputArch === 'x86_64') {
123 // default target
124 } else {
125 const result: BuildStep = {
126 code: -1,
127 step: 'ld',
128 stderr: [{text: 'Invalid architecture for linking and execution'}],
129 okToCache: false,
130 filenameTransform: (fn: string) => fn,
131 stdout: [],
132 execTime: 0,
133 timedOut: false,
134 compilationOptions: [],
135 };
136 fullResult.buildsteps!.push(result);
137 return result;
138 }
139 options.push(objectFilename);
140
141 return this.doBuildstepAndAddToResult(fullResult, 'ld', this.env.ceProps('ld') as string, options, execOptions);
142 }
143
144 override getExecutableFilename(dirPath: string) {
145 return path.join(dirPath, 'ce-asm-executable');

Callers 1

Calls 3

pushMethod · 0.80
getDefaultExecOptionsMethod · 0.45

Tested by

no test coverage detected