From: Ian Campbell Subject: Re: [PATCH 4/4] xen/arm: correctly handle an empty array of platform descs. Date: Tue, 14 May 2013 16:07:51 +0100 Message-ID: <1368544071.14264.46.camel@zakaz.uk.xensource.com> References: <1368462160.537.125.camel@zakaz.uk.xensource.com> <1368462182-10317-4-git-send-email-ian.campbell@citrix.com> <1368523975.14264.22.camel@zakaz.uk.xensource.com> <5192248402000078000D5E7F@nat28.tlf.novell.com> <1368526880.14264.29.camel@zakaz.uk.xensource.com> <5192666A02000078000D60F8@nat28.tlf.novell.com> <1368543272.14264.41.camel@zakaz.uk.xensource.com> <1368543416.14264.42.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1368543416.14264.42.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: "Keir (Xen.org)" , Stefano Stabellini , "Tim (Xen.org)" , Ian Jackson , "xen-devel@lists.xen.org" , Julien Grall List-Id: xen-devel@lists.xenproject.org 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 : 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 24: 91001273 add x19, x19, #0x4 28: eb14027f cmp x19, x20 2c: 54ffff81 b.ne 1c 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.