On Tue, Aug 20, 2019 at 11:44 AM Richard Sandiford <richard.sandiford@xxxxxxx> wrote: > > William Tambe <tambewilliam@xxxxxxxxx> writes: > > I am running into an issue with both gcc-8.3.0 and gcc-9.2.0 where a > > null-pointer function call is being done within > > __do_global_dtors_aux() which is defined in crtstuff.c . > > > > I have attempted to build GCC using the following export: > > export CFLAGS_FOR_TARGET="-g -save-temps -fverbose-asm" > > but the assembly file crtstuff.s do not contain the function > > __do_global_dtors_aux() even-though its source file crtstuff.c has its > > definition. > > > > Any idea ? > > libgcc is a bit awkward in that it uses the same source file to > compile multiple object files. E.g. both crtbegin.o and crtend.o > come from crtstuff.c, so which crtstuff.s you end up with depends > on the build order. > > You should see the definition if you remake crtbegin.o specifically > (or whichever variant you're looking at, such as crtbeginT.o). How must "make" be invoked to remake only crtbegin.o ? > > At a guess, the null pointers could come from weak symbols that > weren't defined weak (and so a null check got optimised away), > or from the function pointer table sections have too much alignment > and being padded out with zeros. > > Thanks, > Richard