bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/27206] .symver overrides .weak


From: hjl.tools at gmail dot com
Subject: [Bug binutils/27206] .symver overrides .weak
Date: Tue, 19 Jan 2021 18:53:00 +0000

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

[Prev in Thread] Current Thread [Next in Thread]