looking for a way to tell gcc not to remove some code he thinks is unreachable.

looking for a way to tell gcc not to remove some code he thinks is unreachable.

Muli Ben-Yehuda muli at il.ibm.com
Mon Mar 7 13:33:56 IST 2011


On Mon, Mar 07, 2011 at 12:27:08PM +0200, Erez D wrote:

> int x;
> 
> void a()

extern 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.

gcc (ld) 4.4.3 does not remove it in this case. What linker are you
using?

Cheers,
Muli



More information about the Linux-il mailing list