On Thu, Mar 26, 2020 at 7:03 PM Jim Wilson <jimw@xxxxxxxxxx> wrote: > > On Wed, Mar 25, 2020 at 6:41 PM William Tambe via Gcc-help > <gcc-help@xxxxxxxxxxx> wrote: > > Any idea what is causing GCC to generate the following symbols prefixed > > with "call_" ? > > > > call___do_global_ctors_aux > > call___do_global_dtors_aux > > call_frame_dummy > > find . -type f | xargs grep do_global_ctors_aux > on a linux machine in the gcc source tree will show you all uses of > do_global_ctors_aux, there are only about a hundred of them, and most > of them are obviously not relevant. You can ignore the ia64, pa, and > ChangeLog file hits. That gives a couple dozen, of which the most > interesting one is this one > ./libgcc/crtstuff.c:CRT_CALL_STATIC_FUNCTION > (__LIBGCC_INIT_SECTION_ASM_OP__, __do_global_ctors_aux) Thanks for shedding the light; essentially CRT_CALL_STATIC_FUNCTION() inserts functions calls into the section given as argument. But there is a weird behavior I am seeing; CRT_CALL_STATIC_FUNCTION() is defined as follow: # define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ static void __attribute__((__used__)) \ call_ ## FUNC (void) \ { \ asm (SECTION_OP); \ FUNC (); \ FORCE_CODE_SECTION_ALIGN \ asm (__LIBGCC_TEXT_SECTION_ASM_OP__); \ } When asm (__LIBGCC_TEXT_SECTION_ASM_OP__) is used, it is not necessary the same section as before the use of asm (SECTION_OP); hence the prologue instructions end up not showing in the dis-assembly of "call_ ## FUNC" . Any idea why asm (__LIBGCC_TEXT_SECTION_ASM_OP__) is used instead of asm (".previous") to restore the section before the use of asm (SECTION_OP) ? I tried above and it seems to work; I can see the prologue instructions correctly showing in the dis-assembly of "call_ ## FUNC". > > Jim