Bug 17735

Summary: gold doesn't set ELFOSABI_GNU for IFUNC nor STB_GNU_UNIQUE
Product: binutils Reporter: H.J. Lu <hjl.tools>
Component: goldAssignee: Cary Coutant <ccoutant>
Status: NEW ---    
Severity: normal CC: ian
Priority: P2    
Version: 2.26   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description H.J. Lu 2014-12-20 01:18:46 UTC
gold doesn't set ELFOSABI_GNU for IFUNC:

[hjl@gnu-tools-1 tmp]$ cat libb.c
void new_sd_get_seats(void);
static void (*resolve_sd_get_seats(void)) (void) {
        return new_sd_get_seats;
}
void sd_get_seats(void) __attribute__((ifunc("resolve_sd_get_seats")));
[hjl@gnu-tools-1 tmp]$ gcc -fpic -c libb.c
[hjl@gnu-tools-1 tmp]$ ld -shared libb.o
[hjl@gnu-tools-1 tmp]$ readelf -h a.out | grep OS/ABI 
  OS/ABI:                            UNIX - GNU
[hjl@gnu-tools-1 tmp]$ ld.gold -shared libb.o
[hjl@gnu-tools-1 tmp]$ readelf -h a.out | grep OS/ABI 
  OS/ABI:                            UNIX - System V
[hjl@gnu-tools-1 tmp]$ 

The same goes for STB_GNU_UNIQUE:

[hjl@gnu-tools-1 tmp]$ cat type.s 
	.data
	.type	unique_global,%gnu_unique_object
unique_global:
	.byte	0x0
	.size	unique_global,1
[hjl@gnu-tools-1 tmp]$ gcc -c type.s 
[hjl@gnu-tools-1 tmp]$ ld -shared type.o
[hjl@gnu-tools-1 tmp]$ readelf -h a.out | grep OS/ABI 
  OS/ABI:                            UNIX - GNU
[hjl@gnu-tools-1 tmp]$ ld.gold -shared type.o
[hjl@gnu-tools-1 tmp]$ readelf -h a.out | grep OS/ABI 
  OS/ABI:                            UNIX - System V
[hjl@gnu-tools-1 tmp]$