mirror of https://github.com/ipxe/ipxe.git
[build] Remove support for building with the Intel C compiler
Support for building with the Intel C compiler (icc) was added in 2009 in the expectation that UEFI support would eventually involve compiling iPXE to EFI Byte Code. EFI Byte Code has never found any widespread use: no widely available compilers can emit it, Microsoft refuses to sign EFI Byte Code binaries for UEFI Secure Boot, and I have personally never encountered any examples of EFI Byte Code in the wild. The support for using the Intel C compiler has not been tested in over a decade, and would almost certainly require modification to work with current releases of the compiler. Simplify the build process by removing this old legacy code. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/259/head
parent
df16df2c85
commit
b539e9a7e9
|
@ -48,7 +48,6 @@ ELF2EFI32 := ./util/elf2efi32
|
||||||
ELF2EFI64 := ./util/elf2efi64
|
ELF2EFI64 := ./util/elf2efi64
|
||||||
EFIROM := ./util/efirom
|
EFIROM := ./util/efirom
|
||||||
EFIFATBIN := ./util/efifatbin
|
EFIFATBIN := ./util/efifatbin
|
||||||
ICCFIX := ./util/iccfix
|
|
||||||
EINFO := ./util/einfo
|
EINFO := ./util/einfo
|
||||||
GENKEYMAP := ./util/genkeymap.pl
|
GENKEYMAP := ./util/genkeymap.pl
|
||||||
DOXYGEN := doxygen
|
DOXYGEN := doxygen
|
||||||
|
|
|
@ -76,9 +76,7 @@ CCDEFS := $(shell $(CC) -E -x c -c /dev/null -dM | cut -d" " -f2)
|
||||||
ccdefs:
|
ccdefs:
|
||||||
@$(ECHO) $(CCDEFS)
|
@$(ECHO) $(CCDEFS)
|
||||||
|
|
||||||
ifeq ($(filter __ICC,$(CCDEFS)),__ICC)
|
ifeq ($(filter __GNUC__,$(CCDEFS)),__GNUC__)
|
||||||
CCTYPE := icc
|
|
||||||
else
|
|
||||||
CCTYPE := gcc
|
CCTYPE := gcc
|
||||||
endif
|
endif
|
||||||
cctype:
|
cctype:
|
||||||
|
@ -466,32 +464,6 @@ CFLAGS += -fcommon
|
||||||
CFLAGS += -Wall -W -Wformat-nonliteral
|
CFLAGS += -Wall -W -Wformat-nonliteral
|
||||||
HOST_CFLAGS += -Wall -W -Wformat-nonliteral
|
HOST_CFLAGS += -Wall -W -Wformat-nonliteral
|
||||||
endif
|
endif
|
||||||
ifeq ($(CCTYPE),icc)
|
|
||||||
CFLAGS += -fno-builtin
|
|
||||||
CFLAGS += -no-ip
|
|
||||||
CFLAGS += -no-gcc
|
|
||||||
CFLAGS += -diag-disable 111 # Unreachable code
|
|
||||||
CFLAGS += -diag-disable 128 # Unreachable loop
|
|
||||||
CFLAGS += -diag-disable 170 # Array boundary checks
|
|
||||||
CFLAGS += -diag-disable 177 # Unused functions
|
|
||||||
CFLAGS += -diag-disable 181 # printf() format checks
|
|
||||||
CFLAGS += -diag-disable 188 # enum strictness
|
|
||||||
CFLAGS += -diag-disable 193 # Undefined preprocessor identifiers
|
|
||||||
CFLAGS += -diag-disable 280 # switch ( constant )
|
|
||||||
CFLAGS += -diag-disable 310 # K&R parameter lists
|
|
||||||
CFLAGS += -diag-disable 424 # Extra semicolon
|
|
||||||
CFLAGS += -diag-disable 589 # Declarations mid-code
|
|
||||||
CFLAGS += -diag-disable 593 # Unused variables
|
|
||||||
CFLAGS += -diag-disable 810 # Casting ints to smaller ints
|
|
||||||
CFLAGS += -diag-disable 981 # Sequence point violations
|
|
||||||
CFLAGS += -diag-disable 1292 # Ignored attributes
|
|
||||||
CFLAGS += -diag-disable 1338 # void pointer arithmetic
|
|
||||||
CFLAGS += -diag-disable 1361 # Variable-length arrays
|
|
||||||
CFLAGS += -diag-disable 1418 # Missing prototypes
|
|
||||||
CFLAGS += -diag-disable 1419 # Missing prototypes
|
|
||||||
CFLAGS += -diag-disable 1599 # Hidden variables
|
|
||||||
CFLAGS += -Wall -Wmissing-declarations
|
|
||||||
endif
|
|
||||||
CFLAGS += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
|
CFLAGS += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
|
||||||
ASFLAGS += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
|
ASFLAGS += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
|
||||||
LDFLAGS += $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
|
LDFLAGS += $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
|
||||||
|
@ -555,16 +527,6 @@ OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
|
||||||
$(BIN)/%.flags :
|
$(BIN)/%.flags :
|
||||||
@$(ECHO) $(OBJ_CFLAGS)
|
@$(ECHO) $(OBJ_CFLAGS)
|
||||||
|
|
||||||
# ICC requires postprocessing objects to fix up table alignments
|
|
||||||
#
|
|
||||||
ifeq ($(CCTYPE),icc)
|
|
||||||
POST_O = && $(ICCFIX) $@
|
|
||||||
POST_O_DEPS := $(ICCFIX)
|
|
||||||
else
|
|
||||||
POST_O :=
|
|
||||||
POST_O_DEPS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Debug level calculations
|
# Debug level calculations
|
||||||
#
|
#
|
||||||
DBGLVL_MAX = -DDBGLVL_MAX=$(firstword $(subst ., ,$(1)))
|
DBGLVL_MAX = -DDBGLVL_MAX=$(firstword $(subst ., ,$(1)))
|
||||||
|
@ -574,9 +536,9 @@ DBGLVL = $(call DBGLVL_MAX,$(1)) $(call DBGLVL_DFLT,$(1))
|
||||||
# Rules for specific object types.
|
# Rules for specific object types.
|
||||||
#
|
#
|
||||||
COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
|
COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
|
||||||
RULE_c = $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O)
|
RULE_c = $(Q)$(COMPILE_c) -c $< -o $@
|
||||||
RULE_c_to_ids.o = $(Q)$(ECHO_E) '$(OBJ_IDS_ASM_NL)' | $(ASSEMBLE_S) -o $@
|
RULE_c_to_ids.o = $(Q)$(ECHO_E) '$(OBJ_IDS_ASM_NL)' | $(ASSEMBLE_S) -o $@
|
||||||
RULE_c_to_dbg%.o= $(Q)$(COMPILE_c) $(call DBGLVL,$*) -c $< -o $@ $(POST_O)
|
RULE_c_to_dbg%.o= $(Q)$(COMPILE_c) $(call DBGLVL,$*) -c $< -o $@
|
||||||
RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
|
RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
|
||||||
RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
|
RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
|
||||||
|
|
||||||
|
@ -919,7 +881,7 @@ endef
|
||||||
# $(3) is the source base name (e.g. "rtl8139")
|
# $(3) is the source base name (e.g. "rtl8139")
|
||||||
#
|
#
|
||||||
define rules_template_parts
|
define rules_template_parts
|
||||||
$$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)
|
$$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$($(3)_DEPS)
|
||||||
$$(QM)$(ECHO) " [BUILD] $$@"
|
$$(QM)$(ECHO) " [BUILD] $$@"
|
||||||
$$(RULE_$(2))
|
$$(RULE_$(2))
|
||||||
BOBJS += $$(BIN)/$(3).o
|
BOBJS += $$(BIN)/$(3).o
|
||||||
|
@ -934,7 +896,7 @@ endef
|
||||||
# $(4) is the destination type (e.g. "dbg%.o")
|
# $(4) is the destination type (e.g. "dbg%.o")
|
||||||
#
|
#
|
||||||
define rules_template_target
|
define rules_template_target
|
||||||
$$(BIN)/$(3).$(4) : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)
|
$$(BIN)/$(3).$(4) : $(1) $$(MAKEDEPS) $$($(3)_DEPS)
|
||||||
$$(QM)$(ECHO) " [BUILD] $$@"
|
$$(QM)$(ECHO) " [BUILD] $$@"
|
||||||
$$(RULE_$(2)_to_$(4))
|
$$(RULE_$(2)_to_$(4))
|
||||||
$(TGT)_OBJS += $$(BIN)/$(3).$(4)
|
$(TGT)_OBJS += $$(BIN)/$(3).$(4)
|
||||||
|
@ -1473,15 +1435,6 @@ $(EFIFATBIN) : util/efifatbin.c $(MAKEDEPS)
|
||||||
$(Q)$(HOST_CC) $(HOST_CFLAGS) -idirafter include -o $@ $<
|
$(Q)$(HOST_CC) $(HOST_CFLAGS) -idirafter include -o $@ $<
|
||||||
CLEANUP += $(EFIFATBIN)
|
CLEANUP += $(EFIFATBIN)
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
#
|
|
||||||
# The ICC fixup utility
|
|
||||||
#
|
|
||||||
$(ICCFIX) : util/iccfix.c $(MAKEDEPS)
|
|
||||||
$(QM)$(ECHO) " [HOSTCC] $@"
|
|
||||||
$(Q)$(HOST_CC) $(HOST_CFLAGS) -idirafter include -o $@ $<
|
|
||||||
CLEANUP += $(ICCFIX)
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# The error usage information utility
|
# The error usage information utility
|
||||||
|
|
|
@ -29,11 +29,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
/* EFI headers redefine ARRAY_SIZE */
|
/* EFI headers redefine ARRAY_SIZE */
|
||||||
#undef ARRAY_SIZE
|
#undef ARRAY_SIZE
|
||||||
|
|
||||||
/* EFI headers expect ICC to define __GNUC__ */
|
|
||||||
#if defined ( __ICC ) && ! defined ( __GNUC__ )
|
|
||||||
#define __GNUC__ 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* EFI headers think your compiler uses the MS ABI by default on X64 */
|
/* EFI headers think your compiler uses the MS ABI by default on X64 */
|
||||||
#if __x86_64__
|
#if __x86_64__
|
||||||
#define EFIAPI __attribute__((ms_abi))
|
#define EFIAPI __attribute__((ms_abi))
|
||||||
|
|
|
@ -444,75 +444,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
pointer >= table_start ( table ) ; \
|
pointer >= table_start ( table ) ; \
|
||||||
pointer-- )
|
pointer-- )
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
*
|
|
||||||
* Intel's C compiler chokes on several of the constructs used in this
|
|
||||||
* file. The workarounds are ugly, so we use them only for an icc
|
|
||||||
* build.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define ICC_ALIGN_HACK_FACTOR 128
|
|
||||||
#ifdef __ICC
|
|
||||||
|
|
||||||
/*
|
|
||||||
* icc miscompiles zero-length arrays by inserting padding to a length
|
|
||||||
* of two array elements. We therefore have to generate the
|
|
||||||
* __table_entries() symbols by hand in asm.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#undef __table_entries
|
|
||||||
#define __table_entries( table, idx ) ( { \
|
|
||||||
extern __table_type ( table ) \
|
|
||||||
__table_temp_sym ( idx, __LINE__ ) [] \
|
|
||||||
__table_entry ( table, idx ) \
|
|
||||||
asm ( __table_entries_sym ( table, idx ) ); \
|
|
||||||
__asm__ ( ".ifndef %c0\n\t" \
|
|
||||||
".section " __table_section ( table, idx ) "\n\t" \
|
|
||||||
".align %c1\n\t" \
|
|
||||||
"\n%c0:\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
".endif\n\t" \
|
|
||||||
: : "i" ( __table_temp_sym ( idx, __LINE__ ) ), \
|
|
||||||
"i" ( __table_alignment ( table ) ) ); \
|
|
||||||
__table_temp_sym ( idx, __LINE__ ); } )
|
|
||||||
#define __table_entries_sym( table, idx ) \
|
|
||||||
"__tbl_" __table_name ( table ) "_" #idx
|
|
||||||
#define __table_temp_sym( a, b ) \
|
|
||||||
___table_temp_sym( __table_, a, _, b )
|
|
||||||
#define ___table_temp_sym( a, b, c, d ) a ## b ## c ## d
|
|
||||||
|
|
||||||
/*
|
|
||||||
* icc ignores __attribute__ (( aligned (x) )) when it is used to
|
|
||||||
* decrease the compiler's default choice of alignment (which may be
|
|
||||||
* higher than the alignment actually required by the structure). We
|
|
||||||
* work around this by forcing the alignment to a large multiple of
|
|
||||||
* the required value (so that we are never attempting to decrease the
|
|
||||||
* default alignment) and then postprocessing the object file to
|
|
||||||
* reduce the alignment back down to the "real" value.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#undef __table_alignment
|
|
||||||
#define __table_alignment( table ) \
|
|
||||||
( ICC_ALIGN_HACK_FACTOR * __alignof__ ( __table_type ( table ) ) )
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Because of the alignment hack, we must ensure that the compiler
|
|
||||||
* never tries to place multiple objects within the same section,
|
|
||||||
* otherwise the assembler will insert padding to the (incorrect)
|
|
||||||
* alignment boundary. Do this by appending the line number to table
|
|
||||||
* section names.
|
|
||||||
*
|
|
||||||
* Note that we don't need to worry about padding between array
|
|
||||||
* elements, since the alignment is declared on the variable (i.e. the
|
|
||||||
* whole array) rather than on the type (i.e. on all individual array
|
|
||||||
* elements).
|
|
||||||
*/
|
|
||||||
#undef __table_section
|
|
||||||
#define __table_section( table, idx ) \
|
|
||||||
".tbl." __table_name ( table ) "." __table_str ( idx ) \
|
|
||||||
"." __table_xstr ( __LINE__ )
|
|
||||||
#define __table_xstr( x ) __table_str ( x )
|
|
||||||
|
|
||||||
#endif /* __ICC */
|
|
||||||
|
|
||||||
#endif /* _IPXE_TABLES_H */
|
#endif /* _IPXE_TABLES_H */
|
||||||
|
|
|
@ -6,5 +6,4 @@ elf2efi32
|
||||||
elf2efi64
|
elf2efi64
|
||||||
efirom
|
efirom
|
||||||
efifatbin
|
efifatbin
|
||||||
iccfix
|
|
||||||
einfo
|
einfo
|
||||||
|
|
|
@ -1,157 +0,0 @@
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <elf.h>
|
|
||||||
#include <ipxe/tables.h>
|
|
||||||
|
|
||||||
#define DEBUG 0
|
|
||||||
|
|
||||||
#define eprintf(...) fprintf ( stderr, __VA_ARGS__ )
|
|
||||||
|
|
||||||
#define dprintf(...) do { \
|
|
||||||
if ( DEBUG ) \
|
|
||||||
fprintf ( stderr, __VA_ARGS__ ); \
|
|
||||||
} while ( 0 )
|
|
||||||
|
|
||||||
#ifdef SELF_INCLUDED
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fix up ICC alignments
|
|
||||||
*
|
|
||||||
* @v elf ELF header
|
|
||||||
* @ret rc Return status code
|
|
||||||
*
|
|
||||||
* See comments in tables.h for an explanation of why this monstrosity
|
|
||||||
* is necessary.
|
|
||||||
*/
|
|
||||||
static int ICCFIX ( void *elf ) {
|
|
||||||
ELF_EHDR *ehdr = elf;
|
|
||||||
ELF_SHDR *shdr = ( elf + ehdr->e_shoff );
|
|
||||||
size_t shentsize = ehdr->e_shentsize;
|
|
||||||
unsigned int shnum = ehdr->e_shnum;
|
|
||||||
ELF_SHDR *strtab = ( ( ( void * ) shdr ) +
|
|
||||||
( ehdr->e_shstrndx * shentsize ) );
|
|
||||||
char *strings = ( elf + strtab->sh_offset );
|
|
||||||
|
|
||||||
for ( ; shnum-- ; shdr = ( ( ( void * ) shdr ) + shentsize ) ) {
|
|
||||||
char *name = ( strings + shdr->sh_name );
|
|
||||||
unsigned long align = shdr->sh_addralign;
|
|
||||||
unsigned long new_align;
|
|
||||||
|
|
||||||
if ( ( strncmp ( name, ".tbl.", 5 ) == 0 ) &&
|
|
||||||
( align >= ICC_ALIGN_HACK_FACTOR ) ) {
|
|
||||||
new_align = ( align / ICC_ALIGN_HACK_FACTOR );
|
|
||||||
shdr->sh_addralign = new_align;
|
|
||||||
dprintf ( "Section \"%s\": alignment %ld->%ld\n",
|
|
||||||
name, align, new_align );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* SELF_INCLUDED */
|
|
||||||
|
|
||||||
#define SELF_INCLUDED
|
|
||||||
|
|
||||||
/* Include iccfix32() function */
|
|
||||||
#define ELF_EHDR Elf32_Ehdr
|
|
||||||
#define ELF_SHDR Elf32_Shdr
|
|
||||||
#define ICCFIX iccfix32
|
|
||||||
#include "iccfix.c"
|
|
||||||
#undef ELF_EHDR
|
|
||||||
#undef ELF_SHDR
|
|
||||||
#undef ICCFIX
|
|
||||||
|
|
||||||
/* Include iccfix64() function */
|
|
||||||
#define ELF_EHDR Elf64_Ehdr
|
|
||||||
#define ELF_SHDR Elf64_Shdr
|
|
||||||
#define ICCFIX iccfix64
|
|
||||||
#include "iccfix.c"
|
|
||||||
#undef ELF_EHDR
|
|
||||||
#undef ELF_SHDR
|
|
||||||
#undef ICCFIX
|
|
||||||
|
|
||||||
static int iccfix ( const char *filename ) {
|
|
||||||
int fd;
|
|
||||||
struct stat stat;
|
|
||||||
void *elf;
|
|
||||||
unsigned char *eident;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* Open and mmap file */
|
|
||||||
fd = open ( filename, O_RDWR );
|
|
||||||
if ( fd < 0 ) {
|
|
||||||
eprintf ( "Could not open %s: %s\n",
|
|
||||||
filename, strerror ( errno ) );
|
|
||||||
rc = -1;
|
|
||||||
goto err_open;
|
|
||||||
}
|
|
||||||
if ( fstat ( fd, &stat ) < 0 ) {
|
|
||||||
eprintf ( "Could not determine size of %s: %s\n",
|
|
||||||
filename, strerror ( errno ) );
|
|
||||||
rc = -1;
|
|
||||||
goto err_fstat;
|
|
||||||
}
|
|
||||||
elf = mmap ( NULL, stat.st_size, ( PROT_READ | PROT_WRITE ),
|
|
||||||
MAP_SHARED, fd, 0 );
|
|
||||||
if ( elf == MAP_FAILED ) {
|
|
||||||
eprintf ( "Could not map %s: %s\n",
|
|
||||||
filename, strerror ( errno ) );
|
|
||||||
rc = -1;
|
|
||||||
goto err_mmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform fixups */
|
|
||||||
eident = elf;
|
|
||||||
switch ( eident[EI_CLASS] ) {
|
|
||||||
case ELFCLASS32:
|
|
||||||
rc = iccfix32 ( elf );
|
|
||||||
break;
|
|
||||||
case ELFCLASS64:
|
|
||||||
rc = iccfix64 ( elf );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
eprintf ( "Unknown ELF class %d in %s\n",
|
|
||||||
eident[EI_CLASS], filename );
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
munmap ( elf, stat.st_size );
|
|
||||||
err_mmap:
|
|
||||||
err_fstat:
|
|
||||||
close ( fd );
|
|
||||||
err_open:
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main ( int argc, char **argv ) {
|
|
||||||
int i;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* Parse command line */
|
|
||||||
if ( argc < 2 ) {
|
|
||||||
eprintf ( "Syntax: %s <object_file>...\n", argv[0] );
|
|
||||||
exit ( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process each object in turn */
|
|
||||||
for ( i = 1 ; i < argc ; i++ ) {
|
|
||||||
if ( ( rc = iccfix ( argv[i] ) ) != 0 ) {
|
|
||||||
eprintf ( "Could not fix up %s\n", argv[i] );
|
|
||||||
exit ( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SELF_INCLUDED */
|
|
Loading…
Reference in New Issue