Ensure FOLLY_SDT's Semaphore is in an allocated section
Summary: Currently `FOLLY_SDT`'s Semaphore is just an global variable at where it was defined. Since it's initialized to 0 it will be put into the `.bss` section. It works fine currently, especially for Executable binaries, because tools, in particular BCC, will be writing to the virtual address directly. However, recent patches to Linux Kernel supports handling Semaphore (reference counter) natively along with the uprobe event, and it requires the Semaphore address to be allocated in the binary file so Kernel can find correct VMA for the address, especially for Shared Object binaries. This Diff makes `FOLLY_SDT_DEFINE_SEMAPHORE` to put the Semaphore into a `PROGBITS` section `.probes` that is writeable and allocated. This is a practice compatible with SystemTap's USDT implementation, where the Semaphores also reside in the `.probes` section, as can be found in CPython, libc, MySQL, PostgresSQL, and many applications already. Reviewed By: yfeldblum Differential Revision: D10319732 fbshipit-source-id: 67ac0e55cc10cf1425a754d88cae0165b89ee993
Showing
Please register or sign in to comment