1

I am writing an assembly program on Linux. I use this script to cross-compile the assembly to arm :

arm-linux-gnueabihf-gcc -ggdb3 -nostdlib -o main -static main.S

Having a main.S like this :

.global _start
_start:
.text
    FLDS s31,=3.12E-16

However I get errors telling me that flds and fld are not recognized. I have searching for a bit but I cannot seem to find the source of the problem. I thought about using arm-none-eabi-as but I get other types of error like garbage after flds etc.

wil123
  • 17
  • 2
  • 1
    `flds` is `x87` instruction. Sounds like you want `vldr`. – Jester Jan 21 '22 at 13:14
  • That must me it. Thanks. What is weird is that on the official arm page, they have a doc mentioning flds. According to them it is compatible with all arm cpu ... – wil123 Jan 21 '22 at 13:20
  • Do you have an url for that? – Jester Jan 21 '22 at 13:21
  • https://developer.arm.com/documentation/dui0068/b/ ----here page 272 if you download the file ... – wil123 Jan 21 '22 at 13:21
  • 1
    Ahha, my bad. Looks like it is valid. However gnu assembler does not seem to accept floating point constants which is puzzling. `flds s31,=3` assembles without error, but as far as I can tell produces wrong code as it just uses an integer not a float. – Jester Jan 21 '22 at 13:24
  • Yeah ... I noticed that VLDR and FLDS do the same thing when given integer, however it is still not working with floats . – wil123 Jan 21 '22 at 13:27
  • `flds s31,=0x25B3DB13` might do what you want but it's tedious if you have to convert values by hand. – Jester Jan 21 '22 at 13:27
  • The thing is that I am making a compiler for a sub-language of Java and I want it to run on arm, so doing it by hand is not a "clean" option :-) – wil123 Jan 21 '22 at 13:30
  • With VLDR I get the following error : ""Error: garbage following instruction -- `vldr.f32 S0,=1.1'" " I cannot seem to find the good way of using vldr ... – wil123 Jan 21 '22 at 13:32
  • 1
    Well if you are making a compiler then that can do the conversion. Note that [gcc is doing the same](https://godbolt.org/z/K8s6M5os8). – Jester Jan 21 '22 at 13:33
  • 2
    Well, who am i to argue with gcc, I will do that. thank you for your help – wil123 Jan 21 '22 at 13:39

0 Answers0