Re: Question related to GCC structure variable assignment optimization

2018-07-27 Thread keshav tilak
>> Are you sure the linker does not perform this relaxation in your case? If so, >> that's an issue (missed optimization) in the linker. yes, after linking phase also I see reference memcpy from PLT. The file I am building is created with -ffreestanding and -fnostdlib option; The memcpy function

Re: Question related to GCC structure variable assignment optimization

2018-07-27 Thread Alexander Monakov
On Fri, 27 Jul 2018, keshav tilak wrote: > This leads to GCC compiler issuing a call to `memcpy@PLT()' in function bar1. > > I want to create a position independent executable from this source > and run this on > a secure environment which implements ASLR and the loader disallows any binary > whic

Question related to GCC structure variable assignment optimization

2018-07-27 Thread keshav tilak
I need some help for GCC optimization behavior which inserts call to `memcpy` when it detects that there is a structure variable assignment. I have below sample code (copied from a similar gcc-help question): [ 0] [15:21:40] root@localhost : # cat b.c struct foo_t { int x[1048576]; } *fo