[PATCH] D13329: [PGO]: Eliminate __llvm_profile_register calls for Linux (compiler_rt)

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 13:20:18 PDT 2015


davidxl added a comment.

There is another solution that is similar to Darwin, so no linker script is needed. I will update the patch to go that route.

From Ian Taylor:

"When a section name is a valid C identifier, the linker automatically provides __start and __stop symbols set to the addresses of the beginning and end of the section.  The symbols are __start_SECNAME and __stop_SECNAME where SECNAME is the name of the section.

This is not defined by the ELF ABI, but it is completely reliable on
GNU/Linux.  In fact it is reliable on any ELF system except possibly
Solaris, and it probably works on Solaris too.  This is definitely
what you should do instead of using a linker script.  It's more
reliable and more efficient, and it's what everybody else does"


http://reviews.llvm.org/D13329





More information about the llvm-commits mailing list