読者です 読者をやめる 読者になる 読者になる

BHyVeビルドめも3

FreeBSD DragonFlyBSD

__inlineのコンパイルエラーを無理やり解決φ(・・*)ゞ ウーン

done:
__inlineでコンパイルエラーになってたのはvmm.hの他にこれだけあったんだけど、とりあえずs/__inline/inline/をしたのと、関数の戻り値の型のあとに__inlineがあるものは型の前にinlineを置いてむりやり解決。変更内容は見てのとおりです。

intel/vmx_cpufunc.h:static __inline int
intel/vmx_cpufunc.h:static __inline int
intel/vmx_cpufunc.h:static __inline void
intel/vmx_cpufunc.h:static __inline void
intel/vmx_cpufunc.h:static __inline int
intel/vmx_cpufunc.h:static __inline int
intel/vmx_cpufunc.h:static __inline int
intel/vmx_cpufunc.h:static void __inline
intel/vmx_cpufunc.h:static void __inline
intel/vmx_cpufunc.h:static void __inline
intel/vmx_cpufunc.h:static void __inline
intel/vmx.c:static void __inline
intel/vmx.c:static __inline void
intel/vmx.c:static __inline void
intel/vmx.c:static void __inline
intel/vmx.c:static void __inline
intel/vmx.c:static void __inline
intel/vmx.c:static void __inline
io/vlapic.c:static __inline uint32_t *
io/vlapic.c:static __inline int
io/vlapic.c:static __inline int
io/iommu.c:static __inline int
io/iommu.c:static __inline void
io/iommu.c:static __inline void *
io/iommu.c:static __inline void
io/iommu.c:static __inline uint64_t
io/iommu.c:static __inline void
io/iommu.c:static __inline void
io/iommu.c:static __inline void
io/iommu.c:static __inline void
vmm_stat.h:static void __inline

ちなみにLinuxだとinclude/linux/compiler-gcc.hにこんな定義が有ったけどBSDは良くわからなかったのですorz

/*
* Force always-inline if the user requests it so via the .config,
* or if gcc is too old:
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \\
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
# define inline inline __attribute__((always_inline)) notrace
# define __inline__ __inline__ __attribute__((always_inline)) notrace
# define __inline __inline __attribute__((always_inline)) notrace
#else
/* A lot of inline functions can cause havoc with function tracing */
# define inline inline notrace
# define __inline__ __inline__ notrace
# define __inline __inline notrace
#endif

todo:
次はvmx_cpufunc.hにあるコンパイルエラー達の修正かな。

cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -W
missing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wold-style-definition 
-std=c99 -Wold-style-declaration -g -nostdinc -I. -Iinclude -I/usr/src/sys -I/us
r/src/sys/../include -I/usr/obj/usr/src/sys/BHYVE -I"/usr/src/sys/dev/acpica5" -
I"/usr/src/sys/contrib/dev/acpica-unix/include" -I/usr/src/sys/dev/netif/ath/hal
-I/usr/src/sys/dev/netif/ath/hal/ath_hal -D_KERNEL -include opt_global.h -fin
line-limit=8000 --param inline-unit-growth=100 --param large-function-growth=100
0 -fno-common -ffreestanding -mpreferred-stack-boundary=4 -fno-stack-protector -
mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
-mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4 -mno-sse4a -mno-sse5 -m
no-abm -mno-aes -mno-avx -mno-pclmul -mno-popcnt -msoft-float -fno-asynchronous-
unwind-tables -fno-omit-frame-pointer /usr/src/sys/platform/pc64/vmm/intel/ept.
c -Werror
cc1: warnings being treated as errors
In file included from /usr/src/sys/platform/pc64/vmm/intel/ept.c:47:
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h: In function 'VMCLEAR':
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h:141: error: implicit declarat
ion of function 'critical_exit'
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h:141: error: nested extern dec
laration of 'critical_exit'
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h: At top level:
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h:144: error: 'inline' is not a
t beginning of declaration
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h: In function 'VMPTRLD':
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h:149: error: implicit declarat
ion of function 'critical_enter'
/usr/src/sys/platform/pc64/vmm/intel/vmx_cpufunc.h:149: error: nested extern dec
laration of 'critical_enter'
/usr/src/sys/platform/pc64/vmm/intel/ept.c: In function 'ept_create_mapping':
/usr/src/sys/platform/pc64/vmm/intel/ept.c:168: error: implicit declaration of f
unction 'malloc'
/usr/src/sys/platform/pc64/vmm/intel/ept.c:168: error: nested extern declaration
of 'malloc'
/usr/src/sys/platform/pc64/vmm/intel/ept.c:168: error: initialization makes poin
ter from integer without a cast
/usr/src/sys/platform/pc64/vmm/intel/ept.c: In function 'ept_free_pd_entry':
/usr/src/sys/platform/pc64/vmm/intel/ept.c:231: error: implicit declaration of f
unction 'free'
/usr/src/sys/platform/pc64/vmm/intel/ept.c:231: error: nested extern declaration
of 'free'
/usr/src/sys/platform/pc64/vmm/intel/ept.c: In function 'ept_invalidate_mappings
':
/usr/src/sys/platform/pc64/vmm/intel/ept.c:309: error: 'PAT_WRITE_BACK' undeclar
ed (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/ept.c:309: error: (Each undeclared identifi
er is reported only once
/usr/src/sys/platform/pc64/vmm/intel/ept.c:309: error: for each function it appe
ars in.)
/usr/src/sys/platform/pc64/vmm/intel/ept.c:311: error: implicit declaration of f
unction 'smp_rendezvous'
/usr/src/sys/platform/pc64/vmm/intel/ept.c:311: error: nested extern declaration
of 'smp_rendezvous'
*** Error code 1

Stop in /usr/obj/usr/src/sys/BHYVE.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.

このログ見てたら一ヶ所inlineの場所の修正漏れがあったのでコミットしておいた。