Re: linux-2.4.0-test9

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Fri Oct 06 2000 - 06:15:51 EST


Keith Owens wrote:
> >Put __attribute__ ((section (".data"))) into __tcp_clean_cacheline_pad
> >and it should do what you want.
> >
> >Heck, section ".bss" might give you the alignment without the allocation
> >but I'm not as confident about that.
>
> Call me mad but you could actually try this instead of guessing.

I just tried it with "gcc 2.96" (RedHat 7's edition) and that _does_
work. Good old egcs 1.1.2 gives the broken behaviour you describe.

int __attribute__ ((section (".data.init"))) x1;
int __attribute__ ((aligned (32), section (".data.init"))) x2;
int __attribute__ ((section (".data.init"))) x3 = 0;

$ gcc --version
2.96
$ as --version
GNU assembler 2.10.90
...
$ gcc -c test.c
$ objdump -h test.o
...
Idx Name Size VMA LMA File off Algn
  0 .text 00000000 00000000 00000000 00000034 2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data 00000000 00000000 00000000 00000034 2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss 00000000 00000000 00000000 00000034 2**2
                  ALLOC
  3 .note 00000014 00000000 00000000 00000034 2**0
                  CONTENTS, READONLY
  4 .data.init 00000024 00000000 00000000 00000060 2**5
                  CONTENTS, ALLOC, LOAD, DATA
  5 .comment 00000029 00000000 00000000 00000084 2**0
                  CONTENTS, READONLY

Another one with .bss section gives a warning, but also works, even
preserving alignment in the .bss section:

int __attribute__ ((section (".bss"))) x1;
int __attribute__ ((aligned (32), section (".bss"))) x2;
int __attribute__ ((section (".bss"))) x3;

$ gcc test.c
/tmp/cc6KLZDY.s: Assembler messages:
/tmp/cc6KLZDY.s:5: Warning: Ignoring incorrect section type for .bss
$ objdump -h test.o
...
Idx Name Size VMA LMA File off Algn
  0 .text 00000000 00000000 00000000 00000034 2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data 00000000 00000000 00000000 00000034 2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss 00000028 00000000 00000000 00000040 2**5
                  ALLOC
  3 .note 00000014 00000000 00000000 00000040 2**0
                  CONTENTS, READONLY
  4 .comment 00000029 00000000 00000000 00000054 2**0
                  CONTENTS, READONLY

$ nm test.o
00000000 t gcc2_compiled.
00000000 B x1
00000020 B x2
00000024 B x3

enjoy,
-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:19 EST