On 7/1/23 12:43 PM, Jessica Clarke wrote:
On 1 Jul 2023, at 20:23, John Baldwin <[email protected]> wrote:

The branch main has been updated by jhb:

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

commit da3096a92d2c1c06b25613444d9b369475d50321
Author:     John Baldwin <[email protected]>
AuthorDate: 2023-07-01 19:23:00 +0000
Commit:     John Baldwin <[email protected]>
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.)

That’s odd and doesn’t quite seem a sufficient explanation on its own?
PDEs can have IFUNCs just fine today, so why is it different for kernel
modules here?

I don't know.  I sort of assumed this was related to the fact that we have
custom weirdness for how ifuncs work with amd64 kernel modules (though I
guess that shouldn't matter for i386 since I think that's due to amd64 not
using DSOs for modules?).  What I do know is that ld.bfd failed to link and
said it wanted -fPIC.  It's also been a while since I first wrote this
commit and log message and I don't recall the details of how I had come to
that conclusion.

Searching now I did come across this bug report for binutils which might
suggest that this might actually be a difference in the assembler behavior:

https://sourceware.org/bugzilla/show_bug.cgi?id=27169

--
John Baldwin


Reply via email to