Bug#331460: gcc-4.0: Some uses of pragma GCC visibility with -fPIC still build position dependent code.
Package: gcc-4.0
Version: 4.0.2-2
Severity: important
Building the following code:
#pragma GCC visibility push(hidden)
#pragma GCC visibility push(default)
#include <string.h>
#pragma GCC visibility pop
__attribute__ ((visibility ("default"))) void Func() {
char c[100];
memset(c, 0, sizeof(c));
}
(yes, this is the same code as in bug #330279)
gives position dependent code:
mh@namakemono:~$ gcc -fPIC -shared -o test.so test.c
mh@namakemono:~$ objdump --private-headers test.so | grep TEXTREL
TEXTREL 0x0
If you removing all pragmas in the source code, and build with
-fvisibility=hidden, you get:
mh@namakemono:~$ gcc -fPIC -shared -fvisibility=hidden -o test.so test-nopragma.c
mh@namakemono:~$ objdump --private-headers test.so | grep TEXTREL
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Versions of packages gcc-4.0 depends on:
ii binutils 2.16.1cvs20050902-1 The GNU assembler, linker and bina
ii cpp-4.0 4.0.2-2 The GNU C preprocessor
ii gcc-4.0-base 4.0.2-2 The GNU Compiler Collection (base
ii libc6 2.3.5-6 GNU C Library: Shared libraries an
ii libgcc1 1:4.0.2-2 GCC support library
Versions of packages gcc-4.0 recommends:
ii libc6-dev 2.3.5-6 GNU C Library: Development Librari
pn libmudflap0-dev <none> (no description available)
-- no debconf information
Reply to: