[build] Allow __asmcall to be used as a type attribute

The "used" attribute can be applied only to functions or variables,
which prevents the use of __asmcall as a type attribute.

Fix by removing "used" from the definition of __asmcall for i386 and
x86_64 architectures, and adding explicit __used annotations where
necessary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/310/head
Michael Brown 2021-03-02 10:15:23 +00:00
parent c09b627973
commit 916ebef198
6 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifndef ASSEMBLY #ifndef ASSEMBLY
/** Declare a function with standard calling conventions */ /** Declare a function with standard calling conventions */
#define __asmcall __attribute__ (( used, cdecl, regparm(0) )) #define __asmcall __attribute__ (( cdecl, regparm(0) ))
/** /**
* Declare a function with libgcc implicit linkage * Declare a function with libgcc implicit linkage

View File

@ -443,7 +443,7 @@ struct console_driver bios_console __console_driver = {
* *
* @v ix86 Registers as passed to INT 16 * @v ix86 Registers as passed to INT 16
*/ */
static __asmcall void bios_inject ( struct i386_all_regs *ix86 ) { static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
unsigned int discard_a; unsigned int discard_a;
unsigned int scancode; unsigned int scancode;
unsigned int i; unsigned int i;

View File

@ -1064,7 +1064,7 @@ static int int13_cdrom_read_boot_catalog ( struct san_device *sandev,
* INT 13 handler * INT 13 handler
* *
*/ */
static __asmcall void int13 ( struct i386_all_regs *ix86 ) { static __asmcall __used void int13 ( struct i386_all_regs *ix86 ) {
int command = ix86->regs.ah; int command = ix86->regs.ah;
unsigned int bios_drive = ix86->regs.dl; unsigned int bios_drive = ix86->regs.dl;
struct san_device *sandev; struct san_device *sandev;

View File

@ -220,7 +220,7 @@ static int comboot_fetch_kernel ( char *kernel_file, char *cmdline ) {
/** /**
* Terminate program interrupt handler * Terminate program interrupt handler
*/ */
static __asmcall void int20 ( struct i386_all_regs *ix86 __unused ) { static __asmcall __used void int20 ( struct i386_all_regs *ix86 __unused ) {
rmlongjmp ( comboot_return, COMBOOT_EXIT ); rmlongjmp ( comboot_return, COMBOOT_EXIT );
} }
@ -228,7 +228,7 @@ static __asmcall void int20 ( struct i386_all_regs *ix86 __unused ) {
/** /**
* DOS-compatible API * DOS-compatible API
*/ */
static __asmcall void int21 ( struct i386_all_regs *ix86 ) { static __asmcall __used void int21 ( struct i386_all_regs *ix86 ) {
ix86->flags |= CF; ix86->flags |= CF;
switch ( ix86->regs.ah ) { switch ( ix86->regs.ah ) {
@ -311,7 +311,7 @@ __weak int pxe_api_call_weak ( struct i386_all_regs *ix86 __unused ) {
/** /**
* SYSLINUX API * SYSLINUX API
*/ */
static __asmcall void int22 ( struct i386_all_regs *ix86 ) { static __asmcall __used void int22 ( struct i386_all_regs *ix86 ) {
ix86->flags |= CF; ix86->flags |= CF;
switch ( ix86->regs.ax ) { switch ( ix86->regs.ax ) {

View File

@ -58,7 +58,8 @@ static struct profiler virt_call_profiler __profiler = { .name = "virt_call" };
/** /**
* Dummy function for profiling tests * Dummy function for profiling tests
*/ */
static __asmcall void librm_test_call ( struct i386_all_regs *ix86 __unused ) { static __asmcall __used void
librm_test_call ( struct i386_all_regs *ix86 __unused ) {
/* Do nothing */ /* Do nothing */
} }

View File

@ -9,7 +9,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifndef ASSEMBLY #ifndef ASSEMBLY
/** Declare a function with standard calling conventions */ /** Declare a function with standard calling conventions */
#define __asmcall __attribute__ (( used, regparm(0) )) #define __asmcall __attribute__ (( regparm(0) ))
/** Declare a function with libgcc implicit linkage */ /** Declare a function with libgcc implicit linkage */
#define __libgcc #define __libgcc