Hello all,

Assume a recent GCC (15 or later) on a 64 bits processor and Linux
system (eg ARM64 or AMD64)

Assume compilation of a single C or C++ file (foo.c or foo.cxx) into a
shared (dlopenable) object foo.so (so with options -O2 -fPIC -shared)

Assume also that no function is declared with attributes (other than
format).

Is there in practice an order of the addresses (as obtained by dlsym)
of the external functions of foo.so?

This could be useful when using dladdr and dlsym

I was guessing that in practice if an external function f is defined
textually before function g then its dlsym-ed address is less than the
dlsym-ed address of g

In other words, when does the GCC compiler reorder the external
functions in a shared object

Thanks for your insights
-- 

Basile STARYNKEVITCH                           
<[email protected]>
8 rue de la Faïencerie                      
http://starynkevitch.net/Basile/  
92340 Bourg-la-Reine                        
https://github.com/bstarynk
France                               
https://github.com/RefPerSys/RefPerSys
                  https://orcid.org/0000-0003-0908-5250

Reply via email to