Skip to content

Commit cbcfc9d

Browse files
authored
- use g++ for c++ source files
- support select gcc linker driver
1 parent 5b5c9c4 commit cbcfc9d

14 files changed

+164
-27
lines changed

lang/any.gcc.verify.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
"description.zh-cn": "链接器类型",
199199
"enum": [
200200
"gcc",
201+
"g++",
201202
"ld"
202203
]
203204
},

lang/arm.gcc.verify.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,17 @@
286286
"description.zh-cn": "链接器选项",
287287
"type": "object",
288288
"properties": {
289+
"linker-driver": {
290+
"type": "string",
291+
"default": "auto",
292+
"description": "Linker Driver",
293+
"description.zh-cn": "链接器驱动程序",
294+
"enum": [
295+
"auto",
296+
"gcc",
297+
"g++"
298+
]
299+
},
289300
"output-format": {
290301
"type": "string",
291302
"default": "elf",

lang/mips.mti.gcc.verify.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,17 @@
301301
"description.zh-cn": "链接器选项",
302302
"type": "object",
303303
"properties": {
304+
"linker-driver": {
305+
"type": "string",
306+
"default": "auto",
307+
"description": "Linker Driver",
308+
"description.zh-cn": "链接器驱动程序",
309+
"enum": [
310+
"auto",
311+
"gcc",
312+
"g++"
313+
]
314+
},
304315
"output-format": {
305316
"type": "string",
306317
"default": "elf",

lang/riscv.gcc.verify.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,17 @@
298298
"description.zh-cn": "链接器选项",
299299
"type": "object",
300300
"properties": {
301+
"linker-driver": {
302+
"type": "string",
303+
"default": "auto",
304+
"description": "Linker Driver",
305+
"description.zh-cn": "链接器驱动程序",
306+
"enum": [
307+
"auto",
308+
"gcc",
309+
"g++"
310+
]
311+
},
301312
"output-format": {
302313
"type": "string",
303314
"default": "elf",

res/data/models/unix/any.gcc.model.json

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"$output": "-o ${out} -MMD ${in}"
7878
},
7979
"cpp": {
80-
"$path": "bin/${toolPrefix}gcc",
80+
"$path": "bin/${toolPrefix}g++",
8181
"$includes": {
8282
"body": "-I${value}"
8383
},
@@ -144,6 +144,45 @@
144144
"command": ""
145145
}
146146
},
147+
"linker-g++": {
148+
"$path": "bin/${toolPrefix}g++",
149+
"$libs": {
150+
"body": "-L${value}"
151+
},
152+
"$invoke": {
153+
"useFile": true,
154+
"body": "@${value}"
155+
},
156+
"$output": "-o ${out} ${in} ${lib_flags}",
157+
"$outputSuffix": ".elf",
158+
"$linkMap": {
159+
"type": "value",
160+
"command": "-Wl,-Map=${mapPath}"
161+
},
162+
"$LIB_FLAGS": {
163+
"type": "list",
164+
"command": ""
165+
},
166+
"linker-script": {
167+
"type": "list",
168+
"command": "-T "
169+
},
170+
"remove-unused-input-sections": {
171+
"type": "selectable",
172+
"command": {
173+
"true": "-Wl,--gc-sections",
174+
"false": ""
175+
}
176+
},
177+
"misc-control": {
178+
"type": "list",
179+
"command": ""
180+
},
181+
"LD_FLAGS": {
182+
"type": "list",
183+
"command": ""
184+
}
185+
},
147186
"linker-ld": {
148187
"$path": "bin/${toolPrefix}ld",
149188
"$libs": {

res/data/models/unix/arm.gcc.model.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
}
319319
},
320320
"cpp": {
321-
"$path": "bin/${toolPrefix}gcc",
321+
"$path": "bin/${toolPrefix}g++",
322322
"$includes": {
323323
"body": "-I${value}"
324324
},
@@ -332,7 +332,6 @@
332332
"$output": "-o ${out} -MMD ${in}",
333333
"$default": [
334334
"-c",
335-
"-xc++",
336335
"-mthumb"
337336
],
338337
"$language-cpp": {
@@ -400,7 +399,8 @@
400399
}
401400
},
402401
"linker": {
403-
"$path": "bin/${toolPrefix}gcc",
402+
"$path": "bin/${toolPrefix}${toolName}",
403+
"$defToolName": "gcc",
404404
"$libs": {
405405
"body": "-L${value}"
406406
},

res/data/models/unix/mips.mti.gcc.model.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
}
196196
},
197197
"cpp": {
198-
"$path": "bin/${toolPrefix}gcc",
198+
"$path": "bin/${toolPrefix}g++",
199199
"$includes": {
200200
"body": "-I${value}"
201201
},
@@ -208,8 +208,7 @@
208208
},
209209
"$output": "-o ${out} -MMD ${in}",
210210
"$default": [
211-
"-c",
212-
"-xc++"
211+
"-c"
213212
],
214213
"$language-cpp": {
215214
"type": "keyValue",
@@ -247,7 +246,8 @@
247246
}
248247
},
249248
"linker": {
250-
"$path": "bin/${toolPrefix}gcc",
249+
"$path": "bin/${toolPrefix}${toolName}",
250+
"$defToolName": "gcc",
251251
"$libs": {
252252
"body": "-L${value}"
253253
},

res/data/models/unix/riscv.gcc.model.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
}
207207
},
208208
"cpp": {
209-
"$path": "bin/${toolPrefix}gcc",
209+
"$path": "bin/${toolPrefix}g++",
210210
"$includes": {
211211
"body": "-I${value}"
212212
},
@@ -219,8 +219,7 @@
219219
},
220220
"$output": "-o ${out} -MMD ${in}",
221221
"$default": [
222-
"-c",
223-
"-xc++"
222+
"-c"
224223
],
225224
"$language-cpp": {
226225
"type": "keyValue",
@@ -258,7 +257,8 @@
258257
}
259258
},
260259
"linker": {
261-
"$path": "bin/${toolPrefix}gcc",
260+
"$path": "bin/${toolPrefix}${toolName}",
261+
"$defToolName": "gcc",
262262
"$libs": {
263263
"body": "-L${value}"
264264
},

res/data/models/win32/any.gcc.model.json

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"$output": "-o ${out} -MMD ${in}"
7878
},
7979
"cpp": {
80-
"$path": "bin\\${toolPrefix}gcc.exe",
80+
"$path": "bin\\${toolPrefix}g++.exe",
8181
"$includes": {
8282
"body": "-I${value}"
8383
},
@@ -144,6 +144,45 @@
144144
"command": ""
145145
}
146146
},
147+
"linker-g++": {
148+
"$path": "bin\\${toolPrefix}g++.exe",
149+
"$libs": {
150+
"body": "-L${value}"
151+
},
152+
"$invoke": {
153+
"useFile": true,
154+
"body": "@${value}"
155+
},
156+
"$output": "-o ${out} ${in} ${lib_flags}",
157+
"$outputSuffix": ".elf",
158+
"$linkMap": {
159+
"type": "value",
160+
"command": "-Wl,-Map=${mapPath}"
161+
},
162+
"$LIB_FLAGS": {
163+
"type": "list",
164+
"command": ""
165+
},
166+
"remove-unused-input-sections": {
167+
"type": "selectable",
168+
"command": {
169+
"true": "-Wl,--gc-sections",
170+
"false": ""
171+
}
172+
},
173+
"linker-script": {
174+
"type": "list",
175+
"command": "-T "
176+
},
177+
"misc-control": {
178+
"type": "list",
179+
"command": ""
180+
},
181+
"LD_FLAGS": {
182+
"type": "list",
183+
"command": ""
184+
}
185+
},
147186
"linker-ld": {
148187
"$path": "bin\\${toolPrefix}ld.exe",
149188
"$libs": {

res/data/models/win32/arm.gcc.model.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
}
319319
},
320320
"cpp": {
321-
"$path": "bin\\${toolPrefix}gcc.exe",
321+
"$path": "bin\\${toolPrefix}g++.exe",
322322
"$includes": {
323323
"body": "-I${value}"
324324
},
@@ -332,7 +332,6 @@
332332
"$output": "-o ${out} -MMD ${in}",
333333
"$default": [
334334
"-c",
335-
"-xc++",
336335
"-mthumb"
337336
],
338337
"$language-cpp": {
@@ -400,7 +399,8 @@
400399
}
401400
},
402401
"linker": {
403-
"$path": "bin\\${toolPrefix}gcc.exe",
402+
"$path": "bin\\${toolPrefix}${toolName}.exe",
403+
"$defToolName": "gcc",
404404
"$libs": {
405405
"body": "-L${value}"
406406
},

0 commit comments

Comments
 (0)