Skip to content

Commit

Permalink
[build] Fix use of inline assembly on GCC 8 ARM64 builds
Browse files Browse the repository at this point in the history
Commit 1a77466 ("[build] Fix use of inline assembly on GCC 4.8 ARM64
builds") switched from using "%c0" to "%a0" in order to avoid an
"invalid operand prefix" error on the ARM64 version of GCC 4.8.

It appears that the ARM64 version of GCC 8 now produces an "invalid
address mode" error for the "%a0" form, but is happy with the original
"%c0" form.

Switch back to using the "%c0" form, on the assumption that the
requirement for "%a0" was a temporary aberration.

Originally-fixed-by: John L. Jolly <jjolly@suse.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jul 14, 2019
1 parent 1cdf56f commit 3fb3ffc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/include/errno.h
Expand Up @@ -262,10 +262,10 @@ static inline void eplatform_discard ( int dummy __unused, ... ) {}
".align 8\n\t" \
"\n1:\n\t" \
".long ( 4f - 1b )\n\t" \
".long %a0\n\t" \
".long %c0\n\t" \
".long ( 2f - 1b )\n\t" \
".long ( 3f - 1b )\n\t" \
".long %a1\n\t" \
".long %c1\n\t" \
"\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
"\n3:\t.asciz \"" __FILE__ "\"\n\t" \
".align 8\n\t" \
Expand Down

1 comment on commit 3fb3ffc

@yiya1989
Copy link

@yiya1989 yiya1989 commented on 3fb3ffc Jul 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using gcc-aarch64-linux-gnu cross tool.
When my code include this commit, it arise asm error....
When I revert this commit, it works well.

/usr1/git/bootloader/ipxe/src # rpm -qi gcc-aarch64-linux-gnu
Name : gcc-aarch64-linux-gnu
Version : 4.8.5
Release : 16.el7.1
Architecture: x86_64
Install Date: Tue 10 Jul 2018 08:00:23 PM CST
Group : Development/Tools
Size : 24674485
License : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Signature : RSA/SHA256, Thu 29 Jun 2017 03:16:05 AM CST, Key ID 6a2faea2352c64e5
Source RPM : cross-gcc-4.8.5-16.el7.1.src.rpm
Build Date : Wed 28 Jun 2017 10:28:50 PM CST
Build Host : buildhw-09.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://gcc.gnu.org
Summary : Cross-build binary utilities for aarch64-linux-gnu
Description :
Cross-build GNU C compiler.

Only building kernels is currently supported. Support for cross-building
user space programs is not currently provided as that would massively multiply
the number of packages.

/usr1/git/bootloader/ipxe/src #
/usr1/git/bootloader/ipxe/src #
/usr1/git/bootloader/ipxe/src # make CROSS=aarch64-linux-gnu- bin-arm64-efi/snponly.efi
[BUILD] bin-arm64-efi/xfer.o
In file included from core/xfer.c:29:0:
core/xfer.c: In function ‘xfer_deliver’:
include/errno.h:261:2: error: invalid 'asm': invalid operand prefix '%c'
asm ( ".section ".einfo", "", " PROGBITS_OPS "\n\t"
^
include/errno.h:619:15: note: in expansion of macro ‘__einfo_error’
#define EPIPE __einfo_error ( EINFO_EPIPE )
^
core/xfer.c:210:9: note: in expansion of macro ‘EPIPE’
rc = -EPIPE;
^
include/errno.h:261:2: error: invalid 'asm': invalid operand prefix '%c'
asm ( ".section ".einfo", "", " PROGBITS_OPS "\n\t"
^
include/errno.h:619:15: note: in expansion of macro ‘__einfo_error’
#define EPIPE __einfo_error ( EINFO_EPIPE )
^
core/xfer.c:210:9: note: in expansion of macro ‘EPIPE’
rc = -EPIPE;
^
core/xfer.c: At top level:
cc1: error: unrecognized command line option "-Wno-address-of-packed-member" [-Werror]
cc1: all warnings being treated as errors
make: *** [bin-arm64-efi/xfer.o] Error 1
/usr1/git/bootloader/ipxe/src #

Please sign in to comment.