git: da3096a92d2c - main - rdrand_rng: Build with -fPIC on i386 when using GCC.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 01 Jul 2023 19:23:22 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=da3096a92d2c1c06b25613444d9b369475d50321

commit da3096a92d2c1c06b25613444d9b369475d50321
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-07-01 19:23:00 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-07-01 19:23:00 +0000

    rdrand_rng: Build with -fPIC on i386 when using GCC.
    
    ld.bfd requires an R_386_PLT32 relocation for calls to ifuncs
    rather than R_386_PC32.  (lld permits R_386_PC32.)
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D40811
---
 sys/modules/rdrand_rng/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/modules/rdrand_rng/Makefile b/sys/modules/rdrand_rng/Makefile
index 7f14c080a260..3fdecd64f78f 100644
--- a/sys/modules/rdrand_rng/Makefile
+++ b/sys/modules/rdrand_rng/Makefile
@@ -8,4 +8,9 @@ SRCS+=	bus_if.h device_if.h
 
 CFLAGS+= -I${SRCTOP}/sys
 
+# ld.bfd doesn't support ifuncs invoked non-PIC
+.if ${MACHINE_CPUARCH} == "i386"
+CFLAGS.gcc= -fPIC
+.endif
+
 .include <bsd.kmod.mk>