Closed sfuhrm closed 2 years ago
The neon instructions are only available on arm7 or higher I believe, so your problem is most likely related to the CPU that QEMU emulates. Last time I checked, that was arm6.
Thanks for the quick response! AFAIK the compiling processor does not need to match the targeting processor in every detail, but probably the overall architecture of the building OS toolchain needs to match.
The Linux platform I'm building with says uname -a
Linux buildkitsandbox 5.11.0-1028-azure #31~20.04.2-Ubuntu SMP Tue Jan 18 08:46:15 UTC 2022 armv7l armv7l armv7l GNU/Linux
This is the "as" help I get on a neon-failing target:
#10 0.085 as --help
#10 0.109 Usage: /usr/bin/as [option...] [asmfile...]
#10 0.109 Options:
#10 0.109 -a[sub-option...] turn on listings
#10 0.109 Sub-options [default hls]:
#10 0.109 c omit false conditionals
#10 0.109 d omit debugging directives
#10 0.109 g include general info
#10 0.109 h include high-level source
#10 0.109 l include assembly
#10 0.109 m include macro expansions
#10 0.109 n omit forms processing
#10 0.109 s include symbols
#10 0.109 =FILE list to FILE (must be last sub-option)
#10 0.109 --alternate initially turn on alternate macro syntax
#10 0.109 --compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]
#10 0.109 compress DWARF debug sections using zlib
#10 0.109 --nocompress-debug-sections
#10 0.109 don't compress DWARF debug sections [default]
#10 0.109 -D produce assembler debugging messages
#10 0.109 --debug-prefix-map OLD=NEW
#10 0.109 map OLD to NEW in debug information
#10 0.109 --defsym SYM=VAL define symbol SYM to given value
#10 0.109 --execstack require executable stack for this object
#10 0.109 --noexecstack don't require executable stack for this object
#10 0.109 --size-check=[error|warning]
#10 0.109 ELF .size directive check (default --size-check=error)
#10 0.109 --elf-stt-common=[no|yes] (default: no)
#10 0.109 generate ELF common symbols with STT_COMMON type
#10 0.109 --sectname-subst enable section name substitution sequences
#10 0.109 --generate-missing-build-notes=[no|yes] (default: no)
#10 0.109 generate GNU Build notes if none are present in the input
#10 0.109 -f skip whitespace and comment preprocessing
#10 0.109 -g --gen-debug generate debugging information
#10 0.109 --gstabs generate STABS debugging information
#10 0.109 --gstabs+ generate STABS debug info with GNU extensions
#10 0.109 --gdwarf-2 generate DWARF2 debugging information
#10 0.109 --gdwarf-sections generate per-function section names for DWARF line information
#10 0.109 --hash-size=<value> set the hash table size close to <value>
#10 0.109 --help show this message and exit
#10 0.109 --target-help show target specific options
#10 0.109 -I DIR add DIR to search list for .include directives
#10 0.109 -J don't warn about signed overflow
#10 0.109 -K warn when differences altered for long displacements
#10 0.109 -L,--keep-locals keep local symbols (e.g. starting with `L')
#10 0.109 -M,--mri assemble in MRI compatibility mode
#10 0.109 --MD FILE write dependency information in FILE (default none)
#10 0.109 -nocpp ignored
#10 0.109 -no-pad-sections do not pad the end of sections to alignment boundaries
#10 0.109 -o OBJFILE name the object-file output OBJFILE (default a.out)
#10 0.109 -R fold data section into text section
#10 0.109 --reduce-memory-overheads
#10 0.109 prefer smaller memory use at the cost of longer
#10 0.109 assembly times
#10 0.109 --statistics print various measured statistics from execution
#10 0.109 --strip-local-absolute strip local absolute symbols
#10 0.109 --traditional-format Use same format as native assembler when possible
#10 0.109 --version print assembler version number and exit
#10 0.109 -W --no-warn suppress warnings
#10 0.109 --warn don't suppress warnings
#10 0.109 --fatal-warnings treat warnings as errors
#10 0.109 -w ignored
#10 0.109 -X ignored
#10 0.109 -Z generate object file even after errors
#10 0.109 --listing-lhs-width set the width in words of the output data column of
#10 0.109 the listing
#10 0.109 --listing-lhs-width2 set the width in words of the continuation lines
#10 0.109 of the output data column; ignored if smaller than
#10 0.109 the width of the first line
#10 0.109 --listing-rhs-width set the max width in characters of the lines from
#10 0.109 the source file
#10 0.111 --listing-cont-lines set the maximum number of continuation lines used
#10 0.111 for the output data column of the listing
#10 0.111 @FILE read options from FILE
#10 0.111 ARM-specific assembler options:
#10 0.111 -k generate PIC code
#10 0.111 -mthumb assemble Thumb code
#10 0.111 -mthumb-interwork support ARM/Thumb interworking
#10 0.111 -mapcs-32 code uses 32-bit program counter
#10 0.111 -mapcs-26 code uses 26-bit program counter
#10 0.111 -mapcs-float floating point args are in fp regs
#10 0.111 -mapcs-reentrant re-entrant code
#10 0.111 -matpcs code is ATPCS conformant
#10 0.111 -mbig-endian assemble for big-endian
#10 0.111 -mlittle-endian assemble for little-endian
#10 0.111 -mapcs-frame use frame pointer
#10 0.111 -mapcs-stack-check use stack size checking
#10 0.111 -mno-warn-deprecated do not warn on use of deprecated feature
#10 0.111 -mwarn-restrict-it warn about performance deprecated IT instructions in ARMv8-A and ARMv8-R
#10 0.111 -mwarn-syms warn about symbols that match instruction names [default]
#10 0.111 -mno-warn-syms disable warnings about symobls that match instructions
#10 0.111 -mcpu=<cpu name> assemble for CPU <cpu name>
#10 0.111 -march=<arch name> assemble for architecture <arch name>
#10 0.111 -mfpu=<fpu name> assemble for FPU architecture <fpu name>
#10 0.111 -mfloat-abi=<abi> assemble for floating point ABI <abi>
#10 0.111 -meabi=<ver> assemble for eabi version <ver>
#10 0.111 -mimplicit-it=<mode> controls implicit insertion of IT instructions
#10 0.111 -mccs TI CodeComposer Studio syntax compatibility mode
#10 0.111 -mfp16-format=[ieee|alternative]
#10 0.111 set the encoding for half precision floating point numbers to IEEE
#10 0.111 or Arm alternative format.
#10 0.111 -EB assemble code for a big-endian cpu
#10 0.111 -EL assemble code for a little-endian cpu
#10 0.111 --fix-v4bx Allow BX in ARMv4 code
#10 0.111 --fdpic generate an FDPIC object file
#10 0.111
#10 0.111 Report bugs to <http://www.sourceware.org/bugzilla/>
#10 DONE 0.1s
For me it looks that I'm having an arm capable assembler in the QEMU environment. Are there different assembler variants/versions needed for the neon command set? This looks like the most plausible cause for the problem to me.
Any ideas woud be appreciated :).
Not entirely sure I can help with this, as it seems like an issue in QEMU in any case.
Just as a quick test, not sure if it helps or not, I checked an RPI running RPIOS 32-bit:
pi@rpios32:~ $ uname -a
Linux rpios32 5.10.103-v7l+ #1530 SMP Tue Mar 8 13:05:01 GMT 2022 armv7l GNU/Linux
pi@rpios32:~ $ as --help
Usage: as [option...] [asmfile...]
Options:
-a[sub-option...] turn on listings
Sub-options [default hls]:
c omit false conditionals
d omit debugging directives
g include general info
h include high-level source
l include assembly
m include macro expansions
n omit forms processing
s include symbols
=FILE list to FILE (must be last sub-option)
--alternate initially turn on alternate macro syntax
--compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]
compress DWARF debug sections using zlib
--nocompress-debug-sections
don't compress DWARF debug sections [default]
-D produce assembler debugging messages
--debug-prefix-map OLD=NEW
map OLD to NEW in debug information
--defsym SYM=VAL define symbol SYM to given value
--execstack require executable stack for this object
--noexecstack don't require executable stack for this object
--size-check=[error|warning]
ELF .size directive check (default --size-check=error)
--elf-stt-common=[no|yes] (default: no)
generate ELF common symbols with STT_COMMON type
--sectname-subst enable section name substitution sequences
--generate-missing-build-notes=[no|yes] (default: no)
generate GNU Build notes if none are present in the input
-f skip whitespace and comment preprocessing
-g --gen-debug generate debugging information
--gstabs generate STABS debugging information
--gstabs+ generate STABS debug info with GNU extensions
--gdwarf-<N> generate DWARF<N> debugging information. 2 <= <N> <= 5
--gdwarf-sections generate per-function section names for DWARF line information
--hash-size=<value> set the hash table size close to <value>
--help show this message and exit
--target-help show target specific options
-I DIR add DIR to search list for .include directives
-J don't warn about signed overflow
-K warn when differences altered for long displacements
-L,--keep-locals keep local symbols (e.g. starting with `L')
-M,--mri assemble in MRI compatibility mode
--MD FILE write dependency information in FILE (default none)
-nocpp ignored
-no-pad-sections do not pad the end of sections to alignment boundaries
-o OBJFILE name the object-file output OBJFILE (default a.out)
-R fold data section into text section
--reduce-memory-overheads
prefer smaller memory use at the cost of longer
assembly times
--statistics print various measured statistics from execution
--strip-local-absolute strip local absolute symbols
--traditional-format Use same format as native assembler when possible
--version print assembler version number and exit
-W --no-warn suppress warnings
--warn don't suppress warnings
--fatal-warnings treat warnings as errors
-w ignored
-X ignored
-Z generate object file even after errors
--listing-lhs-width set the width in words of the output data column of
the listing
--listing-lhs-width2 set the width in words of the continuation lines
of the output data column; ignored if smaller than
the width of the first line
--listing-rhs-width set the max width in characters of the lines from
the source file
--listing-cont-lines set the maximum number of continuation lines used
for the output data column of the listing
@FILE read options from FILE
ARM-specific assembler options:
-k generate PIC code
-mthumb assemble Thumb code
-mthumb-interwork support ARM/Thumb interworking
-mapcs-32 code uses 32-bit program counter
-mapcs-26 code uses 26-bit program counter
-mapcs-float floating point args are in fp regs
-mapcs-reentrant re-entrant code
-matpcs code is ATPCS conformant
-mbig-endian assemble for big-endian
-mlittle-endian assemble for little-endian
-mapcs-frame use frame pointer
-mapcs-stack-check use stack size checking
-mno-warn-deprecated do not warn on use of deprecated feature
-mwarn-restrict-it warn about performance deprecated IT instructions in ARMv8-A and ARMv8-R
-mwarn-syms warn about symbols that match instruction names [default]
-mno-warn-syms disable warnings about symobls that match instructions
-mcpu=<cpu name> assemble for CPU <cpu name>
-march=<arch name> assemble for architecture <arch name>
-mfpu=<fpu name> assemble for FPU architecture <fpu name>
-mfloat-abi=<abi> assemble for floating point ABI <abi>
-meabi=<ver> assemble for eabi version <ver>
-mimplicit-it=<mode> controls implicit insertion of IT instructions
-mccs TI CodeComposer Studio syntax compatibility mode
-mfp16-format=[ieee|alternative]
set the encoding for half precision floating point numbers to IEEE
or Arm alternative format.
-EB assemble code for a big-endian cpu
-EL assemble code for a little-endian cpu
--fix-v4bx Allow BX in ARMv4 code
--fdpic generate an FDPIC object file
Report bugs to <http://www.sourceware.org/bugzilla/>
So these seem the same, more or less. But it builds fine on RPIOS, as well as Manjaro, Debian, Ubuntu, as well as OSX and Linux x86 (though we don't use the ARM assembler routines on x86 obviously). I'm not very familiar with the details of QEMU to be able to help you further, I'm afraid.
This probably won't help you much either, since the errors you're getting are higher up starting on line 30, but with 4171ea2f6d76e75e7f0212cc9006ba7e5ec9f1b8 I just removed some assembly routines that were no longer being used.
I'll close this since it was more of a test case for QEMU. Thanks for your time!
Describe the bug
Many builds break on QEMU simulated targets where GCC says that the assembly instructions are not supported by the CPU target.
To Reproduce
See the github actions showcase that tries to build almost all builds: https://github.com/sfuhrm/amiberry/blob/master/.github/workflows/build.yml
I have created a Github actions matrix build that builds each target on a separate QEMU Ubuntu Linux with GCC 10.
Expected behavior
All builds work out of the box. (At the moment no dispmanx / OS X builds)
I hope that it is more or less clear what I'm talking about if the build logs are visible to you.
Sample for target AMLGXBB:
I am not sure wheher I am doing a systematic error in my approach or there are simply builds that fail at the moment. Some builds work, so I think I am not completely wrong ;).