On sh4-unknown-linux target, hidden symbol in DSO does not be kept local
if the symbol appeared at global section in the version script.
The hidden function is accessed directly at compile time, but global function
in DSO should be accessed through PLT, as the result, segmentation fault occurs
on execution time.

Here is a simple test case.

---- foo.c ----
extern void bar(void);
main()
{
        bar();
        return 0;
}

---- bar.c ----
extern void func(void) __attribute((visibility("hidden")));
void bar(void)
{
        func();
}

---- bar-2.c ----
void func(void) __attribute((visibility("hidden")));
void func(void)
{
}

---- bar.ver ----
{global:
bar;
func;
local:*;};

---- build and exec ----
gcc -g -c foo.c
gcc -g -fPIC -c bar.c
gcc -g -fPIC -c bar-2.c
gcc -o bar.so -shared bar.o bar-2.o -Wl,--version-script -Wl,bar.ver
gcc -o foo foo.o bar.so
LD_LIBRARY_PATH=. ./foo

---- environment ----
linux-2.6.15.3 on sh4
gcc-3.4.5
binutils-2.16.91.0.5
glibc-2.3.4

---- binutils configuration ----
../configure sh4-unknown-linux --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share
--includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec
--localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --disable-werror

-- 
           Summary: SH: Hidden symbol in DSO does not be forced local
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: sugioka at itonet dot co dot jp
                CC: bug-binutils at gnu dot org
 GCC build triplet: sh4-unknown-linux
  GCC host triplet: sh4-unknown-linux
GCC target triplet: sh4-unknown-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=2362

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to