[PATCH] D109090: [FreeBSD] avoid marking __stack_chk_guard symbol as dso_local on FreeBSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 6 06:00:33 PDT 2021


dim added a subscriber: pkubaj.
dim added a comment.

Hmm this seems to cause some trouble when building kernels and kernel modules on FreeBSD, which are built in -ffreestanding mode, and then you get weird relocations in kernel modules:

  clang13  -O2 -pipe -fno-common  -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED -nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include /usr/home/kostik/work/DEV/src/sys/amd64/compile/X/opt_global.h -I. -I/usr/home/kostik/work/DEV/src/sys -I/usr/home/kostik/work/DEV/src/sys/contrib/ck/include -fno-common -gdwarf-2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/home/kostik/work/DEV/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/home/kostik/work/DEV/src/sys/x86/include -I/usr/home/kostik/work/DEV/src/sys/amd64/compile/X     -MD  -MF.depend.ufs_vnops.o -MTufs_vnops.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-error=unused-but-set-variable -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -c /usr/home/kostik/work/DEV/src/sys/ufs/ufs/ufs_vnops.c -o ufs_vnops.o
  
  % readelf -a ../src/sys/amd64/compile/X/modules/usr/home/kostik/work/DEV/src/sys/modules/ufs/ufs_vnops.o | grep GOT | head -3
  0000000001f7  004a0000002a R_X86_64_REX_GOTP 0000000000000000 __stack_chk_guard - 4
  00000000060d  004a0000002a R_X86_64_REX_GOTP 0000000000000000 __stack_chk_guard - 4
  0000000007c8  004a0000002a R_X86_64_REX_GOTP 0000000000000000 __stack_chk_guard - 4

Maybe this should have an additional check for freestanding mode?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109090/new/

https://reviews.llvm.org/D109090



More information about the llvm-commits mailing list