r207833 - XCore target: fix handling of -g0 flag

David Blaikie dblaikie at gmail.com
Fri May 2 11:04:06 PDT 2014


On Fri, May 2, 2014 at 8:33 AM, Robert Lytton <robert at xmos.com> wrote:
> Hi David,
>
> The patch is to the XCore::Assemble::ConstructJob() method.
> The OPT_g_Group flags are all forwarded to the external xcore assembler as a
> '-g' flag,  apart from '-g0',  hence the fix.
> Other assemblers may require different flags as directed by their
> Assemble::ConstructJob() specialization.
>
> Does this answer your question?

Somewhat - a quick survey shows that there's a similar bug in darwin
and visualstudio support... not sure if there's a nicer way to handle
this so we don't have to refix the bug everywhere.

>
> Robert
>
> ________________________________
> From: David Blaikie [dblaikie at gmail.com]
> Sent: 02 May 2014 15:45
> To: Robert Lytton
> Cc: llvm cfe
> Subject: Re: r207833 - XCore target: fix handling of -g0 flag
>
> Is there any reason this code is xcore specific? Would've figured the basic
> debug flags would mostly be covered in some generic way? But I haven't
> looked. Perhaps there's good reason not to do that.
>
> On May 2, 2014 2:43 AM, "Robert Lytton" <robert at xmos.com> wrote:
>>
>> Author: rlytton
>> Date: Fri May  2 04:33:25 2014
>> New Revision: 207833
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=207833&view=rev
>> Log:
>> XCore target: fix handling of -g0 flag
>>
>> Modified:
>>     cfe/trunk/lib/Driver/Tools.cpp
>>     cfe/trunk/test/Driver/xcore-opts.c
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=207833&r1=207832&r2=207833&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Fri May  2 04:33:25 2014
>> @@ -7622,8 +7622,9 @@ void XCore::Assemble::ConstructJob(Compi
>>    if (Args.hasArg(options::OPT_v))
>>      CmdArgs.push_back("-v");
>>
>> -  if (Args.hasArg(options::OPT_g_Group))
>> -    CmdArgs.push_back("-g");
>> +  if (Arg *A = Args.getLastArg(options::OPT_g_Group))
>> +    if (!A->getOption().matches(options::OPT_g0))
>> +      CmdArgs.push_back("-g");
>>
>>    if (Args.hasFlag(options::OPT_fverbose_asm,
>> options::OPT_fno_verbose_asm,
>>                     false))
>>
>> Modified: cfe/trunk/test/Driver/xcore-opts.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/xcore-opts.c?rev=207833&r1=207832&r2=207833&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Driver/xcore-opts.c (original)
>> +++ cfe/trunk/test/Driver/xcore-opts.c Fri May  2 04:33:25 2014
>> @@ -1,6 +1,7 @@
>>  // RUN: %clang -target xcore %s -g -Wl,L1Arg,L2Arg -Wa,A1Arg,A2Arg
>> -fverbose-asm -v -### -o %t.o 2>&1 | FileCheck %s
>>  // RUN: %clang -target xcore -x c++ %s -g -Wl,L1Arg,L2Arg -Wa,A1Arg,A2Arg
>> -fverbose-asm -v -### -o %t.o 2>&1 | FileCheck %s
>>  // RUN: %clang -target xcore -x c++ %s -fexceptions -### -o %t.o 2>&1 |
>> FileCheck -check-prefix CHECK-EXCEP %s
>> +// RUN: %clang -target xcore %s -g0 -### -o %t.o 2>&1 | FileCheck
>> -check-prefix CHECK-G0 %s
>>
>>  // CHECK: "-nostdsysteminc"
>>  // CHECK: "-momit-leaf-frame-pointer"
>> @@ -27,3 +28,7 @@
>>  // CHECK-EXCEP: xcc" "-o"
>>  // CHECK-EXCEP: "-fexceptions"
>>
>> +// CHECK-G0: xcc"
>> +// CHECK-G0-NOT: "-g"
>> +// CHECK-G0: xcc"
>> +
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list