Discussion:
[ipxe-devel] Building bin-arm64-efi/snp.efi is broken
Heinrich Schuchardt
2018-08-04 12:57:49 UTC
Permalink
The following patch breaks building for arm64 with GCC 8.1.0 (as
supplied by package gcc-aarch64-linux-gnu in Debian Buster):

commit 1a7746603bca1022b63c406c9459525312a2b2b6
Author: Michael Brown <***@ipxe.org>
Date: Fri Jul 28 13:50:35 2017 +0100

[build] Fix use of inline assembly on GCC 4.8 ARM64 builds


In file included from core/blocktrans.c:34:
core/blocktrans.c: In function ‘blktrans_xferbuf_realloc’:
include/errno.h:261:2: error: invalid 'asm': invalid address mode
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
^~~~~~~
include/errno.h:589:17: note: in expansion of macro ‘__einfo_error’
#define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
^~~~~~~~~~~~~
core/blocktrans.c:57:11: note: in expansion of macro ‘ENOTSUP’
return -ENOTSUP;
^~~~~~~
include/errno.h:261:2: error: invalid 'asm': invalid address mode
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
^~~~~~~
include/errno.h:589:17: note: in expansion of macro ‘__einfo_erro

Please, correct the coding.

Best regards

Heinrich Schuchardt
Heinrich Schuchardt
2018-08-04 13:14:22 UTC
Permalink
Post by Heinrich Schuchardt
The following patch breaks building for arm64 with GCC 8.1.0 (as
commit 1a7746603bca1022b63c406c9459525312a2b2b6
Date: Fri Jul 28 13:50:35 2017 +0100
[build] Fix use of inline assembly on GCC 4.8 ARM64 builds
include/errno.h:261:2: error: invalid 'asm': invalid address mode
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
^~~~~~~
include/errno.h:589:17: note: in expansion of macro ‘__einfo_error’
#define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
^~~~~~~~~~~~~
core/blocktrans.c:57:11: note: in expansion of macro ‘ENOTSUP’
return -ENOTSUP;
^~~~~~~
include/errno.h:261:2: error: invalid 'asm': invalid address mode
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
^~~~~~~
include/errno.h:589:17: note: in expansion of macro ‘__einfo_erro
Please, correct the coding.
Best regards
Heinrich Schuchardt
The error occurs also for native compilation with GCC 8.2.0.

When cross compiling using gcc-7.3.0 the above error does not occur but
I get

[BUILD] bin-arm64-efi/ath9k.ids.o
[HOSTCC] util/elf2efi64
gcc: error: unrecognized argument in option ‘-mabi=lp64’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
make: *** [Makefile.housekeeping:1397: util/elf2efi64] Error 1
make: *** Waiting for unfinished jobs....

Best regards

Heinrich
Heinrich Schuchardt
2018-08-26 10:39:07 UTC
Permalink
Post by Heinrich Schuchardt
The following patch breaks building for arm64 with GCC 8.1.0 (as
commit 1a7746603bca1022b63c406c9459525312a2b2b6
Date: Fri Jul 28 13:50:35 2017 +0100
[build] Fix use of inline assembly on GCC 4.8 ARM64 builds
include/errno.h:261:2: error: invalid 'asm': invalid address mode
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
^~~~~~~
include/errno.h:589:17: note: in expansion of macro ‘__einfo_error’
#define ENOTSUP __einfo_error ( EINFO_ENOTSUP )
^~~~~~~~~~~~~
core/blocktrans.c:57:11: note: in expansion of macro ‘ENOTSUP’
return -ENOTSUP;
^~~~~~~
include/errno.h:261:2: error: invalid 'asm': invalid address mode
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
^~~~~~~
include/errno.h:589:17: note: in expansion of macro ‘__einfo_erro
Please, correct the coding.
Best regards
Heinrich Schuchardt
Hello Michael,
+++ b/src/include/errno.h
@@ -261,11 +262,11 @@ static inline void eplatform_discard ( int dummy
__unused, ... ) {}
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
".align 8\n\t" \
"\n1:\n\t" \
".long ( 4f - 1b )\n\t" \
==> ".long %a0\n\t" \
".long ( 2f - 1b )\n\t" \
".long ( 3f - 1b )\n\t" \
==> ".long %a1\n\t" \
"\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
"\n3:\t.asciz \"" __FILE__ "\"\n\t" \
".align 8\n\t" \
Please, replace them with valid gcc 8 assembler code.
Best regards
Heinrich Schuchardt
The prefix "a" in ".long %a0" is only defined for the x86 architecture
and not for arm64. See
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86Operandmodifiers

You introduced it in

Commit 1a7746603bca ("Fix use of inline assembly on GCC 4.8 ARM64 builds")

Does any architecture need the prefix for a current GCC?
GCC 4.8 has not seen any update since 2014. So why should we care about it?

Best regards

Heinrich Schuchardt

Loading...