re PR target/37216 ([cygming] Invalid alignment for SSE store to .comm data generated with -O3)
gcc/ChangeLog: 2009-05-28 Dave Korn <dave.korn.cygwin@gmail.com> PR target/37216 * configure.ac (HAVE_GAS_ALIGNED_COMM): Add autoconf test and macro definition for support of three-operand format aligned .comm directive in assembler on cygwin/pe/mingw target OS. * configure: Regenerate. * config.in: Regenerate. * config/i386/winnt.c (i386_pe_asm_output_aligned_decl_common): Use aligned form of .comm directive if -mpe-aligned-commons is in effect. * config/i386/cygming.opt (-mpe-aligned-commons): Add new option. * doc/invoke.texi (-mpe-aligned-commons): Document new target option. * doc/tm.texi (ASM_OUTPUT_COMMON): Document zero size commons. gcc/testsuite/ChangeLog: 2009-05-28 Dave Korn <dave.korn.cygwin@gmail.com> Uros Bizjak <ubizjak@gmail.com> Danny Smith <dansmister@gmail.com> PR target/37216 * lib/target-supports.exp (check_effective_target_pe_aligned_commons): New function. * gcc.target/i386/pr37216.c: New test source file. * gcc.dg/compat/struct-layout-1_generate.c (dg_options[]): No longer use -fno-common for testing Cygwin and MinGW targets. Co-Authored-By: Danny Smith <dansmister@gmail.com> Co-Authored-By: Uros Bizjak <ubizjak@gmail.com> From-SVN: r147950
This commit is contained in:
parent
b10ca52232
commit
233215fe7c
12 changed files with 146 additions and 7 deletions
|
@ -1,3 +1,20 @@
|
|||
2009-05-28 Dave Korn <dave.korn.cygwin@gmail.com>
|
||||
|
||||
PR target/37216
|
||||
|
||||
* configure.ac (HAVE_GAS_ALIGNED_COMM): Add autoconf test and
|
||||
macro definition for support of three-operand format aligned
|
||||
.comm directive in assembler on cygwin/pe/mingw target OS.
|
||||
* configure: Regenerate.
|
||||
* config.h: Regenerate.
|
||||
|
||||
* config/i386/winnt.c (i386_pe_asm_output_aligned_decl_common): Use
|
||||
aligned form of .comm directive if -mpe-aligned-commons is in effect.
|
||||
* config/i386/cygming.opt (-mpe-aligned-commons): Add new option.
|
||||
|
||||
* doc/invoke.texi (-mpe-aligned-commons): Document new target option.
|
||||
* doc/tm.texi (ASM_OUTPUT_COMMON): Document zero size commons.
|
||||
|
||||
2009-05-28 Ira Rosen <irar@il.ibm.com>
|
||||
|
||||
PR tree-optimization/40254
|
||||
|
|
|
@ -844,6 +844,13 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Define if your assembler supports specifying the alignment of objects
|
||||
allocated using the GAS .comm command. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_GAS_ALIGNED_COMM
|
||||
#endif
|
||||
|
||||
|
||||
/* Define if your assembler supports .balign and .p2align. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_GAS_BALIGN_AND_P2ALIGN
|
||||
|
|
|
@ -45,3 +45,7 @@ Set Windows defines
|
|||
mwindows
|
||||
Target
|
||||
Create GUI application
|
||||
|
||||
mpe-aligned-commons
|
||||
Target Var(use_pe_aligned_common) Init(HAVE_GAS_ALIGNED_COMM)
|
||||
Use the GNU extension to the PE format for aligned common data
|
||||
|
|
|
@ -499,8 +499,11 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
|
|||
{
|
||||
HOST_WIDE_INT rounded;
|
||||
|
||||
/* Compute as in assemble_noswitch_variable, since we don't actually
|
||||
support aligned common. */
|
||||
/* Compute as in assemble_noswitch_variable, since we don't have
|
||||
support for aligned common on older binutils. We must also
|
||||
avoid emitting a common symbol of size zero, as this is the
|
||||
overloaded representation that indicates an undefined external
|
||||
symbol in the PE object file format. */
|
||||
rounded = size ? size : 1;
|
||||
rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;
|
||||
rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
|
||||
|
@ -510,9 +513,13 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
|
|||
|
||||
fprintf (stream, "\t.comm\t");
|
||||
assemble_name (stream, name);
|
||||
fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC "\t" ASM_COMMENT_START
|
||||
" " HOST_WIDE_INT_PRINT_DEC "\n",
|
||||
rounded, size);
|
||||
if (use_pe_aligned_common)
|
||||
fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC ", %d\n",
|
||||
size ? size : (HOST_WIDE_INT) 1,
|
||||
exact_log2 (align) - exact_log2 (CHAR_BIT));
|
||||
else
|
||||
fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC "\t" ASM_COMMENT_START
|
||||
" " HOST_WIDE_INT_PRINT_DEC "\n", rounded, size);
|
||||
}
|
||||
|
||||
/* The Microsoft linker requires that every function be marked as
|
||||
|
|
38
gcc/configure
vendored
38
gcc/configure
vendored
|
@ -22631,6 +22631,44 @@ fi
|
|||
i[34567]86-*-* | x86_64-*-*)
|
||||
case $target_os in
|
||||
cygwin* | pe | mingw32*)
|
||||
# Recent binutils allows the three-operand form of ".comm" on PE. This
|
||||
# definition is used unconditionally to initialise the default state of
|
||||
# the target option variable that governs usage of the feature.
|
||||
echo "$as_me:$LINENO: checking assembler for .comm with alignment" >&5
|
||||
echo $ECHO_N "checking assembler for .comm with alignment... $ECHO_C" >&6
|
||||
if test "${gcc_cv_as_comm_has_align+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
gcc_cv_as_comm_has_align=no
|
||||
if test $in_tree_gas = yes; then
|
||||
if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 52`
|
||||
then gcc_cv_as_comm_has_align=yes
|
||||
fi
|
||||
elif test x$gcc_cv_as != x; then
|
||||
echo '.comm foo,1,32' > conftest.s
|
||||
if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }
|
||||
then
|
||||
gcc_cv_as_comm_has_align=yes
|
||||
else
|
||||
echo "configure: failed program was" >&5
|
||||
cat conftest.s >&5
|
||||
fi
|
||||
rm -f conftest.o conftest.s
|
||||
fi
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $gcc_cv_as_comm_has_align" >&5
|
||||
echo "${ECHO_T}$gcc_cv_as_comm_has_align" >&6
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_GAS_ALIGNED_COMM `if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`
|
||||
_ACEOF
|
||||
|
||||
# Used for DWARF 2 in PE
|
||||
echo "$as_me:$LINENO: checking assembler for .secrel32 relocs" >&5
|
||||
echo $ECHO_N "checking assembler for .secrel32 relocs... $ECHO_C" >&6
|
||||
|
|
|
@ -2954,6 +2954,15 @@ changequote(,)dnl
|
|||
changequote([,])dnl
|
||||
case $target_os in
|
||||
cygwin* | pe | mingw32*)
|
||||
# Recent binutils allows the three-operand form of ".comm" on PE. This
|
||||
# definition is used unconditionally to initialise the default state of
|
||||
# the target option variable that governs usage of the feature.
|
||||
gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,
|
||||
[2,19,52],,[.comm foo,1,32])
|
||||
AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
|
||||
[`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
|
||||
[Define if your assembler supports specifying the alignment
|
||||
of objects allocated using the GAS .comm command.])
|
||||
# Used for DWARF 2 in PE
|
||||
gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
|
||||
gcc_cv_as_ix86_pe_secrel32,
|
||||
|
|
|
@ -15678,6 +15678,15 @@ This option is available for Cygwin and MinGW targets. It
|
|||
specifies that a GUI application is to be generated by
|
||||
instructing the linker to set the PE header subsystem type
|
||||
appropriately.
|
||||
|
||||
@item -mpe-aligned-commons
|
||||
@opindex mpe-aligned-commons
|
||||
This option is available for Cygwin and MinGW targets. It
|
||||
specifies that the GNU extension to the PE file format that
|
||||
permits the correct alignment of COMMON variables should be
|
||||
used when generating code. It will be enabled by default if
|
||||
GCC detects that the target assembler found during configuration
|
||||
supports the feature.
|
||||
@end table
|
||||
|
||||
See also under @ref{i386 and x86-64 Options} for standard options.
|
||||
|
|
|
@ -7384,7 +7384,14 @@ outputting a single uninitialized variable.
|
|||
A C statement (sans semicolon) to output to the stdio stream
|
||||
@var{stream} the assembler definition of a common-label named
|
||||
@var{name} whose size is @var{size} bytes. The variable @var{rounded}
|
||||
is the size rounded up to whatever alignment the caller wants.
|
||||
is the size rounded up to whatever alignment the caller wants. It is
|
||||
possible that @var{size} may be zero, for instance if a struct with no
|
||||
other member than a zero-length array is defined. In this case, the
|
||||
backend must output a symbol definition that allocates at least one
|
||||
byte, both so that the address of the resulting object does not compare
|
||||
equal to any other, and because some object formats cannot even express
|
||||
the concept of a zero-sized common symbol, as that is how they represent
|
||||
an ordinary undefined external.
|
||||
|
||||
Use the expression @code{assemble_name (@var{stream}, @var{name})} to
|
||||
output the name itself; before and after that, output the additional
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
2009-05-28 Dave Korn <dave.korn.cygwin@gmail.com>
|
||||
Uros Bizjak <ubizjak@gmail.com>
|
||||
Danny Smith <dansmister@gmail.com>
|
||||
|
||||
PR target/37216
|
||||
|
||||
* lib/target-supports.exp (check_effective_target_pe_aligned_commons):
|
||||
New function.
|
||||
* gcc.target/i386/pr37216.c: New test source file.
|
||||
* gcc.dg/compat/struct-layout-1_generate.c (dg_options[]): No longer
|
||||
use -fno-common for testing Cygwin and MinGW targets.
|
||||
|
||||
2009-05-28 Kai Tietz <kai.tietz@onevision.com>
|
||||
|
||||
* g++.dg/ext/packed6.C (size_t): Use __extension__ and
|
||||
|
|
|
@ -46,7 +46,7 @@ const char *dg_options[] = {
|
|||
"/* { dg-options \"%s-I%s\" } */\n",
|
||||
"/* { dg-options \"%s-I%s -Wno-abi\" } */\n",
|
||||
"/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-* x86_64-*-* } } */\n",
|
||||
"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n",
|
||||
"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* } } */\n",
|
||||
"/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target i?86-*-darwin* x86_64-*-darwin* } } */\n",
|
||||
"/* { dg-options \"%s-I%s -mno-base-addresses\" { target mmix-*-* } } */\n",
|
||||
"/* { dg-options \"%s-I%s -mlongcalls -mtext-section-literals\" { target xtensa*-*-* } } */\n"
|
||||
|
|
17
gcc/testsuite/gcc.target/i386/pr37216.c
Normal file
17
gcc/testsuite/gcc.target/i386/pr37216.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* { dg-do run } */
|
||||
/* { dg-options "-O3 -msse2" } */
|
||||
/* { dg-options "-O3 -msse2 -mpe-aligned-commons" { target pe_aligned_commons } } */
|
||||
|
||||
#include "sse2-check.h"
|
||||
|
||||
int iarr[64];
|
||||
int iint = 0;
|
||||
|
||||
void
|
||||
sse2_test (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
iarr[i] = -2;
|
||||
}
|
|
@ -611,6 +611,18 @@ proc check_effective_target_pthread {} {
|
|||
} "-pthread"]
|
||||
}
|
||||
|
||||
# Return 1 if compilation with -mpe-aligned-commons is error-free
|
||||
# for trivial code, 0 otherwise.
|
||||
|
||||
proc check_effective_target_pe_aligned_commons {} {
|
||||
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
|
||||
return [check_no_compiler_messages pe_aligned_commons object {
|
||||
int foo;
|
||||
} "-mpe-aligned-commons"]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Return 1 if the target supports -fstack-protector
|
||||
proc check_effective_target_fstack_protector {} {
|
||||
return [check_runtime fstack_protector {
|
||||
|
|
Loading…
Add table
Reference in a new issue