looking for a way to tell gcc not to remove some code he thinks is unreachable.
Erez D
erez0001 at gmail.com
Mon Mar 7 13:05:19 IST 2011
On Mon, Mar 7, 2011 at 12:34 PM, Raz <raziebe at gmail.com> wrote:
> why do you think the linker removes the function ? what flags are using ?
> Please nm ( nm <elf> ).
>
objdump -d does not show assembly for function a
>
> 2011/3/7 Erez D <erez0001 at gmail.com>
>
>>
>>
>> On Mon, Mar 7, 2011 at 12:18 PM, Muli Ben-Yehuda <muli at il.ibm.com> wrote:
>>
>>> On Mon, Mar 07, 2011 at 12:11:36PM +0200, Erez D wrote:
>>>
>>> > I have a function which is not called in a regular way, so gcc
>>> > thinks it is dead code. however it is not, and i am looking for a
>>> > way to tell the linker not to remove it.
>>>
>>> extern
>>>
>>> how ?
>> sorry, didn't get what you mean.
>>
>> i'll give an example:
>>
>> =============== my code ========
>> int x;
>>
>> void a()
>> {
>> x=3;
>> }
>>
>> int main()
>> {
>> x=0;
>> return 1;
>> }
>>
>> ========================
>>
>> the linker will remove function a() as it is not called from enywhere.
>> however, i need it to be there, including all of its content.
>>
>> how do i do that.
>>
>>
>> _______________________________________________
>> Linux-il mailing list
>> Linux-il at cs.huji.ac.il
>> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20110307/3580c4e2/attachment-0001.html>
More information about the Linux-il
mailing list