GCC generating symbols prefixed with "call_"

Jim Wilson jimw@sifive.com
Mon Mar 30 17:43:42 GMT 2020


On Thu, Mar 26, 2020 at 5:03 PM William Tambe <tambewilliam@gmail.com> wrote:
> 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) ?

Probably not all assemblers support previous.  All GNU as ELF targets
do.  But I think GNU as COFF targets don't, and there may be vendor
assemblers that don't.

But why are you worried about the call symbols anyways?  I think that
this code is never run.  The purpose here is to put a call in the fini
or init section, and the rest of the code is irrelevant.  This is a
trick to support init/fini.

Most targets nowadays use init_array and fini_array instead of
init/fini.  init/fini were obsoleted in the ELF standard about 20
years ago.  This results in a much cleaner implementation, and allows
but better unwinding e.g. better C++ EH support.  You should be using
the init_array/fini_array support here.  I would suggest looking at
why this doesn't work.  There should be a configure test to check for
assembler support for init_array/fini_array, and it should pass for
any elf gnu as port.

Jim



More information about the Gcc-help mailing list