Issue |
81740
|
Summary |
[lld/ELF] LLD does not set ELFOSABI_GNU when using IFUNC
|
Labels |
lld
|
Assignees |
|
Reporter |
uweigand
|
When creating a binary using IFUNC symbols with LLD, (GNU) readelf does not show the type correctly. We see
```
692: 0000000000122de0 28 <OS specific>: 10 GLOBAL DEFAULT 18 strstr@@GLIBC_2.2
```
instead of
```
692: 0000000000122de0 28 IFUNC GLOBAL DEFAULT 18 strstr@@GLIBC_2.2
```
It turns out that this is because GNU readelf thinks symbol type 10 means IFUNC only on GNU / Linux and FreeBSD targets (and indeed 10 is in the "OS specific" range of symbol types according to the ELF definition):
```
if (type == STT_GNU_IFUNC
&& (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_GNU
|| filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_FREEBSD))
return "IFUNC";
```
The GNU linker has code that will set the OSABI field to ELFOSABI_GNU if the output binary contains any IFUNC symbols. LLD does not currently appear to do so. Should it?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs