Bug 17735 - gold doesn't set ELFOSABI_GNU for IFUNC nor STB_GNU_UNIQUE
Summary: gold doesn't set ELFOSABI_GNU for IFUNC nor STB_GNU_UNIQUE
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-20 01:18 UTC by H.J. Lu
Modified: 2014-12-20 01:19 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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]$