Sun Studio 和“”,第 1 行:非法标志 (-)

Posted

技术标签:

【中文标题】Sun Studio 和“”,第 1 行:非法标志 (-)【英文标题】:Sun Studio and "", line 1 : Illegal flag (-) 【发布时间】:2016-06-08 01:47:53 【问题描述】:

我正在尝试查找在 Sun Studio 12.3 下的 Solaris 11.3 (x64) 上产生汇编程序错误 "", line 1 : Illegal flag (-) 的问题。 Sun Studio 编译器是一种特殊的地狱。

$ echo $CXX
/opt/solarisstudio12.3/bin/CC

$ cat test.cxx
#include <iostream>
int main(int argc, char* argv[])

  std::cout << argc << std::endl;
  return 0;


$ $CXX -DNDEBUG -xO2 -native -template=no%extdef -m64 -Kpic -Wa,--divide -c test.cxx
Assembler: 
        "", line 1 : Illegal flag (-)
CC: fbe failed for test.cxx

系统地删除-xO2-native-m64-Kpic 等...无法解决问题。我找到了similar report over at Mozilla,但删除调试符号并没有解决它。

汇编文件的第一行是.file ...(如下所示),所以我不清楚非法标志的来源。

为什么我会遇到 "", line 1 : Illegal flag (-),我该如何解决?


添加-v-keeptmp 会产生以下结果。

$ $CXX -v -keeptmp  -DNDEBUG -xO2 -native -template=no%extdef -m64 -Kpic -Wa,--divide -c test.cxx
### CC: Note: NLSPATH = /opt/solarisstudio12.3/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/solarisstudio12.3/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
###     command line files and options (expanded):
### -v -keeptmp -DNDEBUG -xO2 -xchip=core2 -xcache=32/64/8:4096/64/16 -xarch=ssse3 -template=%none -m64 -xcode=pic13 -Qoption fbe --divide -c test.cxx
/opt/solarisstudio12.3/prod/bin/ccfe -xarch=amd64 -D__SunOS_5_11 -D__SUNPRO_CC=0x5120 -D__unix -D__SVR4 -D__sun -D__SunOS -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ -D_LP64 -D__LP64__ -D__BUILTIN_VA_STRUCT -Dunix -Dsun -D__SUN_PREFETCH -D__SUNPRO_CC_COMPAT=5 -I-xbuiltin -I/opt/solarisstudio12.3/prod/include/CC/Cstd -I/opt/solarisstudio12.3/prod/include/CC -I/opt/solarisstudio12.3/prod/include/cc -DNDEBUG -ptf /tmp/ccfe.1465350303.23421.04.%1.%2 -template=%none -ptx /opt/solarisstudio12.3/prod/bin/CC -ptk "-v -keeptmp -DNDEBUG -xO2 -xtarget=native -template=no%extdef -m64 -xcode=pic13 -c " -compat=5 -instlib=/opt/solarisstudio12.3/prod/lib/amd64/libCstd.a -xdbggen=no%stabs+dwarf2+usedonly -xF=%none -xbuiltin=%default -pic -xldscope=global -xivdep=loop -O2 test.cxx -o /tmp/ccfe.1465350303.23421.01.ir -s /tmp/ccfe.1465350303.23421.02.sd 2> /tmp/ccfe.1465350303.23421.03.err
/opt/solarisstudio12.3/prod/bin/iropt -Qy -O2 -fstore -xarch=ssse3 -m64 -xchip=core2 "-xcache=32/64/8:4096/64/16" -fsimple=0 -fstore -k -xbuiltin=%default -I -xprefetch=auto,explicit -xprefetch_auto_type=no%indirect_array_access -xvector=no%lib,simd -F -o /tmp/iropt.1465350303.23421.05.ir -is /tmp/ccfe.1465350303.23421.02.sd /tmp/ccfe.1465350303.23421.01.ir 2> /tmp/iropt.1465350303.23421.06.err
/opt/solarisstudio12.3/prod/bin/ir2hf -Qy -O2 -xbuiltin=%default -m64 /tmp/iropt.1465350303.23421.05.ir /tmp/ccfe.1465350303.23421.02.sd /tmp/ir2hf.1465350303.23421.07.hf
/opt/solarisstudio12.3/prod/bin/ube -Qy -verbose -iropt -O2 -fstore -comdat -m64 -xarch=ssse3 -xchip=core2 "-xcache=32/64/8:4096/64/16" -xannotate=yes -fsimple=0 -ZW -fstore -pic -xbuiltin=%default -xprefetch=auto,explicit -xthreadvar=dynamic -fbe /opt/solarisstudio12.3/prod/bin/fbe -ipo test.o -S /tmp/ube.1465350303.23421.08.s /tmp/ir2hf.1465350303.23421.07.hf
/opt/solarisstudio12.3/prod/bin/fbe -Qy -xarch=amd64 -xchip=core2 -warn=%none --divide -o test.o /tmp/ube.1465350303.23421.08.s
Assembler: 
        "", line 1 : Illegal flag (-)
