Character output nm t vs T in a shared library

I added a new function (fuse_lowlevel_notify_inval_directory) to the user space plugin library. Compilation and creation of libfuse.so completed without errors. But when my application tries to use this new function, the linker throws an error: undefined reference to `fuse_lowlevel_notify_inval_directory 'collect2: ld returned 1 exit status

When I checked with nm

nm ../libfuse.so | grep inval 00000000000154ed T fuse_invalidate **000000000001e142 t fuse_lowlevel_notify_inval_directory** 000000000001e26c T fuse_lowlevel_notify_inval_entry 000000000001e1cb T fuse_lowlevel_notify_inval_inode 

T / t means that the character is present in the text section. if uppercase, the character is global (external). I suspect this is a problem. The new function added shows lowercase letters t, while other older functions have an uppercase T. Any idea on what I can do wrong?

+7
gcc linker shared-libraries
source share
1 answer

Any idea on what I can do wrong?

The t function is indeed a local library. This can happen for a number of reasons. The most likely are:

  • You declared a static function or
  • You compiled the library with -fvisibility=hidden and did not have the __attribure__((visibility("default"))) function, or
  • You linked this library with a version of the linker script (i.e. with the flag --version-script=libfoo.version ), which hides all functions except those that are explicitly exported, and you did not add your function to this list.

    See this example using --version-script to limit character visibility.
+8
source share

All Articles