diff options
author | doko <doko@6ca36cf4-e1d1-0310-8c6f-e303bb2178ca> | 2014-07-17 13:35:08 +0000 |
---|---|---|
committer | doko <doko@6ca36cf4-e1d1-0310-8c6f-e303bb2178ca> | 2014-07-17 13:35:08 +0000 |
commit | a07820ba7c3742c9b144d881d4d7fd0244156871 (patch) | |
tree | 4395e3aefde6709c70be25101f84f06f8f95d7c0 | |
parent | ceff7e8039bf99fbc3b207f03a932a8944786f45 (diff) | |
download | gcc-49-a07820ba7c3742c9b144d881d4d7fd0244156871.tar.gz |
* Warn about ppc ELFv2 ABI issues, which will change in GCC 4.10.
git-svn-id: svn://svn.debian.org/svn/gcccvs/branches/sid/gcc-4.9@7512 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/patches/gcc-elfv2-abi-warn1.diff | 99 | ||||
-rw-r--r-- | debian/patches/gcc-elfv2-abi-warn2.diff | 106 | ||||
-rw-r--r-- | debian/patches/gcc-elfv2-abi-warn3.diff | 158 | ||||
-rw-r--r-- | debian/patches/gcc-elfv2-abi-warn4.diff | 56 | ||||
-rw-r--r-- | debian/rules.patch | 4 |
6 files changed, 424 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 7bff580..a583e33 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ gcc-4.9 (4.9.1-2) UNRELEASED; urgency=medium * Fix installing test logs and summaries. + * Warn about ppc ELFv2 ABI issues, which will change in GCC 4.10. -- Matthias Klose <doko@debian.org> Thu, 17 Jul 2014 14:56:55 +0200 diff --git a/debian/patches/gcc-elfv2-abi-warn1.diff b/debian/patches/gcc-elfv2-abi-warn1.diff new file mode 100644 index 0000000..437ba17 --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn1.diff @@ -0,0 +1,99 @@ +# DP: ppc64el, fix ELFv2 homogeneous float aggregate ABI bug + +Subject: [PATCH, rs6000, 4.8/4.9] Fix ELFv2 homogeneous float aggregate ABI bug + +Hello, + +this is the variant intended for the 4.8/4.9 branches of the patch: +https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00994.html + +As discussed, it does *not* actually change ABI, but only warn when +encountering a situation where the ABI will change in a future GCC. +(Avoiding the specific term "GCC 4.10" here since I'm not certain +whether the next GCC release will in fact be called that ...) + +Tested on powerpc64-linux and powerpc64le-linux; also verified using +the ABI compat suite (against an unpatched GCC) that this patch does +not change the ABI. + +OK for 4.8/4.9 once the mainline patch is in? + +Bye, +Ulrich + + +gcc/ChangeLog: + + * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument + does not fit fully into floating-point registers, and there is still + space in the register parameter area, issue -Wpsabi note that the ABI + will change in a future GCC release. + +gcc/testsuite/ChangeLog: + + * gcc.target/powerpc/ppc64-abi-warn-1.c: New test. + + +--- a/src/gcc/config/rs6000/rs6000.c ++++ b/src/gcc/config/rs6000/rs6000.c +@@ -10225,6 +10225,7 @@ rs6000_function_arg (cumulative_args_t c + rtx r, off; + int i, k = 0; + unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; ++ int fpr_words; + + /* Do we also need to pass this argument in the parameter + save area? */ +@@ -10253,6 +10254,37 @@ rs6000_function_arg (cumulative_args_t c + rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); + } + ++ /* If there were not enough FPRs to hold the argument, the rest ++ usually goes into memory. However, if the current position ++ is still within the register parameter area, a portion may ++ actually have to go into GPRs. ++ ++ Note that it may happen that the portion of the argument ++ passed in the first "half" of the first GPR was already ++ passed in the last FPR as well. ++ ++ For unnamed arguments, we already set up GPRs to cover the ++ whole argument in rs6000_psave_function_arg, so there is ++ nothing further to do at this point. ++ ++ GCC 4.8/4.9 Note: This was implemented incorrectly in earlier ++ GCC releases. To avoid any ABI change on the release branch, ++ we retain that original implementation here, but warn if we ++ encounter a case where the ABI will change in the future. */ ++ fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8); ++ if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG ++ && cum->nargs_prototype > 0) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the ABI of passing homogeneous float aggregates" ++ " will change in a future GCC release"); ++ } ++ } ++ + return rs6000_finish_function_arg (mode, rvec, k); + } + else if (align_words < GP_ARG_NUM_REG) +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c +@@ -0,0 +1,12 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-options "-mabi=elfv2" } */ ++ ++struct f8 ++ { ++ float x[8]; ++ }; ++ ++void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */ ++{ ++} ++ diff --git a/debian/patches/gcc-elfv2-abi-warn2.diff b/debian/patches/gcc-elfv2-abi-warn2.diff new file mode 100644 index 0000000..5309998 --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn2.diff @@ -0,0 +1,106 @@ +# DP: ppc64el, fix aggregate alignment ABI issue + +this is the variant intended for the 4.8/4.9 branches of the patch: +https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00995.html + +As discussed, it does *not* actually change ABI, but only warn when +encountering a situation where the ABI will change in a future GCC. +(Avoiding the specific term "GCC 4.10" here since I'm not certain +whether the next GCC release will in fact be called that ...) + +Tested on powerpc64-linux and powerpc64le-linux; also verified using +the ABI compat suite (against an unpatched GCC) that this patch does +not change the ABI. + +OK for 4.8/4.9 once the mainline patch is in? + +Bye, +Ulrich + + +gcc/ChangeLog: + + * config/rs6000/rs6000.c (rs6000_function_arg_boundary): Issue + -Wpsabi note when encountering a type where future GCC releases + will apply different alignment requirements. + +gcc/testsuite/ChangeLog: + + * gcc.target/powerpc/ppc64-abi-warn-2.c: New test. + + +--- a/src/gcc/config/rs6000/rs6000.c ++++ b/src/gcc/config/rs6000/rs6000.c +@@ -9180,14 +9180,51 @@ rs6000_function_arg_boundary (enum machi + || (type && TREE_CODE (type) == VECTOR_TYPE + && int_size_in_bytes (type) >= 16)) + return 128; +- else if (((TARGET_MACHO && rs6000_darwin64_abi) +- || DEFAULT_ABI == ABI_ELFv2 +- || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) +- && mode == BLKmode +- && type && TYPE_ALIGN (type) > 64) ++ ++ /* Aggregate types that need > 8 byte alignment are quadword-aligned ++ in the parameter area in the ELFv2 ABI, and in the AIX ABI unless ++ -mcompat-align-parm is used. */ ++ if (((DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm) ++ || DEFAULT_ABI == ABI_ELFv2) ++ && type && TYPE_ALIGN (type) > 64) ++ { ++ /* "Aggregate" means any AGGREGATE_TYPE except for single-element ++ or homogeneous float/vector aggregates here. We already handled ++ vector aggregates above, but still need to check for float here. */ ++ bool aggregate_p = (AGGREGATE_TYPE_P (type) ++ && !SCALAR_FLOAT_MODE_P (elt_mode)); ++ ++ /* We used to check for BLKmode instead of the above aggregate type ++ check. Warn when this results in any difference to the ABI. */ ++ if (aggregate_p != (mode == BLKmode)) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the ABI of passing aggregates with %d-byte alignment" ++ " will change in a future GCC release", ++ (int) TYPE_ALIGN (type) / BITS_PER_UNIT); ++ } ++ } ++ ++ /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we ++ keep using the BLKmode check, but warn if there will be differences ++ in future GCC releases. */ ++ if (mode == BLKmode) ++ return 128; ++ } ++ ++ /* Similar for the Darwin64 ABI. Note that for historical reasons we ++ implement the "aggregate type" check as a BLKmode check here; this ++ means certain aggregate types are in fact not aligned. */ ++ if (TARGET_MACHO && rs6000_darwin64_abi ++ && mode == BLKmode ++ && type && TYPE_ALIGN (type) > 64) + return 128; +- else +- return PARM_BOUNDARY; ++ ++ return PARM_BOUNDARY; + } + + /* The offset in words to the start of the parameter save area. */ +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c +@@ -0,0 +1,11 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++ ++struct test ++ { ++ long a __attribute__((aligned (16))); ++ }; ++ ++void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment will change" } */ ++{ ++} ++ diff --git a/debian/patches/gcc-elfv2-abi-warn3.diff b/debian/patches/gcc-elfv2-abi-warn3.diff new file mode 100644 index 0000000..637d8d7 --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn3.diff @@ -0,0 +1,158 @@ +# DP: ppc64*, fix alignment of non-Altivec vector struct fields + +this is the variant intended for the 4.8/4.9 branches of the patch: +https://gcc.gnu.org/ml/gcc-patches/2014-07/msg01072.html + +As discussed, it does *not* actually change ABI, but only warn when +encountering a situation where the ABI will change in a future GCC. +(Avoiding the specific term "GCC 4.10" here since I'm not certain +whether the next GCC release will in fact be called that ...) + +Tested on powerpc64-linux and powerpc64le-linux; also verified using +the ABI compat suite (against an unpatched GCC) that this patch does +not change the ABI. + +OK for 4.8/4.9 once the mainline patch is in? + +Bye, +Ulrich + + +gcc/ChangeLog: + + * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): + Add prototype. + * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New + function. Issue -Wpsabi warning if future GCC releases will use + different field alignment rules for this type. + * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it. + * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. + * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise. + +gcc/testsuite/ChangeLog: + + * gcc.target/powerpc/ppc64-abi-warn-3.c: New test. + + * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi. + * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi. + * gcc.c-torture/execute/20050316-3.x: New file. Add -Wno-psabi. + * gcc.c-torture/execute/pr23135.x: Likewise. + +--- a/src/gcc/config/rs6000/rs6000-protos.h ++++ b/src/gcc/config/rs6000/rs6000-protos.h +@@ -155,6 +155,7 @@ extern void rs6000_split_logical (rtx [] + + #ifdef TREE_CODE + extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); ++extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); + extern unsigned int rs6000_special_round_type_align (tree, unsigned int, + unsigned int); + extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int, +--- a/src/gcc/config/rs6000/rs6000.c ++++ b/src/gcc/config/rs6000/rs6000.c +@@ -5871,6 +5871,34 @@ rs6000_data_alignment (tree type, unsign + return align; + } + ++/* Previous GCC releases forced all vector types to have 16-byte alignment. */ ++ ++bool ++rs6000_special_adjust_field_align_p (tree field, unsigned int computed) ++{ ++ if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE) ++ { ++ if (computed != 128) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the layout of aggregates containing vectors with" ++ " %d-byte alignment will change in a future GCC release", ++ computed / BITS_PER_UNIT); ++ } ++ } ++ /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we ++ keep the special treatment of vector types, but warn if there will ++ be differences in future GCC releases. */ ++ return true; ++ } ++ ++ return false; ++} ++ + /* AIX increases natural record alignment to doubleword if the first + field is an FP double while the FP fields remain word aligned. */ + +--- a/src/gcc/config/rs6000/sysv4.h ++++ b/src/gcc/config/rs6000/sysv4.h +@@ -292,7 +292,7 @@ do { \ + /* An expression for the alignment of a structure field FIELD if the + alignment computed in the usual way is COMPUTED. */ + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 : COMPUTED) + + #undef BIGGEST_FIELD_ALIGNMENT +--- a/src/gcc/config/rs6000/linux64.h ++++ b/src/gcc/config/rs6000/linux64.h +@@ -246,7 +246,7 @@ extern int dot_symbols; + /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ + #undef ADJUST_FIELD_ALIGN + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ +--- a/src/gcc/config/rs6000/freebsd64.h ++++ b/src/gcc/config/rs6000/freebsd64.h +@@ -367,7 +367,7 @@ extern int dot_symbols; + /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ + #undef ADJUST_FIELD_ALIGN + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ +--- a/src/gcc/testsuite/gcc.c-torture/execute/20050316-1.x ++++ b/src/gcc/testsuite/gcc.c-torture/execute/20050316-1.x +@@ -4,4 +4,5 @@ if { [check_effective_target_int16] } { + return 1 + } + ++set additional_flags "-Wno-psabi" + return 0; +--- /dev/null ++++ b/src/gcc/testsuite/gcc.c-torture/execute/20050316-3.x +@@ -0,0 +1,2 @@ ++set additional_flags "-Wno-psabi" ++return 0 +--- a/src/gcc/testsuite/gcc.c-torture/execute/20050604-1.x ++++ b/src/gcc/testsuite/gcc.c-torture/execute/20050604-1.x +@@ -6,4 +6,5 @@ if { [istarget "i?86-*-*"] || [istarget + set additional_flags "-mno-mmx" + } + ++set additional_flags "-Wno-psabi" + return 0 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.c-torture/execute/pr23135.x +@@ -0,0 +1,2 @@ ++set additional_flags "-Wno-psabi" ++return 0 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c +@@ -0,0 +1,9 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-require-effective-target powerpc_altivec_ok } */ ++/* { dg-options "-maltivec" } */ ++ ++struct test ++ { ++ int a __attribute__((vector_size (8))); ++ }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment will change" } */ ++ diff --git a/debian/patches/gcc-elfv2-abi-warn4.diff b/debian/patches/gcc-elfv2-abi-warn4.diff new file mode 100644 index 0000000..5b11ece --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn4.diff @@ -0,0 +1,56 @@ +# DP: Reliably prune GCC notes in C++ compat suite + +in testing the rs6000 ABI patches I noted a weird effect: usually, the +-Wpsabi warning notes are ignored in the compat test suites, so we get +a clean test run anyway. + +However, when running the C++ version of the struct-layout-1.exp case +*alone* (using RUNTESTFLAGS=struct-layout-1.exp), suddenly tests are +failing because of those extra notes. This does *not* happen with +the C version of that suite ... + +It turns out that that pruning those notes is supposed to happen +from within gcc-defs.exp:${tool}_check_compile: + if { [info proc ${tool}-dg-prune] != "" } { + global target_triplet + set gcc_output [${tool}-dg-prune $target_triplet $gcc_output] + } + +However, the g++-dg-prune routine is defined in g++-dg.exp, which +is never included from g++.dg/compat/struct-layout-1.exp (directly +or indirectly). Now, when running the full suite, that file would +have been loaded by some earlier g++.dg .exp file, so everything +works out. But when running struct-layout-1.exp stand-alone, the +g++-dg-prune routine is never defined and thus silently no pruning +takes place. + +To fix this, the following patch simply loads g++-dg.exp directly +from g++.dg/compat/struct-layout-1.exp. + +Tested on powerpc64-linux and powerpc64le-linux. + +OK for mainline (and 4.8/4.9 once the rs6000 ABI patches are +backported there)? + +Bye, +Ulrich + + +gcc/testsuite/ChangeLog: + + * g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp + + +--- a/src/gcc/testsuite/g++.dg/compat/struct-layout-1.exp ++++ b/src/gcc/testsuite/g++.dg/compat/struct-layout-1.exp +@@ -89,6 +89,9 @@ proc compat-use-tst-compiler { } { + # This must be done after the compat-use-*-compiler definitions. + load_lib compat.exp + ++# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp) ++load_lib g++-dg.exp ++ + g++_init + + # Save variables for the C++ compiler under test, which each test will + diff --git a/debian/rules.patch b/debian/rules.patch index 99f4d8a..8630d06 100644 --- a/debian/rules.patch +++ b/debian/rules.patch @@ -83,6 +83,10 @@ debian_patches += \ pr61126 \ gcc-setmultilib-fix \ sparc64-biarch-long-double-128 \ + gcc-elfv2-abi-warn1 \ + gcc-elfv2-abi-warn2 \ + gcc-elfv2-abi-warn3 \ + gcc-elfv2-abi-warn4 \ # FIXME: only needed for isl-0.13 for now # isl-0.13-compat \ |