https://sourceware.org/bugzilla/show_bug.cgi?id=32941
Bug ID: 32941
Summary: VAX: PIC: pointer to global function in same file
points PLT entry
Product: binutils
Version: 2.44
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: rin at NetBSD dot org
Target Milestone: ---
For VAX, `gas -pic` handle pointer to global function (present in the same
source file) by PLT, instead of GOT for other platforms.
For example, consider the following C source (main.c):
```
#include <stdio.h>
void func(void) {
}
int main(void) {
printf("%s: %p\n", func);
return 0;
}
```
With GCC 12.4.0 (shipped with NetBSD-current), and binutils 2.44 (built and
installed as is from binutils-2.44.tar.gz), I obtained:
```
% /somewhere/vax--netbsdelf-gcc -S -fPIC -O2 main.c
% /usr/local/vax--netbsdelf/bin/as -pic main.s -o main.o
% readelf -r main.o
Relocation section '.rela.text.startup' at offset 0x14c contains 3 entries:
Offset Info Type Sym.Value Sym. Name + Addend
0000000d 00000504 R_VAX_PC32 00000000 .rodata.str1.1 + 0
00000007 0000080d R_VAX_PLT32 00000000 func + 0
00000014 00000a0d R_VAX_PLT32 00000000 printf + 0
```
Here, pointer to `func` points PLT instead of GOT entry.
If `func` is in other file, pointer to it points GOT entry in the same
manner observed in other platforms (see sub.[cso] in the attached tarball).
As a result, `func` pointers numerically differ depending on whether
`func` is present in the same source file or not. See NetBSD bug report
https://gnats.netbsd.org/59326 for more details.
By applying attached patch, GOT is used for function pointer for main.c.
--
You are receiving this mail because:
You are on the CC list for the bug.