https://sourceware.org/bugzilla/show_bug.cgi?id=27206

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
---
__asm__(".symver pthread_key_create,pthread_key_create@GLIBC_2.2.5,remove");
---

A versioned symbol must be defined in an object.  Try this 

[hjl@gnu-cfl-2 pr27206]$ cat libfoo.map 
GLIBC_2.2.5 {
  global: pthread_key_create;
};
libfoo {
  global: *;
};
[hjl@gnu-cfl-2 pr27206]$ cat foo.c
#include <pthread.h>

__attribute__ ((weak))
int
pthread_key_create (pthread_key_t *key, void (*fun) (void *))
{
  return 0;
}

__asm__(".symver pthread_key_create,pthread_key_create@GLIBC_2.2.5");

void destructor(void* arg) { return; }

void thread_func() {
  pthread_key_t key;

  pthread_key_create(&key, destructor);
}
[hjl@gnu-cfl-2 pr27206]$ make
gcc -B./ -fPIC   -c -o foo.o foo.c
gcc -B./ -Wl,--version-script=libfoo.map -shared -o libfoo.so foo.o
[hjl@gnu-cfl-2 pr27206]$ readelf -rW --dyn-syms libfoo.so | grep
pthread_key_create
0000000000004018  0000000600000007 R_X86_64_JUMP_SLOT     0000000000001109
pthread_key_create@GLIBC_2.2.5 + 0
     6: 0000000000001109    19 FUNC    WEAK   DEFAULT   14
pthread_key_create@GLIBC_2.2.5
[hjl@gnu-cfl-2 pr27206]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to