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

            Bug ID: 22394
           Summary: hppa-linux-ld fails to emit dynamic relocations on
                    function pointer initialization
           Product: binutils
           Version: 2.30 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com
  Target Milestone: ---

gcc -mfast-indirect-calls emits a function pointer initialization without a P%
(plabel) modifier.  ld does not create the necessary dynamic relocations for
this to work.

$ cat funcp.c
extern void foo(void);
void (*fp)(void) = foo;

int main()
{
  fp();
  return 0;
}
$ cat funcpdef.c 
void foo(void) {}
$ gcc -shared -o funcpdef.so funcpdef.c
$ gcc -o funcp funcp.c funcpdef.so -Wl,-rpath=.
$ ./funcp
$ gcc -o funcp funcp.c funcpdef.so -Wl,-rpath=. -mfast-indirect-calls
$ ./funcp
Segmentation fault (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to