Bug 251580 - make installkernel requires amd64/arm64/i386 kernel requires linker ifunc support
Summary: make installkernel requires amd64/arm64/i386 kernel requires linker ifunc sup...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-04 14:54 UTC by Dan Langille
Modified: 2021-01-05 22:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Langille freebsd_committer freebsd_triage 2020-12-04 14:54:21 UTC
When upgrading from FreeBSD 11.3 to FreeBDS 12.2 yesterday, I encountered this error when doing "make installkernel"

make[2]: "/usr/src/sys/conf/kern.pre.mk" line 135: amd64/arm64/i386 kernel requires linker ifunc support

To avoid the issue, I first updated to 12.1, then went to 12.2

This problem does not occur on 11.4
Comment 1 Ed Maste freebsd_committer freebsd_triage 2020-12-04 14:56:45 UTC
The check is:

.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
    ${MACHINE_CPUARCH} == "i386" || ${MACHINE} == "powerpc") && \
    defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
.error amd64/arm64/i386/ppc* kernel requires linker ifunc support
.endif

I think adding `&& !make(install)` would solve this issue.
Comment 2 Dan Langille freebsd_committer freebsd_triage 2020-12-08 17:16:42 UTC
(In reply to Dan Langille from comment #0)

I claimed: "This problem does not occur on 11.4"

This is false.  The problem also occurs on FreeBSD 11.4
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-12-27 17:50:12 UTC
A commit in branch main references this bug:

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

commit 581ade97d561e136dbb7cf7a413128c343a23199
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2020-12-27 00:34:24 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2020-12-27 17:46:51 +0000

    Perform kernel linker ifunc test only for builds

    dvl reported that "make installkernel" failed with "amd64/arm64/i386
    kernel requires linker ifunc support."  This test should apply to builds
    only; the linker is not used at install time.

    I think the same (ifunc-supporting) linker used to build the kernel
    should be detected at install time in usual cases (and so not trigger
    this error).  However, there is no reason to disallow the install, if
    for some reason the expected linker isn't the one tested at install
    time.

    PR:             251580
    Reported by:    dvl
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation

 sys/conf/kern.pre.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 4 Dan Langille freebsd_committer freebsd_triage 2021-01-05 19:32:11 UTC
We applied that patch to our local copy of the 12.2 code (which exists on an NFS mount; that's how we upgrade).

For those hitting this problem: you don't have to rebuild.  Just patch that file and try the "make installkernel" again - that was just tested and it worked here.
Comment 5 Ed Maste freebsd_committer freebsd_triage 2021-01-05 19:44:46 UTC
Thank you for testing - MFC'd now
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-01-05 19:44:59 UTC
A commit in branch stable/12 references this bug:

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

commit df592782db906594c7f7ee0bdb9ed502401cd532
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2020-12-27 00:34:24 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-01-05 19:44:31 +0000

    Perform kernel linker ifunc test only for builds

    dvl reported that "make installkernel" failed with "amd64/arm64/i386
    kernel requires linker ifunc support."  This test should apply to builds
    only; the linker is not used at install time.

    I think the same (ifunc-supporting) linker used to build the kernel
    should be detected at install time in usual cases (and so not trigger
    this error).  However, there is no reason to disallow the install, if
    for some reason the expected linker isn't the one tested at install
    time.

    PR:             251580
    Reported by:    dvl
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 581ade97d561e136dbb7cf7a413128c343a23199)

 sys/conf/kern.pre.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)