CC: fbe failed for test.cxx


$ cat /tmp/ube.1465350303.23421.08.s
        .file "test.cxx"
        .code64

        .set .simple_nop, 0x90
        .globl main
        .type main, @function
        .globl __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___2l6Mi_r1_
        .type __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___2l6Mi_r1_, @function
        .symbolic __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
        .globl __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
        .type __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_, @function
        .globl __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___2l6MpFr1_2_2_
        .type __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___2l6MpFr1_2_2_, @function
        .globl __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___Dput6Mc_r1_
        .type __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___Dput6Mc_r1_, @function
        .globl __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___Fflush6M_r1_
        .type __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___Fflush6M_r1_, @function
        .local Dlrodata.lrodata
        .local Dldata.ldata
        .globl __fsr_init_value
__fsr_init_value = 0
        .weak __SUNW_ABI2_cpp_personality

        .ident     "iropt: Sun Compiler Common 12.3 SunOS_i386 2011/11/16"
        .ident     "ir2hf: Sun Compiler Common 12.3 SunOS_i386 2011/11/16"
        .ident     "ube: Sun Compiler Common 12.3 SunOS_i386 2011/11/16"

        .section .text,"ax"
        .align 16,.simple_nop
main:
.CG2:
.CG3:
        push    %rbp
.CG4:
        movq    %rsp,%rbp
.CG5:
        movl    %edi,%esi
        movq    __1cDstdEcout_@GOTPCREL(%rip),%rdi

.CG6:   call    __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___2l6Mi_r1_@PLT
        movq    __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_@GOTPCREL(%rip),%rsi
        movq    %rax,%rdi

.CG7:   call    __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___2l6MpFr1_2_2_@PLT
        xorl    %eax,%eax
        leave   
        ret     

.CG8:
        .size main, . - main
.CG9:

.CGA:

.CGB:

        .group __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,.text%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,#comdat

        .section .text%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,"ax"
        .align 16,.simple_nop
__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_:
.CGE:
.CGF:
        push    %rbp
.CG10:
        movq    %rsp,%rbp
.CG11:
        push    %rbx
.CG12:
        subq    $8,%rsp
        movq    %rdi,%rbx
        movl    $10,%esi

.CG13:  call    __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___Dput6Mc_r1_@PLT
        movq    %rbx,%rdi

.CG14:  call    __1cDstdNbasic_ostream4Ccn0ALchar_traits4Cc___Fflush6M_r1_@PLT
        movq    %rbx,%rax
        addq    $8,%rsp
        pop     %rbx
        leave   
        ret     

.CG15:
        .size __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_, . - __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
.CG16:

.CG17:

.CG18:


        .section .data,"aw"
Ddata.data: / Offset 0



        .section .bss,"aw"

Bbss.bss:


        .section .bssf,"aw"


        .section .rodata,"a"
Drodata.rodata: / Offset 0



        .section .picdata,"aw"
Dpicdata.picdata: / Offset 0



        .section .lbss,"awh"
        .type Blbss.lbss, @object

Blbss.lbss:


        .section .ldata,"awh"
Dldata.ldata: / Offset 0
        .type Dldata.ldata, @object



        .section .lrodata,"ah"
Dlrodata.lrodata: / Offset 0
        .type Dlrodata.lrodata, @object


        .group  __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,.eh_frame%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,#comdat
        .section        .eh_frame%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,"aL",link=.text%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,@unwind
.Lframe1:
        .long   .LECIE1-.LBCIE1
.LBCIE1:
        .long   0x0
        .byte   0x1
        .string "zPR"
        .uleb128        0x1
        .sleb128        -8
        .byte   0x10
        .uleb128 6
        .byte 0x1b
        .long __SUNW_ABI2_cpp_personality@plt
        .byte 0x1b
        .byte   0xc
        .uleb128        0x7
        .uleb128        0x8
        .byte   0x90
        .uleb128        0x1
        .byte   0x8
        .byte   0xc
        .byte   0x8
        .byte   0xd
        .byte   0x8
        .byte   0xe
        .byte   0x8
        .byte   0xf
        .align 8
.LECIE1:
        .long   .LEFDE0-.LBFDE0
.LBFDE0:
        .long   .LBFDE0-.Lframe1
        .long   .CGF@rel
        .long   .CG15-.CGF
        .uleb128        0x0
        .cfa_advance_loc        .CG10-.CGF
        .byte   0xe
        .uleb128        0x10
        .byte   0x86
        .uleb128        0x2
        .cfa_advance_loc        .CG11-.CG10
        .byte   0xd
        .uleb128        0x6
        .cfa_advance_loc        .CG12-.CG11
        .byte   0x83
        .uleb128        0x3
        .align  8
.LEFDE0:

        .section .eh_frame,"aL",link=.text,@unwind
.Lframe2:
        .long   .LECIE2-.LBCIE2
.LBCIE2:
        .long   0x0
        .byte   0x1
        .string "zPR"
        .uleb128        0x1
        .sleb128        -8
        .byte   0x10
        .uleb128 6
        .byte 0x1b
        .long __SUNW_ABI2_cpp_personality@plt
        .byte 0x1b
        .byte   0xc
        .uleb128        0x7
        .uleb128        0x8
        .byte   0x90
        .uleb128        0x1
        .byte   0x8
        .byte   0xc
        .byte   0x8
        .byte   0xd
        .byte   0x8
        .byte   0xe
        .byte   0x8
        .byte   0xf
        .align 8
.LECIE2:
        .long   .LEFDE1-.LBFDE1
.LBFDE1:
        .long   .LBFDE1-.Lframe2
        .long   .CG3@rel
        .long   .CG8-.CG3
        .uleb128        0x0
        .cfa_advance_loc        .CG4-.CG3
        .byte   0xe
        .uleb128        0x10
        .byte   0x86
        .uleb128        0x2
        .cfa_advance_loc        .CG5-.CG4
        .byte   0xd
        .uleb128        0x6
        .align  8
.LEFDE1:


        .section .annotate
        / ANNOTATION: Header
        .string "anotate"
        .4byte 6
        .4byte 0
        .8byte .CG1 - .CG0
.CG0:
        / ANNOTATION: Module
        .4byte 0
        .4byte .CG1A - .CG19
.CG19:
        .8byte .text
        .8byte .CGB - .text
.CG1A:
        / ANNOTATION: Function
        .4byte 1
        .4byte .CG1C - .CG1B
.CG1B:
        .8byte .CG2
        .8byte .CGB - .CG2
        .4byte -2145086976
        .4byte 0
.CG1C:
.CG1:
        / ANNOTATION: End


        .group __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,.annotate%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_,#comdat

        .section .annotate%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
        / ANNOTATION: Header
        .string "anotate"
        .4byte 6
        .4byte 0
        .8byte .CGD - .CGC
.CGC:
        / ANNOTATION: Module
        .4byte 0
        .4byte .CG1E - .CG1D
.CG1D:
        .8byte .text%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
        .8byte .CG18 - .text%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
.CG1E:
        / ANNOTATION: Function
        .4byte 1
        .4byte .CG20 - .CG1F
.CG1F:
        .8byte .CGE
        .8byte .CG18 - .CGE
        .4byte -2145089020
        .4byte 0
.CG20:
.CGD:
        / ANNOTATION: End

