Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jul 2023 14:19:15 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: da3096a92d2c - main - rdrand_rng: Build with -fPIC on i386 when using GCC.
Message-ID:  <e9deb969-10ee-dd3e-bc6c-817e93eba924@FreeBSD.org>
In-Reply-To: <43225A5D-CBC7-4F1E-9B28-78A5A703FB56@freebsd.org>
References:  <202307011923.361JNMtJ070354@gitrepo.freebsd.org> <43225A5D-CBC7-4F1E-9B28-78A5A703FB56@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7/1/23 12:43 PM, Jessica Clarke wrote:
> On 1 Jul 2023, at 20:23, John Baldwin <jhb@FreeBSD.org> wrote:
>>
>> 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.)
> 
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e9deb969-10ee-dd3e-bc6c-817e93eba924>