On Fri, 6 Dec 2019, bmuller@inf.ufpr.br wrote: > After compiling with gcc 5.4.0 (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 > 20160609), the execution shows that the procedure "main" was at address > 0x400776, that is, in the process segment (along the global variables). > > After compiling with gcc 7.4.0 (gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0), > the execution shows that the procedure "main" went to address > 0x55bbddb7e7fa, that is inside the dynamic segment área (along the global > variables). > > I guess that this "functional" change occurred along the GCC 6.0 changes, > but I could not find the motivation for it in the wiki, faq or the 6.0 > change docs. > > My question is if there is some documentation that presents the motivation > for this changes: advantages, disadvantages and if some abnormal behavior > was reported. You're seeing that newer Ubuntu configures GCC to produce position-independent executables by default (look for --enable-default-pie in output of 'gcc -v'). Each distribution decides for itself whether to enable PIE by default or not, the motivation is security hardening; I think you can look for articles on ASLR, address space layout randomization, for further info. Upstream GCC did not change its defaults with regard to PIE-by-default, this was and remains up to distributions. Alexander