/  Begin sdCreateSection : .debug_info
/  Section Info: link_name/strtab=, entsize=0x1, adralign=0x1, flags=0x0
/  Section Data Blocks:
/   reloc[0]: knd=2, off=14, siz=8, lab1=.debug_abbrev, lab2=, loff=0
/   reloc[1]: knd=2, off=301, siz=8, lab1=.debug_line, lab2=, loff=0
        .section .debug_info
        .byte 0xff,0xff,0xff,0xff,0x2a,0x01,0x00,0x00
        .byte 0x00,0x00,0x00,0x00,0x02,0x00
        .8byte .debug_abbrev
        .byte 0x08,0x01
        .ascii "test.cxx\0"
        .byte 0x04
        .ascii "/export/home/jwalton/cryptopp/\0"
        .ascii " /opt/solarisstudio12.3/prod/bin/CC -v -keeptmp -DNDEBUG -xO2 -xtarget=native -template=no%extdef -m64 -xcode=pic13 -c  test.cxx\0"
        .ascii "ptf;ptx;ptk;pic;s;;O;R=5.11<<Sun C++ 5.12 SunOS_i386 2011/11/16 (ccfe)>>;A=2;backend;raw;cd;\0"
        .ascii "DBG_GEN 5.3.3\0"
        .8byte .debug_line
        .byte 0x00
/  End sdCreateSection
/  Begin sdCreateSection : .debug_line
/  Section Info: link_name/strtab=, entsize=0x1, adralign=0x1, flags=0x0
/  Section Data Blocks:
        .section .debug_line
        .byte 0xff,0xff,0xff,0xff,0x26,0x00,0x00,0x00
        .byte 0x00,0x00,0x00,0x00,0x02,0x00,0x1c,0x00
        .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00
        .byte 0xff,0x04,0x0a,0x00,0x01,0x01,0x01,0x01
        .byte 0x00,0x00,0x00,0x01,0x00,0x74,0x65,0x73
        .byte 0x74,0x2e,0x63,0x78,0x78,0x00,0x00,0x00
        .byte 0x00,0x00
/  End sdCreateSection
/  Begin sdCreateSection : .debug_abbrev
/  Section Info: link_name/strtab=, entsize=0x1, adralign=0x1, flags=0x0
/  Section Data Blocks:
        .section .debug_abbrev
        .byte 0x01,0x11,0x00,0x03,0x08,0x13,0x0b,0x1b
        .byte 0x08,0x85,0x44,0x08,0x87,0x44,0x08,0x25
        .byte 0x08,0x10,0x07,0x00,0x00,0x00
/  End sdCreateSection

【问题讨论】:

产生相同错误的最简单命令行是什么?例如。 cc test.cxx 【参考方案1】:

您的问题是-Wa,--divide 根据多个来源--divide 不是汇编程序的有效参数。例如,请参阅https://docs.oracle.com/cd/E37069_01/html/E54439/fbe-1.html 以获取接受的参数。

为了得出这个结论,我从您的-v 输出开始。我看到的关键行是它在运行 fbe 后立即失败,并且错误是 Assembler: "", line 1 : Illegal flag (-)。我很确定第 1 行部分是红鲱鱼,所以我直接去了Illegal flag (-) 部分,因为如果--divide 实际上被解释为-- -d -i -v -i -d -e,这正是你会得到的错误,这是一种完全常见的方式Unix 程序解释它们的参数。所以我只是用谷歌搜索了“fbe 命令行参数”(或类似的东西),看看这是否是一个有效的参数。

【讨论】:

谢谢马克。请原谅我的无知...您是如何从诊断中识别出-Wa,--divide 的? Line 1 指的是哪里?我是 Sun Studio 的新手,所以我想弄清楚如何在不求助于 Stack Overflow 的情况下做到这一点。 (为了告诉你我是多么的天真,我不知道fbe 是一个程序还是汇编程序)。

以上是关于Sun Studio 和“”,第 1 行:非法标志 (-)的主要内容,如果未能解决你的问题,请参考以下文章

Visual Studio C++ 编译器标志:-Zm200 是啥?

在模块中找不到 (1) 中引用的非法预处理器指令和符号

非法选项:Files\Android"Android Studio\jre\bin\keytool 密钥和证书管理工具

Visual Studio - 路径中的非法字符

面向 XP 的 Visual Studio 2013 的 Visual C++ 编译器标志

Android Studio:错误:非法字符:'\u2028'