Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-24 Thread Ed Maste
On 23 September 2018 at 07:31, Michael Tuexen  wrote:
> Using this patch I was able to build/install world and kernel on an i386 
> system.
> However, after removing it, I can't build world then. When trying to compile a
> kernel "the old way" I end up with:
>
> tuexen@head:~/head/sys/i386/conf % config -g TCP
> WARNING: duplicate option `GEOM_PART_GPT' encountered.
> Kernel build directory is ../compile/TCP
> Don't forget to do ``make cleandepend && make depend''
> tuexen@head:~/head/sys/i386/conf % cd ../compile/TCP/
> tuexen@head:~/head/sys/i386/compile/TCP % make -j 6
> make: "../../../conf/../../../conf/kern.pre.mk" line 126: amd64/i386 kernel 
> requires linker ifunc support
>
> This is r338893.
>
> amd64 works without any problem. So this is i386 specific. Any idea how to 
> fix it?

This safety belt is in place to ensure we don't build a non-functional
kernel - now that the i386 kernel requires ifunc support using old GNU
ld results in a kernel that doesn't boot.

The workaround for the "old way" is to explicitly set LD=ld.lld in the
environment - "LD=ld.lld make -j 6" should work. More details in this
-arch thread, when amd64 encountered this hiccup:
https://lists.freebsd.org/pipermail/freebsd-arch/2018-May/018967.html

The same issue now affects i386 as it has started using ifuncs, and
will be resolved once we can switch i386's /usr/bin/ld to be lld,
which is waiting on ports fixes in PR214864.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-23 Thread Michael Tuexen
Resending from correct address...
> On 22. Sep 2018, at 05:57, Warner Losh  wrote:
> 
> Hmmm, what does make -V LINKER_TYPE and make -V LINKER_FEATURES say?
> 
> They look good for me, but the only way you get this error is if they are
> wrong.
> 
> Although from your typescript, I see:
> 
> ===> lib/libc (cleandir)
> make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
> amd64 libc requires linker ifunc support
> 
> which tells me that we need to exclude all the non-build targets from this
> check This will use the HOST linker rather than the TARGET linker.
> 
> So something like:
> 
> diff --git a/lib/libc/Makefile b/lib/libc/Makefile
> index a1ce123c0f33..11575e1cabff 100644
> --- a/lib/libc/Makefile
> +++ b/lib/libc/Makefile
> @@ -21,10 +21,12 @@ LIBC_ARCH=${MACHINE_ARCH}
> LIBC_ARCH=${MACHINE_CPUARCH}
> .endif
> 
> +.if build(all)
> .if (${LIBC_ARCH} == amd64 || ${LIBC_ARCH} == i386) && \
>defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
> .error ${LIBC_ARCH} libc requires linker ifunc support
> .endif
> +.endif
Using this patch I was able to build/install world and kernel on an i386 system.
However, after removing it, I can't build world then. When trying to compile a
kernel "the old way" I end up with:

tuexen@head:~/head/sys/i386/conf % config -g TCP
WARNING: duplicate option `GEOM_PART_GPT' encountered.
Kernel build directory is ../compile/TCP
Don't forget to do ``make cleandepend && make depend''
tuexen@head:~/head/sys/i386/conf % cd ../compile/TCP/
tuexen@head:~/head/sys/i386/compile/TCP % make -j 6
make: "../../../conf/../../../conf/kern.pre.mk" line 126: amd64/i386 kernel 
requires linker ifunc support

This is r338893.

amd64 works without any problem. So this is i386 specific. Any idea how to fix 
it?

Best regards
Michael
> 
> # All library objects contain FreeBSD revision strings by default; they
> may be
> # excluded as a space-saving measure.  To produce a library that does
> 
> may be needed, but the problem may be related to caching these values from
> the host as well, even though we rebuild them...
> 
> Warner
> 
> On Fri, Sep 21, 2018 at 9:38 PM Rebecca Cran  wrote:
> 
>> On 9/21/18 9:35 PM, Warner Losh wrote:
>>> 
>>> I meant to add, can you give a few lines before the error is spewed
>>> here in email? My IRC computer died before I could see any answers
>>> there...
>>> 
>>> My 11.2-stable system has 6.0.1, so I can't test from there.
>> 
>> 
>> I've uploaded the full 'buildworld' output to
>> https://bluestop.org/files/typescript.txt .
>> 
>> 
>> --
>> 
>> Rebecca
>> 
>> 
> ___
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-22 Thread Rebecca Cran
On 9/21/18 10:10 PM, Rebecca Cran wrote:

