bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/27200] Bad RiscV64 ELF header flag using ld -b binary


From: bztemail at gmail dot com
Subject: [Bug ld/27200] Bad RiscV64 ELF header flag using ld -b binary
Date: Mon, 18 Jan 2021 19:28:46 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27200

--- Comment #6 from bzt <bztemail at gmail dot com> ---
Look:

$ cat a.s
.globl _start
.text
_start:
ret
$ riscv64-elf-as -c a.s -o a.o
$ riscv64-elf-readelf -h a.o | grep Flags
  Flags:                             0x4 double-float ABI
$ riscv64-elf-ld a.o -o a
$ riscv64-elf-readelf -h a | grep Flags
  Flags:                             0x4 double-float ABI
$ riscv64-elf-ld -r -b binary -o font.o font.psf
$ riscv64-elf-readelf -h font.o | grep Flags
  Flags:                             0x0
$ riscv64-elf-ld -melf64lriscv -r -b binary -o font.o font.psf
$ riscv64-elf-readelf -h font.o | grep Flags
  Flags:                             0x0
$ riscv64-elf-ld -mlist
riscv64-elf-ld: unrecognized emulation mode: list
Supported emulations: elf64lriscv elf32lriscv
$

I've deliberately used "as" instead of "gcc" this time because "as" is in the
same binutils package, therefore "as" was compiled using the same configure
options and for the same target as "ld". It's only normal to assume they will
produce compatible outputs. "as" outputs with double-float flag (correctly).
"ld" also understands double-float, it has no problems with linking those
objects, and it correctly outputs the executable. Yet "-b binary" doesn't set
the flags in the header (meaning soft-float), which is incorrect, and
specifying the emulation explicitly doesn't help either.

Is this enough information?

Cheers,
bzt

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]