Misaligned .bss section for PE?
Zuxy Meng
zuxy.meng@gmail.com
Thu May 29 10:11:00 GMT 2008
"Danny Smith" <dansmister@gmail.com> ôÃëÃûâÃÃÃÃ
:9c03c2dd0805290259p77e2675dyd1a158515fca75f4@mail.gmail.com...
> On Thu, May 29, 2008 at 7:14 PM, Zuxy Meng
>> "Zuxy Meng" <zuxy.meng@gmail.com> ôÃëÃûâÃÃÃÃ
:g15ap1$2he$1@ger.gmane.org...
>>>
>>> "Zuxy Meng" <zuxy.meng@gmail.com> ôÃëÃûâÃÃÃÃ
:g13f6l$t70$1@ger.gmane.org...
>>>>
>>>> Hi there,
>>>>
>>>> Recently I met a crash on MinGW32 caused by misaligned access of SSE
>>>> instructions. The root cause was that a static var wasn't aligned to a
>>>> 16-byte boundary. However, in gcc source this var had already been
>>>> marked
>>>> with "__attribute__((aligned(16)))".
>>>>
>>>> I then checked the output of "gcc -S" and it turned out that with PE
>>>> you
>>>> couldn't specify a symbol's alignment. Rather, the alignment was
>>>> ensured by
>>>> explicit padding. But gcc seemed to do it right, at least within a
>>>> compilation unit. Unfortunately, after hundreds of objects got linked
>>>> together, some symbols' alignment was broken.
>>>>
>>>> I'm just wondering if I should report it as a GCC bug or a binutils
>>>> one.
>>>> Any help? Thanks!
>>>
>>>
>>> I guess I've figured it out; the object compiled with an older version
>>> of
>>> "as" has an alignment of 2**4, while with the new "as" has 2**2. The
>>> source
>>> if simple (just one line of "float var[512]
>>> __attribute__((aligned(16)));"
>
> see
> http://sourceware.org/bugzilla/show_bug.cgi?id=5226, in particular the
> testcase in comment #1
>
> Note PE COFF does not support aligned common , so you may need to add
> __attribute__((no_common)) to variable.
>
Thanks Danny! I saw that the bug was committed last November and I wonder if
my problematic as (labeling itself as "GNU assembler (GNU Binutils)
2.18.50.20080109") has had the fix?
--
Zuxy
More information about the Binutils
mailing list