Re: ww07 - Agenda

Igor Stoppa

followup wrt identification of symbols used by an empty program, since it was pulling in libc.

The program "test.c":

int main()
        while (1); /* Infinite loop */
        return 0;

gcc test.c -o test

My initial thought of using prelink did not work, because apparently prelink has been bitrotting at least since 2017.
Admittedly, also yours truly had not used it since 2010. For some reason, it's still around, though.

Anyways, there are various other ways to obtain the desired information.
One of them is to use nm:

nm -D test
                 w __cxa_finalize@....5
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U __libc_start_main@...

From man nm:
           "U" The symbol is undefined.
           "w" The symbol is a weak symbol that has not been specifically tagged as a weak object symbol.  When a weak defined symbol is linked with a normal defined symbol, the normal          
               defined symbol is used with no error.  When a weak undefined symbol is linked and the symbol is not defined, the value of the symbol is determined in a system-specific manner     
               without error.  On some systems, uppercase indicates that a default value has been specified.                                                                                      

Those weak housekeeping symbols seem to be the reason why libc is being pulled in.


Join to automatically receive all group messages.