> On 9/21/18 10:00 PM, Warner Losh wrote:
>
>> That may be the issue... Does the patch I included help? I'm building now
>> on my stable system, but it's slow...
>
> It does seem to have got further this time, so a cautious yes.


I can change that to a definite yes:


>>> World build completed on Fri Sep 21 22:48:30 MDT 2018


-- 
Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Conrad Meyer
One thing that may allow progress is explicitly passing the path to a
new enough linker to make.

In the past when some I encountered a similar problem (I use
amd64-xtoolchain-gcc, amd64-gcc, and binutils for toolchain, and due
to some miscommunication the wrong linker was selected automatically),
I had good results passing an explicit linker LD like:

LD=/usr/local/bin/ld make -sj4 buildkernel KERNCONF=foo
CROSS_TOOLCHAIN=amd64-gcc

Best,
Conrad

On Fri, Sep 21, 2018 at 9:10 PM, Rebecca Cran  wrote:
> On 9/21/18 10:00 PM, Warner Losh wrote:
>
>> That may be the issue... Does the patch I included help? I'm building now
>> on my stable system, but it's slow...
>
>
> It does seem to have got further this time, so a cautious yes.
>
>
> --
> Rebecca
>
> ___
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Rebecca Cran
On 9/21/18 10:00 PM, Warner Losh wrote:

> That may be the issue... Does the patch I included help? I'm building now
> on my stable system, but it's slow...


It does seem to have got further this time, so a cautious yes.


-- 
Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Rebecca Cran
On 9/21/18 9:57 PM, Warner Losh wrote:

> Hmmm, what does make -V LINKER_TYPE and make -V LINKER_FEATURES say?
>
> They look good for me, but the only way you get this error is if they
> are wrong.


bcran@cube:~/workspace/freebsd % make -V LINKER_TYPE
bfd

bcran@cube:~/workspace/freebsd % make -V LINKER_FEATURES
 filter


-- 
Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Warner Losh
On Fri, Sep 21, 2018 at 9:59 PM Rebecca Cran  wrote:

> On 9/21/18 9:57 PM, Warner Losh wrote:
>
> > Hmmm, what does make -V LINKER_TYPE and make -V LINKER_FEATURES say?
> >
> > They look good for me, but the only way you get this error is if they
> > are wrong.
>
>
> bcran@cube:~/workspace/freebsd % make -V LINKER_TYPE
> bfd
>
> bcran@cube:~/workspace/freebsd % make -V LINKER_FEATURES
>  filter
>

That may be the issue... Does the patch I included help? I'm building now
on my stable system, but it's slow...

Warner
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Warner Losh
Hmmm, what does make -V LINKER_TYPE and make -V LINKER_FEATURES say?

They look good for me, but the only way you get this error is if they are
wrong.

Although from your typescript, I see:

===> lib/libc (cleandir)
make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
amd64 libc requires linker ifunc support

which tells me that we need to exclude all the non-build targets from this
check This will use the HOST linker rather than the TARGET linker.

So something like:

diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index a1ce123c0f33..11575e1cabff 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -21,10 +21,12 @@ LIBC_ARCH=${MACHINE_ARCH}
 LIBC_ARCH=${MACHINE_CPUARCH}
 .endif

+.if build(all)
 .if (${LIBC_ARCH} == amd64 || ${LIBC_ARCH} == i386) && \
 defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
 .error ${LIBC_ARCH} libc requires linker ifunc support
 .endif
+.endif

 # All library objects contain FreeBSD revision strings by default; they
may be
 # excluded as a space-saving measure.  To produce a library that does

