bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20515] New: i386 ifunc and non-default symbol visibility


From: amodra at gmail dot com
Subject: [Bug ld/20515] New: i386 ifunc and non-default symbol visibility
Date: Thu, 25 Aug 2016 08:32:51 +0000

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

            Bug ID: 20515
           Summary: i386 ifunc and non-default symbol visibility
           Product: binutils
           Version: 2.28 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com
  Target Milestone: ---

An adaptation of the existing pr19784 testcase.
cat > pr19784a.c <<\EOF
#include <stdio.h>
int bar(void);
int main(void)
{
  if (bar())
    printf ("PASS\n");
  else
    __builtin_abort ();
  return 0;
}
EOF
cat > pr19784b.c <<\EOF
int foo (int x) __attribute__ ((ifunc ("resolve_foo")));

static int foo_impl(int x)
{
  return x;
}

void *resolve_foo (void)
{
  return (void *) foo_impl;
}
EOF
cat > pr19784c.c <<\EOF
extern int foo (int) __attribute__ ((visibility("hidden")));

int bar()
{
  return foo (5) == 5;
}
EOF
gcc -m32 -c -g -O2 -fPIC pr19784a.c
gcc -m32 -c -g -O2 -fPIC pr19784b.c
gcc -m32 -c -g -O2 -fPIC pr19784c.c
gcc -m32 -shared -o libpr19784a.so pr19784b.o pr19784c.o
gcc -m32 -shared -o libpr19784b.so pr19784c.o pr19784b.o
gcc -m32 -o pr19784a pr19784a.o -Wl,--rpath=. libpr19784a.so
gcc -m32 -o pr19784b pr19784a.o -Wl,--rpath=. libpr19784b.so
./pr19784a
./pr19784b

The linker ought to issue an error rather than building invalid shared
libraries that segfault at runtime.  Ditto for the pr14961 testcase.

-- 
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]