[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4/4] xen/arm: correctly handle an empty array of platform descs.



On Tue, 2013-05-14 at 15:56 +0100, Ian Campbell wrote:
> On Tue, 2013-05-14 at 15:54 +0100, Ian Campbell wrote:
> > > What compiler version and switches were you using for the case
> > > where you spotted bad code to be generated?
> > 
> > gcc-linaro-aarch64-linux-gnu-4.7-2013.01-20130125_linux doing a standard
> > arm64 build of Xen.
> 
> Flags:
> 
> aarch64-linux-gnu-gcc -O1 -fno-omit-frame-pointer  -g
> -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
> -Wdeclaration-after-statement -Wno-unused-but-set-variable
> -Wno-unused-local-typedefs   -fno-builtin -fno-common -Wredundant-decls
> -iwithprefix include -Werror -Wno-pointer-arith -pipe
> -I/local/scratch/ianc/devel/arm/xen.git/xen/include -fno-stack-protector
> -fno-exceptions -Wnested-externs -mcpu=generic
> -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-optimize-sibling-calls
> -DEARLY_PRINTK -DEARLY_PRINTK_INC=\"debug-pl011.inc\" -g -D__XEN__
> -include /local/scratch/ianc/devel/arm/xen.git/xen/include/xen/config.h
> -DVERBOSE -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER -MMD
> -MF .platform.o.d -c platform.c -o platform.o
> 
> Interestingly that includes -fno-strict-aliasing, which comes from the
> top-level Config.mk

Compiling your test snippet with that I get:
0000000000000000 <test>:
   0:   a9be7bfd        stp     x29, x30, [sp,#-32]!
   4:   910003fd        mov     x29, sp
   8:   a90153f3        stp     x19, x20, [sp,#16]
   c:   90000013        adrp    x19, 0 <_s>
  10:   91000273        add     x19, x19, #0x0
  14:   90000014        adrp    x20, 0 <_e>
  18:   91000294        add     x20, x20, #0x0
  1c:   aa1303e0        mov     x0, x19
  20:   94000000        bl      0 <u>
  24:   91001273        add     x19, x19, #0x4
  28:   eb14027f        cmp     x19, x20
  2c:   54ffff81        b.ne    1c <test+0x1c>
  30:   a94153f3        ldp     x19, x20, [sp,#16]
  34:   a8c27bfd        ldp     x29, x30, [sp],#32
  38:   d65f03c0        ret

You can see it has pushed the branch at 0x2c to after the first
iteration...

But if I remove only -DGCC_HAS_VISIBILITY_ATTRIBUTE the issue goes away.

Which makes no sense because the test code has no use of that, but Aha: 
        -include /local/scratch/ianc/devel/arm/xen.git/xen/include/xen/config.h

Which eventually gets us, from compiler.h:
#ifdef GCC_HAS_VISIBILITY_ATTRIBUTE
/* Results in more efficient PIC code (no indirections through GOT or PLT). */
#pragma GCC visibility push(hidden)
#endif

I've not looked up the precise effect of that pragma yet...

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.