[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f00a6bafca04f4ab2e070427cf9c2cc@AcuMS.aculab.com>
Date: Tue, 18 Aug 2020 21:53:58 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Nick Desaulniers' <ndesaulniers@...gle.com>,
Arvind Sankar <nivedita@...m.mit.edu>,
Dávid Bolvanský <david.bolvansky@...il.com>,
Eli Friedman <efriedma@...cinc.com>
CC: Linus Torvalds <torvalds@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Michal Marek <michal.lkml@...kovi.net>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"Kees Cook" <keescook@...omium.org>,
Tony Luck <tony.luck@...el.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Michael Ellerman <mpe@...erman.id.au>,
Joe Perches <joe@...ches.com>,
Joel Fernandes <joel@...lfernandes.org>,
Daniel Axtens <dja@...ens.net>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
Yury Norov <yury.norov@...il.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Daniel Kiper <daniel.kiper@...cle.com>,
Bruce Ashfield <bruce.ashfield@...il.com>,
Marco Elver <elver@...gle.com>,
"Vamshi K Sthambamkadi" <vamshi.k.sthambamkadi@...il.com>
Subject: RE: [PATCH 0/4] -ffreestanding/-fno-builtin-* patches
From: Nick Desaulniers
> Sent: 18 August 2020 21:59
>
> On Tue, Aug 18, 2020 at 1:27 PM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
...
> > > -ffreestanding as it stands today does have __builtin_memcpy and
> > > friends. But you need to then use #define memcpy __builtin_memcpy etc,
> > > which is messy and also doesn't fully express what you want. #pragma, or
> > > even just allowing -fbuiltin-foo options would be useful.
>
> I do really like the idea of -fbuiltin-foo. For example, you'd specify:
>
> -ffreestanding -fbuiltin-bcmp
>
> as an example. `-ffreestanding` would opt you out of ALL libcall
> optimizations, `-fbuiltin-bcmp` would then opt you back in to
> transforms that produce bcmp. That way you're informing the compiler
> more precisely about the environment you'd be targeting. It feels
> symmetric to existing `-fno-` flags (clang makes -f vs -fno- pretty
> easy when there is such symmetry). And it's already convention that
> if you specify multiple conflicting compiler flags, then the latter
> one specified "wins." In that sense, turning back on specific
> libcalls after disabling the rest looks more ergonomic to me.
>
> Maybe Eli or David have thoughts on why that may or may not be as
> ergonomic or possible to implement as I imagine?
You might want -fbuiltin-bcmp=my_bcmp_function so that you can specify
the actual elf symbol name to be used.
I was recently trying to compile an application so that it would
run on a system with an old libc.
Avoiding explicit calls to new functions wasn't a problem, but I
couldn't do anything about the memcpy() calls generated by gcc
for structure copies.
Due to the silly glibc fiasco with memcpy going backwards I'd
either need to force out a reference to the old version of memcpy
or a reference to memove - but neither is possible.
I then tried a C++ program and gave up because 'char traits'
was all different. I then realised I need to remove all references
to std::string to get any kind of efficient object code :-)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists