Skip to content

Instantly share code, notes, and snippets.

@alexandrumc
Last active May 20, 2019 11:30
Show Gist options
  • Save alexandrumc/be0754589e4878c652c8d0a86be4b4f3 to your computer and use it in GitHub Desktop.
Save alexandrumc/be0754589e4878c652c8d0a86be4b4f3 to your computer and use it in GitHub Desktop.
How virtio_net.c is compiled in Linux kernel
gcc -Wp,-MD,drivers/net/.virtio_net_tmp.mod.o.d  
	-nostdinc 
	-isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi 
	-I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h 
	-D__KERNEL__ -Wall -Wundef 
	-Wstrict-prototypes -Wno-trigraphs 
	-fno-strict-aliasing -fno-common -fshort-wchar 
	-Werror-implicit-function-declaration -Wno-format-security 
	-std=gnu89 
	-fno-PIE 
	-DCC_HAVE_ASM_GOTO 
	-mno-sse -mno-mmx 
	-mno-sse2 -mno-3dnow -mno-avx
	-m64 
	-falign-jumps=1 -falign-loops=1 
	-mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic 
	-mno-red-zone -mcmodel=kernel -funit-at-a-time 
	-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 
	-pipe 
	-Wno-sign-compare 
	-fno-asynchronous-unwind-tables 
	-mindirect-branch=thunk-extern -mindirect-branch-register 
	-DRETPOLINE 
	-fno-delete-null-pointer-checks 
	-Wno-frame-address -Wno-format-truncation -Wno-format-overflow 
	-Wno-int-in-bool-context 
	-O2 
	--param=allow-store-data-races=0 
	-Wframe-larger-than=1024 
	-fstack-protector-strong 
	-Wno-unused-but-set-variable 
	-Wno-unused-const-variable 
	-fno-omit 
	-frame-pointer 
	-fno-optimize-sibling-calls -fno-var-tracking-assignments 
	-g -gdwarf-4 
	-Wdeclaration-after-statement -Wno-pointer-sign 
	-fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack 
	-Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init
	-DKBUILD_BASENAME='"virtio_net_tmp.mod"' -DKBUILD_MODNAME='"virtio_net_tmp"' -DMODULE  -c -o drivers/net/virtio_net_tmp.mod.o drivers/net/virtio_net_tmp.mod.c

ld -r -m elf_x86_64  -z max-page-size=0x200000 -T ./scripts/module-common.lds  --build-id  -o drivers/net/virtio_net_tmp.ko drivers/net/virtio_net_tmp.o drivers/net/virtio_net_tmp.mod.o ;  true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment