Date: Tue, 11 Aug 2020 18:26:29 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Gleb Popov <arrowd@freebsd.org> Cc: =?utf-8?Q?T=C4=B3l?= Coosemans <tijl@freebsd.org>, toolchain@freebsd.org Subject: Re: Undefined reference to __atomic_store_8 Message-ID: <20200811152629.GN2551@kib.kiev.ua> In-Reply-To: <CALH631=7M6J3L7AzgHqEwtyBo6f-9SPM4w3PDAULUACVwJMVyg@mail.gmail.com> References: <CALH631msD2jEwaH2ejzdE5RCYd=CA2GYV-o-%2BfC6sPSskXdkTg@mail.gmail.com> <20200807212855.GB2551@kib.kiev.ua> <CALH631=FxoEdp_akV-szxTuLVrZ4oFgHWKcWJNOGEuLwqJ3Hyw@mail.gmail.com> <20200808133000.GC2551@kib.kiev.ua> <CALH631nqdHq02xYM4cnOaPhmB5L3O5TJyZiKVNrUJu7kHg0uFQ@mail.gmail.com> <20200809143742.430764e7@FreeBSD.org> <20200809154312.GH2551@kib.kiev.ua> <CALH631=7M6J3L7AzgHqEwtyBo6f-9SPM4w3PDAULUACVwJMVyg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 11, 2020 at 03:56:35PM +0400, Gleb Popov wrote: > On Sun, Aug 9, 2020 at 7:43 PM Konstantin Belousov <kostikbel@gmail.com> > wrote: > > > I do not believe there were any change in the toolchain between p2 and p7, > > this is more likely indicates some fluctuation in the build. The only > > change that could be even remotely declared as possibly related is > > EN-20:10.build r360473. > > > > Right, I was using a wrong set of port's OPTIONS that hide the problem. > > Indeed you need to look at the .o files that reference _8 symbol. I would > > closely look at the compilation command used for them, for start. > > > > After digging it a bit I found that the following command > > cc -x c > /wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/ghc-prim/cbits/atomic.c > -o /tmp/ghc_1.s -fno-PIC -Wimplicit -S \ > -include > /wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/includes/dist-install/build/ghcversion.h > -I/usr/local/include \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/base/include \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/base/dist-install/build/include > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/base/dist-install/build/dist-install/build/include > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/integer-gmp/include > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/integer-gmp/dist-install/build/include > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/integer-gmp/dist-install/build/dist-install/build/include > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/rts/dist/build > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/includes \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/includes/dist-derivedconstants/header > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/includes/dist-install/build \ > -march=i686 -U__i686 > > produce an assembly file with > > calll __atomic_load_8 > > instruction. > > The value of -march flag seems to be ignored. > > Interestingly, previous version of GHC calls C compiler in the following > way: > > cc -U__i686 '-march=i686' -fno-stack-protector -DTABLES_NEXT_TO_CODE > '-march=i686' -x c > /wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.1/libraries/ghc-prim/cbits/atomic.c > -o /tmp/ghc_1.s -Wimplicit -S \ > -include > /wrkdirs/usr/ports/lang/ghc/work/ghc-8.6.5-boot/lib/ghc-8.6.5/include/ghcversion.h > \ > -I/usr/local/include \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.6.5-boot/lib/ghc-8.6.5/base-4.12.0.0/include > \ > -I/wrkdirs/usr/ports/lang/ghc/work/ghc-8.6.5-boot/lib/ghc-8.6.5/include > > And this command produces an assembly without calls to __atomic_load_8 > > Any ideas what makes it appear? But was the compiler version identical in both cases ? Also, it might be that -O/-O2 could make a difference between inlining cmpxchg8b vs. calling libatomic, even with -march=i686.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200811152629.GN2551>