@@ -1917,6 +1917,30 @@ class AC6 implements IToolchian {
19171917 if ( options [ 'c/cpp-compiler' ] && options [ 'c/cpp-compiler' ] [ 'link-time-optimization' ] ) {
19181918 options [ 'linker' ] [ 'link-time-optimization' ] = options [ 'c/cpp-compiler' ] [ 'link-time-optimization' ] ;
19191919 }
1920+
1921+ // AC6 的汇编器模式:
1922+ // - armclang (GNU Syntax):使用 armclang 来编译汇编源代码(对应命令行选项 -masm=gnu),然后强制使用 GNU 汇编语法风格
1923+ // - armclang (Arm Syntax):使用armclang来编译汇编源代码(对应命令行选项 -masm=armasm),然后强制使用 UAL 汇编语法风格。
1924+ // - armclang(Auto Select):使用 armclang 来编译汇编源代码(对应命令行选项 -masm=auto)
1925+ //! 暂时废弃:因为使用 arm-clang -masm=auto 不能完全兼容旧的 .s 文件,
1926+ // --predefine 不等同于编译器选项 -Dname。--predefine 定义了一个全局变量,而 -Dname 定义了 C 预处理器扩展的宏。
1927+ // 见:https://developer.arm.com/documentation/dui0473/m/assembler-command-line-options/--predefine--directive-
1928+ // 一些汇编文件中存在 `IF :DEF:__MICROLIB` 这需要一个全局变量定义而不是宏定义,
1929+ // - 对于 armasm 它提供 --pd "__MICROLIB SETA 1" 以设置变量 __MICROLIB
1930+ // - 对于 armclang 它使用了预处理器定义 -D__MICROLIB 并替换宏定义为值 1,但 .s 需要一个变量,因此出现 Symbol missing 错误
1931+ // if (options['asm-compiler']) {
1932+ // // 选择 asm-auto 将使用 `armclang(Auto Select)` 模式,与 MDK 相同
1933+ // if (options['asm-compiler']['$use'] == 'asm-auto') {
1934+ // options['asm-compiler']['$use'] = 'asm-clang';
1935+ // options['asm-compiler']['masm'] = 'auto';
1936+ // }
1937+ // } else {
1938+ // // 默认情况下,使用 arm-clang + -masm=auto
1939+ // options['asm-compiler'] = {
1940+ // '$use': 'asm-clang',
1941+ // 'masm': 'auto'
1942+ // };
1943+ // }
19201944 }
19211945
19221946 getToolchainDir ( ) : File {
@@ -1980,7 +2004,8 @@ class AC6 implements IToolchian {
19802004 "link-time-optimization" : false
19812005 } ,
19822006 'asm-compiler' : {
1983- "$use" : "asm-auto"
2007+ "$use" : "asm-auto" ,
2008+ "misc-controls" : ""
19842009 } ,
19852010 linker : {
19862011 "$outputTaskExcludes" : [ ".bin" ] ,
0 commit comments