<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68915>68915</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISCV] Relax linker requireement of exact match between floating point ABIs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld,
backend:RISC-V
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hiraditya
</td>
</tr>
</table>
<pre>
Linking object files of a floating point and a double floating point ABI causes linker error.
e.g.,
```
$ llvm-readelf -h icudtl.o
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: RISC-V
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 817488 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 64 (bytes)
Number of section headers: 4
Section header string table index: 1
Note that the "Flags" bits are 0x0.
```
```
$ llvm-readelf -h fml.file.o
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: RISC-V
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 695248 (bytes into file)
Flags: 0x5, RVC, double-float ABI
Size of this header: 64 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 64 (bytes)
Number of section headers: 5
Note that "Flags" is 0x5 (double-float ABI)
```
ld.lld: error: icudtl.o: cannot link object files with different floating-point ABI from fml.file.o
Linking same object files for ARM target doesn't give an error where they have differing flags as well.
e.g.,
```
readelf -h icudtl.o
ELF Header:
Magic: 7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: ARM
ABI Version: 0
Type: REL (Relocatable file)
Machine: ARM
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 817472 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 40 (bytes)
Number of section headers: 5
Section header string table index: 2
Generated by the compiler:
$ readelf -h fml.file.o
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: ARM
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 423636 (bytes into file)
Flags: 0x5000000, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 40 (bytes)
Number of section headers: 1120
Section header string table index: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkmF1v6jYYxz-NuXlElDgvwAUXHApbpfZMolu1Wyd5Qrzj2Mw2LezTTw6EQqEBjjjdtEVRWpQ8r7Z_-TvMGD6XiEMSfyHxXYctban0sOSa5dyuWSdV-Xr4wOU3Lueg0j8ws1BwgQZUAQwKoZh1txaKSwtM5sAgV8tU4Pt7oy_3kLGlQQOCy2-oAbVW2iP-HfFH6M09QsebH9tr4m_PzU8agRAvVVcjy1EU0C2BZ8vcCk9tnpg8TOFnd1OTcOsD4JHNeUbCEQD0CohiiDKIEvAp-EF9-h-dWw9jwYzZOPj4mDxMk6gJeccscwaU0J6BTFULgRVKS-gYBLdWIKDMOZONwTNqw5VsDxIAof1sqXXtadDY_vJE6HT05f5Mhr99vf8duvC0NhYreG6s3aCcjd50An5dL_BcJ2A2eXCZzlCojFlWzwQucC_lR5aVXJ7xNLt_GnebPC9qkL8KmggTafW6mZN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