may be needed, but the problem may be related to caching these values from
the host as well, even though we rebuild them...

Warner

On Fri, Sep 21, 2018 at 9:38 PM Rebecca Cran  wrote:

> On 9/21/18 9:35 PM, Warner Losh wrote:
> >
> > I meant to add, can you give a few lines before the error is spewed
> > here in email? My IRC computer died before I could see any answers
> > there...
> >
> > My 11.2-stable system has 6.0.1, so I can't test from there.
>
>
> I've uploaded the full 'buildworld' output to
> https://bluestop.org/files/typescript.txt .
>
>
> --
>
> Rebecca
>
>
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Warner Losh
On Fri, Sep 21, 2018 at 9:34 PM Warner Losh  wrote:

>
>
> On Fri, Sep 21, 2018 at 9:30 PM Rebecca Cran  wrote:
>
>> On 9/21/18 9:09 PM, Warner Losh wrote:
>>
>> > On Fri, Sep 21, 2018 at 9:02 PM Rebecca Cran via freebsd-toolchain <
>> > freebsd-toolch...@freebsd.org> wrote:
>> >
>> >> On 9/21/18 4:06 PM, Mark Johnston wrote:
>> >>> https://reviews.freebsd.org/D17279 for anyone else that would like to
>> >>> review.
>> >>
>> >> Is that possibly related to the error I'm getting trying to build
>> >> -CURRENT on 11.2?
>> >>
>> >>
>> >> make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
>> >> amd64 libc requires linker ifunc support
>> >>
>> > Yea, that should absolutely work. If it doesn't, that's a big big
>> problem.
>>
>>
>> I see, it was introduced earlier today in lib/libc/Makefile:
>>
>>
>> commit ef8030831eccec4e481a1766fc1c67f7cadadac9
>> Author: emaste 
>> Date:   Fri Sep 21 17:49:37 2018 +
>>
>> libc: require ifunc-capable linker for amd64/i386
>>
>> We expect to introduce optimized libc routines in the near future,
>> which requires use of a linker that supports ifuncs.
>>
>> Approved by:re (gjb, kib)
>> Sponsored by:   The FreeBSD Foundation
>>
>>
>> And /usr/bin/ld -v on my 11.2 system says:
>>
>>
>> GNU ld 2.17.50 [FreeBSD] 2007-07-03
>>
>
> What does ld.lld say?
>
> However, it shouldn't matter: we don't build libc until *AFTER* we build
> ld.lld, so this error is bogusly triggering. I suspect that it needs to be
> limited to only building targets, since tree traversal ones, as well as
> install targets don't have this dependency.
>

I meant to add, can you give a few lines before the error is spewed here in
email? My IRC computer died before I could see any answers there...

My 11.2-stable system has 6.0.1, so I can't test from there.

Warner
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Rebecca Cran
On 9/21/18 9:34 PM, Warner Losh wrote:

> What does ld.lld say? 
>
> However, it shouldn't matter: we don't build libc until *AFTER* we
> build ld.lld, so this error is bogusly triggering. I suspect that it
> needs to be limited to only building targets, since tree traversal
> ones, as well as install targets don't have this dependency.


LLD 6.0.0 (FreeBSD 326565-111) (compatible with GNU linkers)


-- 
Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Rebecca Cran
On 9/21/18 9:35 PM, Warner Losh wrote:
>
> I meant to add, can you give a few lines before the error is spewed
> here in email? My IRC computer died before I could see any answers
> there...
>
> My 11.2-stable system has 6.0.1, so I can't test from there.


I've uploaded the full 'buildworld' output to
https://bluestop.org/files/typescript.txt .


-- 

Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Warner Losh
On Fri, Sep 21, 2018 at 9:30 PM Rebecca Cran  wrote:

> On 9/21/18 9:09 PM, Warner Losh wrote:
>
> > On Fri, Sep 21, 2018 at 9:02 PM Rebecca Cran via freebsd-toolchain <
> > freebsd-toolch...@freebsd.org> wrote:
> >
> >> On 9/21/18 4:06 PM, Mark Johnston wrote:
> >>> https://reviews.freebsd.org/D17279 for anyone else that would like to
> >>> review.
> >>
> >> Is that possibly related to the error I'm getting trying to build
> >> -CURRENT on 11.2?
> >>
> >>
> >> make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
> >> amd64 libc requires linker ifunc support
> >>
> > Yea, that should absolutely work. If it doesn't, that's a big big
> problem.
>
>
> I see, it was introduced earlier today in lib/libc/Makefile:
>
>
> commit ef8030831eccec4e481a1766fc1c67f7cadadac9
> Author: emaste 
> Date:   Fri Sep 21 17:49:37 2018 +
>
> libc: require ifunc-capable linker for amd64/i386
>
> We expect to introduce optimized libc routines in the near future,
> which requires use of a linker that supports ifuncs.
>
> Approved by:re (gjb, kib)
> Sponsored by:   The FreeBSD Foundation
>
>
> And /usr/bin/ld -v on my 11.2 system says:
>
>
> GNU ld 2.17.50 [FreeBSD] 2007-07-03
>

What does ld.lld say?

However, it shouldn't matter: we don't build libc until *AFTER* we build
ld.lld, so this error is bogusly triggering. I suspect that it needs to be
limited to only building targets, since tree traversal ones, as well as
install targets don't have this dependency.

Warner
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Rebecca Cran
On 9/21/18 9:09 PM, Warner Losh wrote:

> On Fri, Sep 21, 2018 at 9:02 PM Rebecca Cran via freebsd-toolchain <
> freebsd-toolch...@freebsd.org> wrote:
>
>> On 9/21/18 4:06 PM, Mark Johnston wrote:
>>> https://reviews.freebsd.org/D17279 for anyone else that would like to
>>> review.
>>
>> Is that possibly related to the error I'm getting trying to build
>> -CURRENT on 11.2?
>>
>>
>> make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
>> amd64 libc requires linker ifunc support
>>
> Yea, that should absolutely work. If it doesn't, that's a big big problem.


I see, it was introduced earlier today in lib/libc/Makefile:


commit ef8030831eccec4e481a1766fc1c67f7cadadac9
Author: emaste 
Date:   Fri Sep 21 17:49:37 2018 +

    libc: require ifunc-capable linker for amd64/i386
   
    We expect to introduce optimized libc routines in the near future,
    which requires use of a linker that supports ifuncs.
   
    Approved by:    re (gjb, kib)
    Sponsored by:   The FreeBSD Foundation


And /usr/bin/ld -v on my 11.2 system says:


GNU ld 2.17.50 [FreeBSD] 2007-07-03


-- 
Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Warner Losh
On Fri, Sep 21, 2018 at 9:02 PM Rebecca Cran via freebsd-toolchain <
freebsd-toolch...@freebsd.org> wrote:

> On 9/21/18 4:06 PM, Mark Johnston wrote:
> >
> > https://reviews.freebsd.org/D17279 for anyone else that would like to
> > review.
>
>
> Is that possibly related to the error I'm getting trying to build
> -CURRENT on 11.2?
>
>
> make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
> amd64 libc requires linker ifunc support
>

Yea, that should absolutely work. If it doesn't, that's a big big problem.

Warner
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Rebecca Cran
On 9/21/18 4:06 PM, Mark Johnston wrote:
>
> https://reviews.freebsd.org/D17279 for anyone else that would like to
> review.


Is that possibly related to the error I'm getting trying to build
-CURRENT on 11.2?


make[4]: "/usr/home/bcran/workspace/freebsd/lib/libc/Makefile" line 26:
amd64 libc requires linker ifunc support

-- 
Rebecca

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Mark Johnston
On Fri, Sep 21, 2018 at 04:37:08PM -0400, Ed Maste wrote:
> On 21 September 2018 at 15:31, Mark Johnston  wrote:
> >
> > Perhaps the following?  It's not quite right since it'll still use
> > -zifunc-noplt with an external LLVM toolchain, but I can't seem to
> > figure out how to define a linker feature for only non-cross toolchains.
> > In any case, we're going to upstream the option soon.
> 
> I wouldn't worry too much about out-of-tree since it will be upstream
> soon as you say, otherwise looks good.
> 
> > +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
> > +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
> >  .error amd64/i386 kernel requires linker ifunc support
> >  .endif
> > +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc-noplt} != ""
> 
> Maybe roll && defined(LINKER_FEATURES) into the outer .if?

https://reviews.freebsd.org/D17279 for anyone else that would like to
review.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Ed Maste
On 21 September 2018 at 15:31, Mark Johnston  wrote:
>
> Perhaps the following?  It's not quite right since it'll still use
> -zifunc-noplt with an external LLVM toolchain, but I can't seem to
> figure out how to define a linker feature for only non-cross toolchains.
> In any case, we're going to upstream the option soon.

I wouldn't worry too much about out-of-tree since it will be upstream
soon as you say, otherwise looks good.

> +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
> +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
>  .error amd64/i386 kernel requires linker ifunc support
>  .endif
> +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc-noplt} != ""

Maybe roll && defined(LINKER_FEATURES) into the outer .if?
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Mark Johnston
On Fri, Sep 21, 2018 at 02:54:04PM -0400, Ed Maste wrote:
> On 21 September 2018 at 01:59, Mark Millard via freebsd-toolchain
>  wrote:
> > In looking into another report about using devel/amd64-gcc to buld
> > head I tried a build of -r338675 ( with WERROR= ). It got:
> >
> ...
> >
> > Question:
> >
> > Is ignoring "-z ifunc-noplt" a problem for using what
> > is built?
> 
> This will have no functional impact, should just result in a missed
> optimization. (We ought to avoid passing it to non-lld linkers
> though.)

Perhaps the following?  It's not quite right since it'll still use
-zifunc-noplt with an external LLVM toolchain, but I can't seem to
figure out how to define a linker feature for only non-cross toolchains.
In any case, we're going to upstream the option soon.

diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk
index caf4fccbae0f..bee6a9e345dc 100644
--- a/share/mk/bsd.linker.mk
+++ b/share/mk/bsd.linker.mk
@@ -13,6 +13,9 @@
 # linker support for that feature:
 #
 # - build-id:  support for generating a Build-ID note
+# - filter:support for filter DSOs
+# - ifunc: support for GNU ifuncs
+# - ifunc-noplt: support for optimized ifunc calls
 # - retpoline: support for generating PLT with retpoline speculative
 #  execution vulnerability mitigation
 #
@@ -85,6 +88,7 @@ ${X_}LINKER_FEATURES+=filter
 .endif
 .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 6
 ${X_}LINKER_FEATURES+= retpoline
+${X_}LINKER_FEATURES+= ifunc-noplt
 .endif
 .endif
 .else
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 523cea605afd..911f1accf1f6 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -121,12 +121,16 @@ CFLAGS+=  ${CONF_CFLAGS}
 LDFLAGS+=  -Wl,--build-id=sha1
 .endif
 
-.if (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386") && \
-defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
 .error amd64/i386 kernel requires linker ifunc support
 .endif
+.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc-noplt} != ""
+LDFLAGS+=  -Wl,-z -Wl,ifunc-noplt
+.endif
+.endif
 .if ${MACHINE_CPUARCH} == "amd64"
-LDFLAGS+=  -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096 
-Wl,-z -Wl,ifunc-noplt
+LDFLAGS+=  -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096
 .endif
 
 NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: building head -r338675 with devel/amd64-gcc: /usr/local/x86_64-unknown-freebsd12.0/bin/ld: warning: -z ifunc-noplt ignored

2018-09-21 Thread Ed Maste
On 21 September 2018 at 01:59, Mark Millard via freebsd-toolchain
 wrote:
> In looking into another report about using devel/amd64-gcc to buld
> head I tried a build of -r338675 ( with WERROR= ). It got:
>
...
>
> Question:
>
> Is ignoring "-z ifunc-noplt" a problem for using what
> is built?

This will have no functional impact, should just result in a missed
optimization. (We ought to avoid passing it to non-lld linkers
though.)
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"