[lld] r189310 - Fix use of temporary strings.

Rui Ueyama ruiu at google.com
Mon Aug 26 22:07:07 PDT 2013


String allocation is pretty cheap so I don't think it's worth to do, but if
it does, we should probably copy the entire .drectve section to the linker
context's allocator before passing it to parse().


On Mon, Aug 26, 2013 at 10:01 PM, Shankar Easwaran
<shankare at codeaurora.org>wrote:

> Do you want to detect and do this only for when you process directive
> sections ?
>
>
> On 8/27/2013 12:00 AM, Rui Ueyama wrote:
>
>> Yes if they are pointing to .drectve section they could become invalid
>> references.
>>
>>
>> On Mon, Aug 26, 2013 at 9:57 PM, Shankar Easwaran
>> <shankare at codeaurora.org>**wrote:
>>
>>  How are these temporary strings ? They all are pointing to the arguments
>>> argv[].
>>>
>>> Is this to handle the .directive file ?
>>>
>>> Thanks
>>>
>>> Shankar Easwaran
>>>
>>>
>>> On 8/26/2013 11:27 PM, Rui Ueyama wrote:
>>>
>>>  Author: ruiu
>>>> Date: Mon Aug 26 23:27:18 2013
>>>> New Revision: 189310
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-****project?rev=189310&view=rev<http://llvm.org/viewvc/llvm-**project?rev=189310&view=rev>
>>>> <ht**tp://llvm.org/viewvc/llvm-**project?rev=189310&view=rev<http://llvm.org/viewvc/llvm-project?rev=189310&view=rev>
>>>> >
>>>>
>>>> Log:
>>>> Fix use of temporary strings.
>>>>
>>>> Modified:
>>>>       lld/trunk/lib/Driver/****WinLinkDriver.cpp
>>>>
>>>> Modified: lld/trunk/lib/Driver/****WinLinkDriver.cpp
>>>> URL: http://llvm.org/viewvc/llvm-****project/lld/trunk/lib/Driver/****<http://llvm.org/viewvc/llvm-**project/lld/trunk/lib/Driver/**>
>>>> WinLinkDriver.cpp?rev=189310&****r1=189309&r2=189310&view=**diff<
>>>> http://llvm.org/viewvc/**llvm-project/lld/trunk/lib/**
>>>> Driver/WinLinkDriver.cpp?rev=**189310&r1=189309&r2=189310&**view=diff<http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=189310&r1=189309&r2=189310&view=diff>
>>>> >
>>>> ==============================****============================**==**
>>>> ==================
>>>> --- lld/trunk/lib/Driver/****WinLinkDriver.cpp (original)
>>>> +++ lld/trunk/lib/Driver/****WinLinkDriver.cpp Mon Aug 26 23:27:18 2013
>>>>
>>>> @@ -350,12 +350,12 @@ bool WinLinkDriver::parse(int argc, cons
>>>>          case OPT_entry:
>>>>          // handle /entry
>>>> -      ctx.setEntrySymbolName(****inputArg->getValue());
>>>> +      ctx.setEntrySymbolName(ctx.****allocateString(inputArg->**
>>>>
>>>> getValue()));
>>>>          break;
>>>>          case OPT_libpath:
>>>>          // handle /libpath
>>>> -      ctx.appendInputSearchPath(****inputArg->getValue());
>>>> +      ctx.appendInputSearchPath(ctx.****allocateString(inputArg->**
>>>>
>>>> getValue()));
>>>>          break;
>>>>          case OPT_force:
>>>> @@ -408,12 +408,12 @@ bool WinLinkDriver::parse(int argc, cons
>>>>          case OPT_incl:
>>>>          // handle /incl
>>>> -      ctx.addInitialUndefinedSymbol(****inputArg->getValue());
>>>> +      ctx.addInitialUndefinedSymbol(****ctx.allocateString(inputArg-**
>>>> >**
>>>>
>>>> getValue()));
>>>>          break;
>>>>          case OPT_out:
>>>>          // handle /out
>>>> -      ctx.setOutputPath(inputArg->****getValue());
>>>> +      ctx.setOutputPath(ctx.****allocateString(inputArg->****
>>>> getValue()));
>>>>          break;
>>>>          case OPT_INPUT: {
>>>>
>>>>
>>>> ______________________________****_________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/****mailman/listinfo/llvm-commits<http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits>
>>>> <**http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits<http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>>>> >
>>>>
>>>>
>>>>
>>>>  --
>>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
>>> by the Linux Foundation
>>>
>>>
>>>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by the Linux Foundation
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130826/9d51d1ae/attachment.html>


More information about the llvm-commits mailing list