From a66dc0c52bd06d55654736be3d285bb481981906 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Wed, 25 May 2016 19:44:26 +0000 Subject: [PATCH] Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't have ACLE support built in. The ACLE (ARM C Language Extensions) defines a set of standardized symbols which indicate the architecture version and features available. ACLE support is built in to modern compilers (both clang and gcc), but absent from gcc prior to 4.4. ARM (the company) provides the acle-compat.h header file to define the right symbols for older versions of gcc. Basically, acle-compat.h does for arm about the same thing cdefs.h does for freebsd: defines standardized macros that work no matter which compiler you use. If ARM hadn't provided this file we would have ended up with a big #ifdef __arm__ section in cdefs.h with our own compatibility shims. Remove #include from the zillion other places (an ever-growing list) that it appears. Since style(9) requires sys/types.h or sys/param.h early in the include list, and both of those lead to including cdefs.h, only a couple special cases still need to include acle-compat.h directly. Loves it: imp --- sys/arm/arm/bcopyinout.S | 1 - sys/arm/arm/bcopyinout_xscale.S | 2 -- sys/arm/arm/bus_space_base.c | 1 - sys/arm/arm/copystr.S | 1 - sys/arm/arm/cpu_asm-v6.S | 1 - sys/arm/arm/cpufunc.c | 1 - sys/arm/arm/disassem.c | 1 - sys/arm/arm/elf_machdep.c | 1 - sys/arm/arm/exception.S | 1 - sys/arm/arm/fiq.c | 1 - sys/arm/arm/fusu.S | 1 - sys/arm/arm/genassym.c | 1 - sys/arm/arm/locore-v6.S | 1 - sys/arm/arm/machdep.c | 1 - sys/arm/arm/mem.c | 1 - sys/arm/arm/mp_machdep.c | 1 - sys/arm/arm/stdatomic.c | 1 - sys/arm/arm/swtch-v4.S | 1 - sys/arm/arm/swtch-v6.S | 1 - sys/arm/arm/sys_machdep.c | 1 - sys/arm/arm/trap-v6.c | 1 - sys/arm/arm/vm_machdep.c | 2 -- sys/arm/include/armreg.h | 2 -- sys/arm/include/asm.h | 1 - sys/arm/include/atomic.h | 2 -- sys/arm/include/bus.h | 1 - sys/arm/include/cpu-v4.h | 1 - sys/arm/include/cpu-v6.h | 1 - sys/arm/include/cpu.h | 1 - sys/arm/include/db_machdep.h | 1 - sys/arm/include/machdep.h | 2 -- sys/arm/include/param.h | 1 - sys/arm/include/pcpu.h | 1 - sys/arm/include/pmap.h | 2 -- sys/arm/include/sf_buf.h | 2 -- sys/arm/include/sysarch.h | 1 - sys/arm/include/sysreg.h | 2 -- sys/arm/include/vm.h | 2 -- sys/arm/mv/mv_machdep.c | 1 - sys/kern/imgact_elf.c | 3 --- sys/kern/subr_devmap.c | 3 --- sys/sys/cdefs.h | 8 ++++++++ 42 files changed, 8 insertions(+), 54 deletions(-) diff --git a/sys/arm/arm/bcopyinout.S b/sys/arm/arm/bcopyinout.S index 1c7e0fd6341a..0a2e83586403 100644 --- a/sys/arm/arm/bcopyinout.S +++ b/sys/arm/arm/bcopyinout.S @@ -38,7 +38,6 @@ #include "assym.s" -#include #include #include diff --git a/sys/arm/arm/bcopyinout_xscale.S b/sys/arm/arm/bcopyinout_xscale.S index 79a5027356c0..ca75347d0300 100644 --- a/sys/arm/arm/bcopyinout_xscale.S +++ b/sys/arm/arm/bcopyinout_xscale.S @@ -38,8 +38,6 @@ #include __FBSDID("$FreeBSD$"); -#include - .syntax unified .text .align 2 diff --git a/sys/arm/arm/bus_space_base.c b/sys/arm/arm/bus_space_base.c index 345ca5389ab1..e7fec46e0525 100644 --- a/sys/arm/arm/bus_space_base.c +++ b/sys/arm/arm/bus_space_base.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "opt_platform.h" diff --git a/sys/arm/arm/copystr.S b/sys/arm/arm/copystr.S index 4cb8469903d8..130e6ef9134f 100644 --- a/sys/arm/arm/copystr.S +++ b/sys/arm/arm/copystr.S @@ -39,7 +39,6 @@ */ #include "assym.s" -#include #include #include __FBSDID("$FreeBSD$"); diff --git a/sys/arm/arm/cpu_asm-v6.S b/sys/arm/arm/cpu_asm-v6.S index 7ab02cf75ac3..ea15e176d69e 100644 --- a/sys/arm/arm/cpu_asm-v6.S +++ b/sys/arm/arm/cpu_asm-v6.S @@ -28,7 +28,6 @@ */ #include "assym.s" -#include #include #include #include diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c index 9e4c3a7662d1..b2f9982455e7 100644 --- a/sys/arm/arm/cpufunc.c +++ b/sys/arm/arm/cpufunc.c @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include diff --git a/sys/arm/arm/disassem.c b/sys/arm/arm/disassem.c index b7aa099c8335..81dbe1096f2d 100644 --- a/sys/arm/arm/disassem.c +++ b/sys/arm/arm/disassem.c @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include /* diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index 2ec659aba802..a962ee882e1c 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include diff --git a/sys/arm/arm/exception.S b/sys/arm/arm/exception.S index 9466cf6385c9..e7c9e052bff1 100644 --- a/sys/arm/arm/exception.S +++ b/sys/arm/arm/exception.S @@ -48,7 +48,6 @@ #include "assym.s" -#include #include #include #include diff --git a/sys/arm/arm/fiq.c b/sys/arm/arm/fiq.c index f5ddcc6c8f17..e55aa1276deb 100644 --- a/sys/arm/arm/fiq.c +++ b/sys/arm/arm/fiq.c @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/fusu.S b/sys/arm/arm/fusu.S index ba50e67f8656..79e7ca13fea7 100644 --- a/sys/arm/arm/fusu.S +++ b/sys/arm/arm/fusu.S @@ -33,7 +33,6 @@ * */ -#include #include #include #include "assym.s" diff --git a/sys/arm/arm/genassym.c b/sys/arm/arm/genassym.c index 9c67018fed5a..944eff89df8a 100644 --- a/sys/arm/arm/genassym.c +++ b/sys/arm/arm/genassym.c @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S index 5152842ab41e..2303127ffe55 100644 --- a/sys/arm/arm/locore-v6.S +++ b/sys/arm/arm/locore-v6.S @@ -30,7 +30,6 @@ #include "assym.s" #include -#include #include #include #include diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 09bf424bcd6f..960fa6a37f03 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -94,7 +94,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/mem.c b/sys/arm/arm/mem.c index 1218ea474209..096988dc0b72 100644 --- a/sys/arm/arm/mem.c +++ b/sys/arm/arm/mem.c @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c index db52622ef014..bb3c57005c3e 100644 --- a/sys/arm/arm/mp_machdep.c +++ b/sys/arm/arm/mp_machdep.c @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/stdatomic.c b/sys/arm/arm/stdatomic.c index b12a82e2288b..29ff7f5b187f 100644 --- a/sys/arm/arm/stdatomic.c +++ b/sys/arm/arm/stdatomic.c @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/swtch-v4.S b/sys/arm/arm/swtch-v4.S index 21924dccfcc4..4576ef46a69e 100644 --- a/sys/arm/arm/swtch-v4.S +++ b/sys/arm/arm/swtch-v4.S @@ -81,7 +81,6 @@ #include "assym.s" #include "opt_sched.h" -#include #include #include #include diff --git a/sys/arm/arm/swtch-v6.S b/sys/arm/arm/swtch-v6.S index c3e6eb29d26f..a534f4383565 100644 --- a/sys/arm/arm/swtch-v6.S +++ b/sys/arm/arm/swtch-v6.S @@ -81,7 +81,6 @@ #include "assym.s" #include "opt_sched.h" -#include #include #include #include diff --git a/sys/arm/arm/sys_machdep.c b/sys/arm/arm/sys_machdep.c index b893a9028561..678157290d2f 100644 --- a/sys/arm/arm/sys_machdep.c +++ b/sys/arm/arm/sys_machdep.c @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/trap-v6.c b/sys/arm/arm/trap-v6.c index d0819172a828..018a8ea581c2 100644 --- a/sys/arm/arm/trap-v6.c +++ b/sys/arm/arm/trap-v6.c @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index fec2ca034fdf..93c3d20c10d5 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -76,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include diff --git a/sys/arm/include/armreg.h b/sys/arm/include/armreg.h index 5596b7f900d9..411517b47dbd 100644 --- a/sys/arm/include/armreg.h +++ b/sys/arm/include/armreg.h @@ -41,8 +41,6 @@ #ifndef MACHINE_ARMREG_H #define MACHINE_ARMREG_H -#include - #define INSN_SIZE 4 #define INSN_COND_MASK 0xf0000000 /* Condition mask */ #define PSR_MODE 0x0000001f /* mode mask */ diff --git a/sys/arm/include/asm.h b/sys/arm/include/asm.h index 44b9d2b19bb5..83e525cdfc9f 100644 --- a/sys/arm/include/asm.h +++ b/sys/arm/include/asm.h @@ -39,7 +39,6 @@ #ifndef _MACHINE_ASM_H_ #define _MACHINE_ASM_H_ #include -#include #include #define _C_LABEL(x) x diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index ee89f067fd45..0cf69c929480 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -42,8 +42,6 @@ #include #include -#include - #ifndef _KERNEL #include #else diff --git a/sys/arm/include/bus.h b/sys/arm/include/bus.h index d83ae8fb91c5..3fbbf93262d7 100644 --- a/sys/arm/include/bus.h +++ b/sys/arm/include/bus.h @@ -67,7 +67,6 @@ #define _MACHINE_BUS_H_ #include -#include /* * int bus_space_map (bus_space_tag_t t, bus_addr_t addr, diff --git a/sys/arm/include/cpu-v4.h b/sys/arm/include/cpu-v4.h index 606a4be26838..bd383d3f2d90 100644 --- a/sys/arm/include/cpu-v4.h +++ b/sys/arm/include/cpu-v4.h @@ -34,7 +34,6 @@ #error Only include this file in the kernel #endif -#include #include #include #include diff --git a/sys/arm/include/cpu-v6.h b/sys/arm/include/cpu-v6.h index eed3a411510f..45a91316af2a 100644 --- a/sys/arm/include/cpu-v6.h +++ b/sys/arm/include/cpu-v6.h @@ -34,7 +34,6 @@ #error Only include this file in the kernel #endif -#include #include #include #include diff --git a/sys/arm/include/cpu.h b/sys/arm/include/cpu.h index 0d79e68dc2b8..1ef5798ecddb 100644 --- a/sys/arm/include/cpu.h +++ b/sys/arm/include/cpu.h @@ -4,7 +4,6 @@ #ifndef MACHINE_CPU_H #define MACHINE_CPU_H -#include #include #include diff --git a/sys/arm/include/db_machdep.h b/sys/arm/include/db_machdep.h index 0988fe30bdc5..e741ce055bc3 100644 --- a/sys/arm/include/db_machdep.h +++ b/sys/arm/include/db_machdep.h @@ -33,7 +33,6 @@ #include #include #include -#include #define T_BREAKPOINT (1) #define T_WATCHPOINT (2) diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h index 24c8a95fec1d..9442b8b2bfd3 100644 --- a/sys/arm/include/machdep.h +++ b/sys/arm/include/machdep.h @@ -4,8 +4,6 @@ #ifndef _MACHDEP_BOOT_MACHDEP_H_ #define _MACHDEP_BOOT_MACHDEP_H_ -#include - /* Structs that need to be initialised by initarm */ #if __ARM_ARCH >= 6 extern vm_offset_t irqstack; diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 4b089e25c88c..e96fe4a7f246 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -46,7 +46,6 @@ */ #include -#include #define STACKALIGNBYTES (8 - 1) #define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES) diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h index b4814fc2503c..19cb666b42d0 100644 --- a/sys/arm/include/pcpu.h +++ b/sys/arm/include/pcpu.h @@ -32,7 +32,6 @@ #ifdef _KERNEL -#include #include #define ALT_STACK_SIZE 128 diff --git a/sys/arm/include/pmap.h b/sys/arm/include/pmap.h index 777216fd45db..044483ddace7 100644 --- a/sys/arm/include/pmap.h +++ b/sys/arm/include/pmap.h @@ -30,8 +30,6 @@ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#include - #if __ARM_ARCH >= 6 #include #else diff --git a/sys/arm/include/sf_buf.h b/sys/arm/include/sf_buf.h index 5228864946c0..c711a42d00a3 100644 --- a/sys/arm/include/sf_buf.h +++ b/sys/arm/include/sf_buf.h @@ -29,8 +29,6 @@ #ifndef _MACHINE_SF_BUF_H_ #define _MACHINE_SF_BUF_H_ -#include - static inline void sf_buf_map(struct sf_buf *sf, int flags) { diff --git a/sys/arm/include/sysarch.h b/sys/arm/include/sysarch.h index ac0a64d6b211..43abb0057505 100644 --- a/sys/arm/include/sysarch.h +++ b/sys/arm/include/sysarch.h @@ -37,7 +37,6 @@ #ifndef _ARM_SYSARCH_H_ #define _ARM_SYSARCH_H_ -#include #include /* diff --git a/sys/arm/include/sysreg.h b/sys/arm/include/sysreg.h index bbe6a29da657..f3fab5b225cc 100644 --- a/sys/arm/include/sysreg.h +++ b/sys/arm/include/sysreg.h @@ -39,8 +39,6 @@ #ifndef MACHINE_SYSREG_H #define MACHINE_SYSREG_H -#include - /* * CP14 registers */ diff --git a/sys/arm/include/vm.h b/sys/arm/include/vm.h index 2bcc26197ccd..9c6d420ff21a 100644 --- a/sys/arm/include/vm.h +++ b/sys/arm/include/vm.h @@ -29,8 +29,6 @@ #ifndef _MACHINE_VM_H_ #define _MACHINE_VM_H_ -#include - #if __ARM_ARCH >= 6 #define VM_MEMATTR_WB_WA ((vm_memattr_t)0) #define VM_MEMATTR_NOCACHE ((vm_memattr_t)1) diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c index 6abedb08e523..73972c3ef422 100644 --- a/sys/arm/mv/mv_machdep.c +++ b/sys/arm/mv/mv_machdep.c @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 6adf0da02dac..1ee4e9b5b095 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -80,9 +80,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __arm__ -#include -#endif #define ELF_NOTE_ROUNDSIZE 4 #define OLD_EI_BRAND 8 diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c index 52f873a0791e..ab0d487f4e39 100644 --- a/sys/kern/subr_devmap.c +++ b/sys/kern/subr_devmap.c @@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef __arm__ -#include -#endif #include static const struct devmap_entry *devmap_table; diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 530359f6c1e4..11c4d1e95c8b 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -780,6 +780,14 @@ #define __NO_TLS 1 #endif +/* + * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h + * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + */ +#if defined(__arm__) && !defined(__ARM_ARCH) +#include +#endif + /* * Type Safety Checking *