code that went to process segment now goes to shared segment

bmuller@inf.ufpr.br brunomuller65@gmail.com
Fri Dec 6 13:03:00 GMT 2019


I wrote a program that uses some dynamic libraries I designed. Then, I
compiled and executed a program that prints the address of a lot of things
global variables, shared procedures and the procedure main():

long int main ()
{
 ...
  printf ("Procedure main: (Address=%p)\n", main);
...
}

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.

I teach operating systems, and some students reported that the programs I
used for exams were not producing the former addresses generating unusual
results. I'll have to rewrite my code, but I'd like to know if I should be
prepared for something... strange.

Thanks,

Bruno



More information about the Gcc-help mailing list