Date: Tue, 27 Apr 1999 20:41:32 +0100 From: cmatraki AT ee DOT ucl DOT ac DOT uk (Chris Matrakidis) Message-Id: <199904271941.UAA10783@melchard.ee.ucl.ac.uk> To: djgpp-workers AT delorie DOT com Subject: Re: [dma AT hpesdma DOT fc DOT hp DOT com: Performance Observation] X-Sun-Charset: US-ASCII Reply-To: djgpp-workers AT delorie DOT com > > The performance drop seems to be an alignment problem. > > Details, please. What are the differences, as far as alignment is > concerned, between 2.7.2 and 2.8.x? > There are no significant differences between the code generated by the two versions. The different can be seen in alignment of the global arrays in the .bss section of the executable. gcc 2.7.2: 0000be78 B _src_i 0000de78 B _co 0000fe78 B _rev 00010e78 B _si 00012e78 B _a_real 00014e78 B _a_imag 00016e78 B _src_r gcc 2.8.1: 0000d694 B _src_i 0000f694 B _co 00011694 B _rev 00012694 B _si 00014694 B _a_real 00016694 B _a_imag 00018694 B _src_r It just happens that a new global variable is defined in libgcc.a for version 2.8.1, which moves those arrays out of doubleword alignment, which seriously affects the performance. (doubles should be doubleword aligned for better performance). I thought that one way around the problem was to use -fno-common -malign-double which should put those arrays in the .data section properly aligned. However, no even that works in all cases: gcc 2.8.1: 0000b6d0 D _co 0000d6d0 D _si 0000f6d0 D _rev 000106d0 D _a_real 000126d0 D _a_imag 000146d0 D _src_r 000166d0 D _src_i gcc 2.7.2: 0000a4cc D _co 0000c4cc D _si 0000e4cc D _rev 0000f4cc D _a_real 000114cc D _a_imag 000134cc D _src_r 000154cc D _src_i Even though the object file has the arrays correctly aligned, ld has AFAIK no way to identify what the required alignment is. I can't think of any easy way to overcome this.