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

--- Comment #1 from John David Anglin <danglin at gcc dot gnu.org> ---
Hi Alan,

Although your example is not technically supported, I think it should
work on linux because it doesn't use the PIC register and because of the
flat address space.

First, calls to functions in shared libraries are not supported using the
-mfast-indirect-calls gcc option:

  @item -mfast-indirect-calls
  @opindex mfast-indirect-calls
  Generate code that assumes calls never cross space boundaries.  This
  allows GCC to emit code that performs faster indirect calls.

  This option does not work in the presence of shared libraries or nested
  functions.

What works is:

$ gcc -o funcp funcp.c funcpdef.c -mfast-indirect-calls
$ ./funcp
$

Issues are the space register used for the call and the PIC register.

Looking at your example, it seems to me that R_PARISC_DIR32 relocations
are not handled correctly when they refer to a function.  This is the
assembly code:

        .LEVEL 1.1
.globl fp
        .section        .data.rel,"aw",@progbits
        .align 4
        .type   fp, @object
        .size   fp, 4
fp:
        .word   foo

At runtime, fp is NULL causing the segmentation fault.  So, I agree
with your assessment.

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