diff mbox

[0/3] Add __ioread32_copy() and use it

Message ID 20150918121919.fa20552946703ae772d636e9@linux-foundation.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Andrew Morton Sept. 18, 2015, 7:19 p.m. UTC
On Wed, 16 Sep 2015 04:55:46 +0200 Andi Kleen <andi@firstfloor.org> wrote:

> > Under what circumstances will the compiler (or linker?) do this? 
> 
> Compiler.
> 
> > LTO enabled?
> 
> Yes it's for LTO.  The optimization allows the compiler to drop unused
> functions, which is very popular with users (a lot use it to get smaller
> kernel images)
> 

Does this look truthful and complete?

Comments

Andi Kleen Sept. 19, 2015, 8:16 p.m. UTC | #1
On Fri, Sep 18, 2015 at 12:19:19PM -0700, Andrew Morton wrote:
> On Wed, 16 Sep 2015 04:55:46 +0200 Andi Kleen <andi@firstfloor.org> wrote:
> 
> > > Under what circumstances will the compiler (or linker?) do this? 
> > 
> > Compiler.
> > 
> > > LTO enabled?
> > 
> > Yes it's for LTO.  The optimization allows the compiler to drop unused
> > functions, which is very popular with users (a lot use it to get smaller
> > kernel images)
> > 
> 
> Does this look truthful and complete?
> 
> 
> --- a/include/linux/compiler-gcc.h~a
> +++ a/include/linux/compiler-gcc.h
> @@ -205,7 +205,10 @@
>  
>  #if GCC_VERSION >= 40600
>  /*
> - * Tell the optimizer that something else uses this function or variable.
> + * When used with Link Time Optimization, gcc can optimize away C functions or
> + * variables which are referenced only from assembly code.  __visible tells the
> + * optimizer that something else uses this function or variable, thus preventing
> + * this.

Yes,

In a few cases I also used it to work around LTO bugs in older gcc
releases. I don't think any of those fixes made it into mainline though,
and they are not needed anymore with 5.x

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/include/linux/compiler-gcc.h~a
+++ a/include/linux/compiler-gcc.h
@@ -205,7 +205,10 @@ 
 
 #if GCC_VERSION >= 40600
 /*
- * Tell the optimizer that something else uses this function or variable.
+ * When used with Link Time Optimization, gcc can optimize away C functions or
+ * variables which are referenced only from assembly code.  __visible tells the
+ * optimizer that something else uses this function or variable, thus preventing
+ * this.
  */
 #define __visible	__attribute__((externally_visible))
 #endif