Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2018 09:21:11 -0400
From:      Sean Fertile <sd.fertile@gmail.com>
To:        marklmi@yahoo.com
Cc:        chmeeedalf@gmail.com, nwhitehorn@freebsd.org, freebsd-ppc@freebsd.org
Subject:   Re: Reasons to still not build buildworld buildkernel via system-clang --John Baldwin notes one I was unaware of
Message-ID:  <CA%2BD7ZeEwOnshEmnRepH6_y3ns2bF859k5i-1fEspYwt0mWJ_gg@mail.gmail.com>
In-Reply-To: <23400842-E5CB-4251-BFE5-78D524A64012@yahoo.com>
References:  <23400842-E5CB-4251-BFE5-78D524A64012@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Clang isn't getting the tls model wrong, it actually generates pic code by
default as if -fpic were specified. I think the original intent behind
switching
to pic by default was due to incorrectly thinking gcc was pic by default
(I'm not sure if this was meant as only gcc on BSD or gcc on powerpc64 in
general),
as well as working around some problems that clangs non-pic codegen has/had
for the ELF V1 abi. There are some patches on phabricator for switching
the default back to non-pic codegen, but they leave the pic default for
BSD: https://reviews.llvm.org/D53384 and https://reviews.llvm.org/D53383

According to what you and John are saying the pic default is incorrect for
BSD as well. If thats the case please either comment on the reviews to let
Stefan know,
or let me know here and we can update the patches accordingly.

Thanks
Sean



On Thu, Oct 18, 2018 at 11:27 AM Mark Millard via freebsd-ppc <
freebsd-ppc@freebsd.org> wrote:

> I described to John Baldwin what I know of for why clang is
> not yet  appropriate to buildworld buildkernel for powerpc64
> and powerpc:
>
> QUOTE
> Unfortunately, clang is broken in other ways for buildworld
> buildkernel use for targeting powerpc64 or powerpc:
>
> A) it silently ignores __builtin_eh_return(offset,handler)
>    and so produces system-library code that is broken
>    relative to handling thrown C++ exceptions.
>
> B) it produces types of linkage for buildkernel that
>    FreeBSD does not handle, leading to dynamic loads
>    of .ko files that crash the system. (Back in clang
>    4 days it did not have this problem and I was
>    running kernels built by clang.)
> END QUOTE
>
> John Baldwin reported back something of which I was unaware:
>
> QUOTE
> It will also get the TLS model wrong for powerpc.  Both MIPS and powerpc
> have an implicit default to PIC mode and llvm interprets this implicit
> PIC to mean that it should use dynamic TLS models (intended for use in
> shared libraries) always.  GCC only uses dynamic models if -fPIC is
> explicitly passed on the command line.  I have a hack to force the TLS
> model
> for static libraries and binaries for MIPS in bsd.*.mk that isn't in-tree,
> but it really needs to be fixed in clang and llvm.
> END QUOTE
>
> I wonder if there is anything in llvm's bugzilla about this, or
> FreeBSD's bugzilla for that matter.
>
> Are there other known issues not covered by the above 3?
>
> ===
> Mark Millard
> marklmi at yahoo.com
> ( dsl-only.net went
> away in early 2018-Mar)
>
> _______________________________________________
> freebsd-ppc@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
> To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BD7ZeEwOnshEmnRepH6_y3ns2bF859k5i-1fEspYwt0mWJ_gg>