mark expected failures for ppc64 (issue6932046)

2012-12-10 Thread Jing Yu
Add powerpc64-grtev3-linux-gnu.xfail to mark expected failures for
powerpc64 toolchain. For google/gcc_4-7 branch.

Tested:
  ./buildit --build_type=symlinks  --keep_work_dir --run_tests 
gcc-4.7.x-grtev3-powerpc64


2012-12-10  Jing Yu  
* contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail: New


Index: contrib/ChangeLog.google-4_7
===
--- contrib/ChangeLog.google-4_7(revision 194383)
+++ contrib/ChangeLog.google-4_7(working copy)
@@ -1,3 +1,8 @@
+2012-12-10  Jing Yu  
+
+   * contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail:
+   New.
+
 2012-11-05  Paul Pluzhnikov  
 
* contrib/testsuite-management/powerpc-grtev3-linux-gnu.xfail:
Index: contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail
===
--- contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail   
(revision 0)
+++ contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail   
(revision 0)
@@ -0,0 +1,149 @@
+# Marked test failures for v16-powerpc64 toolchain built from
+# v16 release branch @64346, and v16 dev branch @64533.
+# *** gcc:
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -O0 
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -O1 
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -O2 
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -O3 -fomit-frame-pointer 
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -O3 -g 
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -Os 
+FAIL: gcc.c-torture/execute/20020226-1.c execution,  -O2 -flto 
-fno-use-linker-plugin -flto-partition=none 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -O0 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -O1 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -O2 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -O3 -fomit-frame-pointer 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -O3 -g 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -Os 
+FAIL: gcc.c-torture/execute/20020508-1.c execution,  -O2 -flto 
-fno-use-linker-plugin -flto-partition=none 
+FAIL: gcc.dg/and-1.c scan-assembler-not nand
+FAIL: gcc.dg/cleanup-10.c execution test
+FAIL: gcc.dg/cleanup-11.c execution test
+FAIL: gcc.dg/cleanup-8.c execution test
+FAIL: gcc.dg/cleanup-9.c execution test
+FAIL: gcc.dg/pr44194-1.c scan-rtl-dump dse1 "global deletions = (2|3)"
+FAIL: gcc.dg/pr44194-1.c scan-rtl-dump-not final "set \\(mem"
+FAIL: gcc.dg/pr46728-6.c scan-assembler-not pow
+
+# These tests succeeded in v15-powerpc64. But they failed in v16-x86 too.
+FAIL: gcc.dg/thread_annot_lock-23.c  (test for warnings, line 10)
+FAIL: gcc.dg/thread_annot_lock-23.c  (test for warnings, line 13)
+FAIL: gcc.dg/thread_annot_lock-23.c  (test for warnings, line 15)
+FAIL: gcc.dg/thread_annot_lock-23.c  (test for warnings, line 18)
+FAIL: gcc.dg/thread_annot_lock-23.c  (test for warnings, line 19)
+FAIL: gcc.dg/thread_annot_lock-24.c  (test for warnings, line 8)
+FAIL: gcc.dg/thread_annot_lock-24.c  (test for warnings, line 9)
+FAIL: gcc.dg/thread_annot_lock-24.c  (test for warnings, line 10)
+FAIL: gcc.dg/thread_annot_lock-25.c  (test for warnings, line 8)
+FAIL: gcc.dg/thread_annot_lock-25.c  (test for warnings, line 9)
+FAIL: gcc.dg/thread_annot_lock-25.c  (test for warnings, line 10)
+FAIL: gcc.dg/thread_annot_lock-25.c  (test for warnings, line 22)
+FAIL: gcc.dg/thread_annot_lock-25.c  (test for warnings, line 30)
+FAIL: gcc.dg/thread_annot_lock-42.c  (test for warnings, line 9)
+
+FAIL: gcc.dg/torture/pr53589.c  -O3 -g  (internal compiler error)
+FAIL: gcc.dg/torture/pr53589.c  -O3 -g  (test for excess errors)
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O0  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O0  -fpic  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O0  -fPIC  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O0  -pie -fpie  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O0  -pie -fPIE  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O1  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O1  -fpic  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O1  -fPIC  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O1  -pie -fpie  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O1  -pie -fPIE  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O2  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O2 -flto -fuse-linker-plugin 
-fno-fat-lto-objects  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O2  -fpic  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O2  -fPIC  execution test
+flaky | FAIL: gcc.dg/torture/tls/tls-test.c  -O2  -

[google/gcc-4_7]Add new validator file for native ppc toolchain

2013-06-05 Thread Jing Yu
Add new validator manifest xfail file for native powerpc64 toolchain.
Ok for google/gcc-4_7?

Tested:
./validate_failures.py
--manifest=powerpc64-grtev3-linux-gnu-native.xfail --
results="gcc/gcc.sum g++/g++.sum gfortran/gfortran.sum"

2013-06-05

 * powerpc64-grtev3-linux-gnu-native.xfail: New.


patch.diff
Description: Binary data


[PATCH]Add aarch64 to list of targets that support gold

2014-09-18 Thread Jing Yu
Hi,

This patch changes top level configure to add aarch64 to list of
targets that support gold. Have tested binutils with this patch on
x86_64 and aarch64 platforms.
OK for trunk?


2014-09-18  Jing Yu  
  * configure.ac: Add aarch64 to list of targets that support gold.
  * configure: Regenerate.

Thanks,
Jing


Index: configure
===
--- configure (revision 215344)
+++ configure (working copy)
@@ -2940,7 +2940,8 @@
 if test "$is_elf" = "yes"; then
   # Check for target supported by gold.
   case "${target}" in
-i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*
| tilegx*-*-*)
+i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
+| aarch64*-*-* | tilegx*-*-*)
configdirs="$configdirs gold"
if test x${ENABLE_GOLD} = xdefault; then
  default_ld=gold
Index: configure.ac
===
--- configure.ac (revision 215344)
+++ configure.ac (working copy)
@@ -331,7 +331,8 @@
 if test "$is_elf" = "yes"; then
   # Check for target supported by gold.
   case "${target}" in
-i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*
| tilegx*-*-*)
+i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
+| aarch64*-*-* | tilegx*-*-*)
configdirs="$configdirs gold"
if test x${ENABLE_GOLD} = xdefault; then
  default_ld=gold


Re: [PATCH]Add aarch64 to list of targets that support gold

2014-09-23 Thread Jing Yu
Hi Config-maintainers,

Is this patch ok for trunk?

Thanks!
Jing

On Thu, Sep 18, 2014 at 4:05 PM, Jing Yu  wrote:
> Hi,
>
> This patch changes top level configure to add aarch64 to list of
> targets that support gold. Have tested binutils with this patch on
> x86_64 and aarch64 platforms.
> OK for trunk?
>
>
> 2014-09-18  Jing Yu  
>   * configure.ac: Add aarch64 to list of targets that support gold.
>   * configure: Regenerate.
>
> Thanks,
> Jing
>
>
> Index: configure
> ===
> --- configure (revision 215344)
> +++ configure (working copy)
> @@ -2940,7 +2940,8 @@
>  if test "$is_elf" = "yes"; then
># Check for target supported by gold.
>case "${target}" in
> -i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*
> | tilegx*-*-*)
> +i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
> +| aarch64*-*-* | tilegx*-*-*)
> configdirs="$configdirs gold"
> if test x${ENABLE_GOLD} = xdefault; then
>   default_ld=gold
> Index: configure.ac
> ===
> --- configure.ac (revision 215344)
> +++ configure.ac (working copy)
> @@ -331,7 +331,8 @@
>  if test "$is_elf" = "yes"; then
># Check for target supported by gold.
>case "${target}" in
> -i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*
> | tilegx*-*-*)
> +i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
> +| aarch64*-*-* | tilegx*-*-*)
> configdirs="$configdirs gold"
> if test x${ENABLE_GOLD} = xdefault; then
>   default_ld=gold


[trunk][google/gcc47]Add dependence of configure-target-libmudflap on configure-target-libstdc++-v3 (issue7740043)

2013-03-11 Thread Jing Yu


binWsrE0LGKO9.bin
Description: Binary data


Re: [trunk][google/gcc47]Add dependence of configure-target-libmudflap on configure-target-libstdc++-v3 (issue7740043)

2013-03-11 Thread Jing Yu
Don't know why the email body became attachment. Sent it again.
The review link is https://codereview.appspot.com/7740043

Hi Diego,

The nightly build of gcc-4.7 based ppc64 and ppc32 crosstools have failed since
the build server upgraded to gPrecise one week ago. Log shows a configuration fa
ilure on libmudflap.

checking for suffix of object files... /lib/cpp
configure: error: in
`/g/nightly/build/work/gcc-4.7.x-grtev3-powerpc32-8540/rpmbuild/BUILD/.../powerpc-grtev3-linux-gnu/libmudflap':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.

There is no /lib/cpp on gprecise server, though it should not be used here.

What happened was that libmudflap configure looks for a preprocessor
by trying $CXX -E and then backing off to /lib/cpp.  $CXX -E is
failing with "unrecognized command line option
‘-funconfigured-libstdc++’", and the /lib/cpp backstop then fails
also. The -funconfigured-libstdc++ is because configure can't find
libstdc++/scripts/testsuite_flags. This is a so-far undiagnosed race
in gcc make, masked where /lib/cpp is available.   And that's absent
because in this build, for whatever reason, libstdc++ loses a race
with libmudflap.

The theory is confirmed by:
 1) if we force --job=1, build can succeed
 2) If we apply the following patch to build-gcc/Makefile, build can
succeed. After removing this dependency, build fails with the same
error again.

Is this patch ok for google/gcc-4_7?

If the same issue exists on upstream trunk, how does the patch sound to trunk?

Thanks,
Jing

2013-03-11  Jing Yu  

* Makefile.in: (maybe-configure-target-libmudflap):
Add dependence on configure-target-libstdc++-v3.

Index: Makefile.in
===
--- Makefile.in (revision 196604)
+++ Makefile.in (working copy)
@@ -31879,6 +31879,9 @@ maybe-configure-target-libmudflap:
 @if gcc-bootstrap
 configure-target-libmudflap: stage_current
 @endif gcc-bootstrap
+@if target-libstdc++-v3
+configure-target-libmudflap: configure-target-libstdc++-v3
+@endif target-libstdc++-v3
 @if target-libmudflap
 maybe-configure-target-libmudflap: configure-target-libmudflap
 configure-target-libmudflap:


Re: [trunk][google/gcc47]Add dependence of configure-target-libmudflap on configure-target-libstdc++-v3 (issue7740043)

2013-03-12 Thread Jing Yu
I made a mistake in my previous patch. I did not notice that
Makefile.in was a generated file. Update the patch.

2013-03-12  Jing Yu  

   * Makefile.def (Target modules dependencies): Add new dependency.
   * Makefile.in: Re-generate.


Index: Makefile.in
===
--- Makefile.in (revision 196604)
+++ Makefile.in (working copy)
@@ -6,6 +6,7 @@ all-target-libjava: maybe-all-target-boehm-gc
 all-target-libjava: maybe-all-target-libffi
 configure-target-libobjc: maybe-configure-target-boehm-gc
 all-target-libobjc: maybe-all-target-boehm-gc
+configure-target-libmudflap: maybe-configure-target-libstdc++-v3
 configure-target-libstdc++-v3: maybe-configure-target-libgomp

 configure-stage1-target-libstdc++-v3: maybe-configure-stage1-target-libgomp
Index: Makefile.def
===
--- Makefile.def (revision 196604)
+++ Makefile.def (working copy)
@@ -504,6 +504,7 @@ dependencies = { module=all-target-libjava; on=all
 dependencies = { module=all-target-libjava; on=all-target-libffi; };
 dependencies = { module=configure-target-libobjc;
on=configure-target-boehm-gc; };
 dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
+dependencies = { module=configure-target-libmudflap;
on=configure-target-libstdc++-v3; };
 dependencies = { module=configure-target-libstdc++-v3;
on=configure-target-libgomp; };
 // parallel_list.o and parallel_settings.o depend on omp.h, which is
 // generated by the libgomp configure.  Unfortunately, due to the use of

On Mon, Mar 11, 2013 at 5:21 PM, Jing Yu  wrote:
> Don't know why the email body became attachment. Sent it again.
> The review link is https://codereview.appspot.com/7740043
>
> Hi Diego,
>
> The nightly build of gcc-4.7 based ppc64 and ppc32 crosstools have failed 
> since
> the build server upgraded to gPrecise one week ago. Log shows a configuration 
> fa
> ilure on libmudflap.
>
> checking for suffix of object files... /lib/cpp
> configure: error: in
> `/g/nightly/build/work/gcc-4.7.x-grtev3-powerpc32-8540/rpmbuild/BUILD/.../powerpc-grtev3-linux-gnu/libmudflap':
> configure: error: C++ preprocessor "/lib/cpp" fails sanity check
> See `config.log' for more details.
>
> There is no /lib/cpp on gprecise server, though it should not be used here.
>
> What happened was that libmudflap configure looks for a preprocessor
> by trying $CXX -E and then backing off to /lib/cpp.  $CXX -E is
> failing with "unrecognized command line option
> ‘-funconfigured-libstdc++’", and the /lib/cpp backstop then fails
> also. The -funconfigured-libstdc++ is because configure can't find
> libstdc++/scripts/testsuite_flags. This is a so-far undiagnosed race
> in gcc make, masked where /lib/cpp is available.   And that's absent
> because in this build, for whatever reason, libstdc++ loses a race
> with libmudflap.
>
> The theory is confirmed by:
>  1) if we force --job=1, build can succeed
>  2) If we apply the following patch to build-gcc/Makefile, build can
> succeed. After removing this dependency, build fails with the same
> error again.
>
> Is this patch ok for google/gcc-4_7?
>
> If the same issue exists on upstream trunk, how does the patch sound to trunk?
>
> Thanks,
> Jing
>
> 2013-03-11  Jing Yu  
>
> * Makefile.in: (maybe-configure-target-libmudflap):
> Add dependence on configure-target-libstdc++-v3.
>
> Index: Makefile.in
> ===
> --- Makefile.in (revision 196604)
> +++ Makefile.in (working copy)
> @@ -31879,6 +31879,9 @@ maybe-configure-target-libmudflap:
>  @if gcc-bootstrap
>  configure-target-libmudflap: stage_current
>  @endif gcc-bootstrap
> +@if target-libstdc++-v3
> +configure-target-libmudflap: configure-target-libstdc++-v3
> +@endif target-libstdc++-v3
>  @if target-libmudflap
>  maybe-configure-target-libmudflap: configure-target-libmudflap
>  configure-target-libmudflap:


[google/gcc-4_7]Mark expected failures

2013-03-15 Thread Jing Yu
Got new regression failures when using gold to run gcc regression
tests. The failures are related to LIPO (b/8397853).
Since LIPO won't be available for Powerpc64 target until the end of
2013Q2, mark these tests expected failure.

OK for google/gcc-4_7?

Tested:
Extract testresults from nightly build into /tmp/testresult/43933791, run
 ./validate_failures.py --build_dir=/tmp/testresult/43933791
--manifest powerpc64-grtev3-linux-gnu.xfail
SUCCESS: No unexpected failures.

Index: contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail
===
--- contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail
 (revision 196617)
+++ contrib/testsuite-management/powerpc64-grtev3-linux-gnu.xfail
 (working copy)
@@ -128,10 +128,15 @@ FAIL: g++.dg/ext/cleanup-9.C -std=gnu++98 executio
 FAIL: g++.dg/ext/cleanup-9.C -std=gnu++11 execution test
 FAIL: g++.dg/warn/Wself-assign-2.C -std=gnu++11  (test for warnings, line 12)
 FAIL: g++.dg/tree-prof/lipo/vcall1_0.C scan-ipa-dump-times profile
"Indirect call -> direct call" 2
-FAIL: g++.dg/tree-prof/mversn15.C execution,-fprofile-generate
+# b/8397853, a LIPO bug, causing compilation to fail.
+FAIL: g++.dg/tree-prof/mversn15.C compilation,  -fprofile-generate
+UNRESOLVED: g++.dg/tree-prof/mversn15.C execution,-fprofile-generate
+#FAIL: g++.dg/tree-prof/mversn15.C execution,-fprofile-generate
 UNRESOLVED: g++.dg/tree-prof/mversn15.C compilation,  -fprofile-use
 UNRESOLVED: g++.dg/tree-prof/mversn15.C execution,-fprofile-use
-FAIL: g++.dg/tree-prof/mversn15a.C execution,-fprofile-generate
+FAIL: g++.dg/tree-prof/mversn15a.C compilation,  -fprofile-generate
+UNRESOLVED: g++.dg/tree-prof/mversn15a.C execution,-fprofile-generate
+#FAIL: g++.dg/tree-prof/mversn15a.C execution,-fprofile-generate
 UNRESOLVED: g++.dg/tree-prof/mversn15a.C compilation,  -fprofile-use
 UNRESOLVED: g++.dg/tree-prof/mversn15a.C execution,-fprofile-use


[google/gcc-4_8]Regenerate Makefile.in

2013-04-04 Thread Jing Yu
Hi,

Current Makefile.in does not match Makefile.def. Regenerate it by
"autogen Makefile.def".
Tested the patched google/gcc-4_8 with crosstool-validate.py
--testers=crosstool.

OK for google/gcc-4_8?

Thanks,
Jing

Index: Makefile.in
===
--- Makefile.in (revision 197495)
+++ Makefile.in (working copy)
@@ -31004,7 +31004,7 @@
  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
  $(HOST_EXPORTS)  \
  (cd $(HOST_SUBDIR)/function_reordering_plugin && \
-  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
  $(TARGET-function_reordering_plugin))
 @endif function_reordering_plugin

@@ -31032,7 +31032,8 @@
  CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
  CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
  LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
- $(EXTRA_HOST_FLAGS)   \
+ $(EXTRA_HOST_FLAGS)  \
+ $(STAGE1_FLAGS_TO_PASS)  \
  TFLAGS="$(STAGE1_TFLAGS)" \
  $(TARGET-stage1-function_reordering_plugin)

@@ -31047,7 +31048,7 @@
  fi; \
  cd $(HOST_SUBDIR)/function_reordering_plugin && \
  $(MAKE) $(EXTRA_HOST_FLAGS)  \
- clean
+ $(STAGE1_FLAGS_TO_PASS)  clean
 @endif function_reordering_plugin-bootstrap


@@ -31088,9 +31089,7 @@
   $(MAKE) stage2-start; \
  fi; \
  cd $(HOST_SUBDIR)/function_reordering_plugin && \
- $(MAKE) $(EXTRA_HOST_FLAGS)  \
- $(POSTSTAGE1_FLAGS_TO_PASS)  \
- clean
+ $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif function_reordering_plugin-bootstrap


@@ -31131,9 +31130,7 @@
   $(MAKE) stage3-start; \
  fi; \
  cd $(HOST_SUBDIR)/function_reordering_plugin && \
- $(MAKE) $(EXTRA_HOST_FLAGS)  \
- $(POSTSTAGE1_FLAGS_TO_PASS)  \
- clean
+ $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif function_reordering_plugin-bootstrap


@@ -31174,9 +31171,7 @@
   $(MAKE) stage4-start; \
  fi; \
  cd $(HOST_SUBDIR)/function_reordering_plugin && \
- $(MAKE) $(EXTRA_HOST_FLAGS)  \
- $(POSTSTAGE1_FLAGS_TO_PASS)  \
- clean
+ $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif function_reordering_plugin-bootstrap


@@ -31217,9 +31212,7 @@
   $(MAKE) stageprofile-start; \
  fi; \
  cd $(HOST_SUBDIR)/function_reordering_plugin && \
- $(MAKE) $(EXTRA_HOST_FLAGS)  \
- $(POSTSTAGE1_FLAGS_TO_PASS)  \
- clean
+ $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif function_reordering_plugin-bootstrap


@@ -31260,9 +31253,7 @@
   $(MAKE) stagefeedback-start; \
  fi; \
  cd $(HOST_SUBDIR)/function_reordering_plugin && \
- $(MAKE) $(EXTRA_HOST_FLAGS)  \
- $(POSTSTAGE1_FLAGS_TO_PASS)  \
- clean
+ $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif function_reordering_plugin-bootstrap


[google-4.6]Backport r183875 to fix incorrect increment/decrement of atomic pointers (issue6428056)

2012-07-19 Thread Jing Yu
Backport r183875 from trunk and gcc-4.7 to fix PR51811 ([C++0x] Incorrect 
increment/decrement of atomic pointers).

Tested:
1) --testers=crosstool.
2) unit test in Google ref b/6702865

OK for google-4_6 branch?

Thanks,
Jing


2012-07-19  Jing Yu  

Backport r183875 to fix wrong atomic<_Tp*> add_fetch.
PR libstdc++/51811, Google ref b/6702865
* include/bits/atomic_0.h (atomic<_Tp*>): Fix offsets.
* include/bits/atomic_2.h: Likewise.
* testsuite/29_atomics/atomic/operators/51811.cc: New.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: New.

Index: include/bits/atomic_0.h
===
--- include/bits/atomic_0.h (revision 189589)
+++ include/bits/atomic_0.h (working copy)
@@ -620,7 +620,7 @@ namespace __atomic0
   __return_pointer_type
   fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
   {
-   void* __v = _ATOMIC_MODIFY_(this, +=, __d, __m);
+   void* __v = _ATOMIC_MODIFY_(this, +=, __d * sizeof(_PTp), __m);
return reinterpret_cast<__return_pointer_type>(__v);
   }
 
@@ -628,14 +628,14 @@ namespace __atomic0
   fetch_add(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) volatile
   {
-   void* __v = _ATOMIC_MODIFY_(this, +=, __d, __m);
+   void* __v = _ATOMIC_MODIFY_(this, +=, __d * sizeof(_PTp), __m);
return reinterpret_cast<__return_pointer_type>(__v);
   }
 
   __return_pointer_type
   fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
   {
-   void* __v = _ATOMIC_MODIFY_(this, -=, __d, __m);
+   void* __v = _ATOMIC_MODIFY_(this, -=, __d * sizeof(_PTp), __m);
return reinterpret_cast<__return_pointer_type>(__v);
   }
 
@@ -643,7 +643,7 @@ namespace __atomic0
   fetch_sub(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) volatile
   {
-   void* __v = _ATOMIC_MODIFY_(this, -=, __d, __m);
+   void* __v = _ATOMIC_MODIFY_(this, -=, __d * sizeof(_PTp), __m);
return reinterpret_cast<__return_pointer_type>(__v);
   }
 };
Index: include/bits/atomic_2.h
===
--- include/bits/atomic_2.h (revision 189589)
+++ include/bits/atomic_2.h (working copy)
@@ -644,21 +644,21 @@ namespace __atomic2
 
   __pointer_type
   fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
-  { return __sync_fetch_and_add(&_M_p, __d); }
+  { return __sync_fetch_and_add(&_M_p, __d * sizeof(_PTp)); }
 
   __pointer_type
   fetch_add(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) volatile
-  { return __sync_fetch_and_add(&_M_p, __d); }
+  { return __sync_fetch_and_add(&_M_p, __d * sizeof(_PTp)); }
 
   __pointer_type
   fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
-  { return __sync_fetch_and_sub(&_M_p, __d); }
+  { return __sync_fetch_and_sub(&_M_p, __d * sizeof(_PTp)); }
 
   __pointer_type
   fetch_sub(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) volatile
-  { return __sync_fetch_and_sub(&_M_p, __d); }
+  { return __sync_fetch_and_sub(&_M_p, __d * sizeof(_PTp)); }
 };
 
 } // namespace __atomic2
Index: testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
===
--- testsuite/29_atomics/atomic/operators/pointer_partial_void.cc   
(revision 0)
+++ testsuite/29_atomics/atomic/operators/pointer_partial_void.cc   
(revision 0)
@@ -0,0 +1,71 @@
+// { dg-require-atomic-builtins "" }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+#include  //std::abs
+#include 
+
+// pointer arithimetic vs. atomic.
+// atomic vs. explicitly specialized w/o operators, like atomic_bool?
+int main(void)
+{
+  // bool test __attribute__((unused)) = true;
+
+  using namespace std;
+
+  typedef int  value_type;
+  const size_t n = 2;
+  value_type value = 42;
+  value_type* p = &value;

Re: [google-4.6]Backport r183875 to fix incorrect increment/decrement of atomic pointers (issue 6428056)

2012-07-19 Thread Jing Yu
It is not a straightforward backport.
 has changed a lot in gcc-4.7. is_lock_free() body is entirely
different between gcc-4.6 and r183875. In gcc-4.6, is_lock_free()
simply returns false or true. Notice that gcc-4.6 defines two
namesapce __atomic0, __atomic2 in separate files (atomic_0.h,
atomic_2.h), which disappear in gcc-4.7.

Even though, the idea behind the bug is the same. The new unit tests
will fail without this patch.

Thanks,
Jing

Even though, the bug is the same. the new unit tests will

On Thu, Jul 19, 2012 at 3:29 PM,   wrote:
> This seems to be different from r183875.  Are the parts chaing
> is_look_free() in r183875 necessary? If not why?
>
> http://codereview.appspot.com/6428056/


Re: Backported r187026 from branches/google/gcc-4_6 (issue 6148044)

2012-05-02 Thread Jing Yu
LGTM

On Wed, May 2, 2012 at 11:24 AM,   wrote:
> On 2012/05/01 22:51:22, jingyu wrote:
>>
>> 1) Please add an description entry to libgcc/ChangeLog.google-4_6
>
>
> Done.
>
>
>
>> 2) Your gcc/ChangeLog.google-4_6 change reverts someone else's change.
>
> Please
>>
>> update it and also update the time of your entry.
>
>
> Done.
>
>
>
>> 3) Please list in the Description field what tests you have done.
>
>
> Done.
>
>
>> Thanks,
>> Jing
>
>
>> On 2012/05/01 22:40:12, asharif wrote:
>> > +carrot@
>
>
>
>
> http://codereview.appspot.com/6148044/


Re: [google/gcc-4_6_2-mobile] Port of Android target support in i386 for google/gcc-4_6_2-mobile branch

2012-05-07 Thread Jing Yu
I would like to port this patch to google/gcc-4_6 and also
google/gcc-4_6_2-mobile.

>From reading the patch, it does not change config for non-Android target.

bootstrap,crosstool tests finished successfully on google/gcc-4_6.
Built ARM android toolchain successfully.

OK?

Thanks,
Jing

On Thu, May 3, 2012 at 1:51 AM, Ilya Enkovich  wrote:
> Hi,
>
> here is a port of Android support patch
> (http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00944.html) for
> google/gcc-4_6_2-mobile branch. Is it OK?
>
> Bootstrapped on linux-x86_64. Successfullly used for NDK release build
> and Android ICS build.
>
> Thanks,
> Ilya
> ---
> 2012-05-03  Enkovich Ilya  
>
>        * config/linux-android.h (ANDROID_STARTFILE_SPEC): Fix
>        shared case.
>        (ANDROID_ENDFILE_SPEC): Likewise.
>
>        * config/i386/linux.h (TARGET_OS_CPP_BUILTINS): Add Android
>        builtins.
>        (LINUX_TARGET_CC1_SPEC): New.
>        (CC1_SPEC): Support Android.
>        (LINUX_TARGET_LINK_SPEC): New.
>        (LINK_SPEC): Support Android.
>        (LIB_SPEC): New.
>        (STARTFILE_SPEC): New.
>        (LINUX_TARGET_ENDFILE_SPEC): New.
>        (ENDFILE_SPEC): Support Android.
>        * config/i386/linux64.h: Likewise.


[google]Backport to enable stack protector for Android targets (issue6220051)

2012-05-18 Thread Jing Yu
Backport from trunk r187586
http://gcc.gnu.org/ml/gcc-cvs/2012-05/msg00583.html

Enable -fstack-protector support for Android targets.

The patch only affects targets where __BIONIC__ is defined.
Built Android arm toolchain.

Would like to commit the patch to google/gcc-4_6 and
google/gcc-4_6_2-mobile.

OK?

2012-05-18   Jing Yu  

Backport from trunk r187586:
2012-05-16  Igor Zamyatin  
* configure.ac: Stack protector enabling for Android targets.
* configure: Regenerate.

Index: gcc/configure
===
--- gcc/configure   (revision 187663)
+++ gcc/configure   (working copy)
@@ -25862,6 +25862,11 @@
 $target_header_dir/bits/uClibc_config.h > /dev/null; then
  gcc_cv_libc_provides_ssp=yes
fi
+  # all versions of Bionic support stack protector
+  elif test -f $target_header_dir/sys/cdefs.h \
+&& $EGREP '^[  ]*#[]*define[   ]+__BIONIC__[   ]+1' \
+   $target_header_dir/sys/cdefs.h > /dev/null; then
+ gcc_cv_libc_provides_ssp=yes
   fi
;;
*-*-gnu*)
Index: gcc/configure.ac
===
--- gcc/configure.ac(revision 187663)
+++ gcc/configure.ac(working copy)
@@ -4414,6 +4414,11 @@
 $target_header_dir/bits/uClibc_config.h > /dev/null; then
  gcc_cv_libc_provides_ssp=yes
fi
+  # all versions of Bionic support stack protector
+  elif test -f $target_header_dir/sys/cdefs.h \
+&& $EGREP '^[  ]*#[]*define[   ]+__BIONIC__[   ]+1' \
+   $target_header_dir/sys/cdefs.h > /dev/null; then
+ gcc_cv_libc_provides_ssp=yes
   fi]
;;
*-*-gnu*)
Index: gcc/ChangeLog.google-4_6
===
--- gcc/ChangeLog.google-4_6(revision 187663)
+++ gcc/ChangeLog.google-4_6    (working copy)
@@ -1,3 +1,11 @@
+2012-05-18   Jing Yu  
+
+   Backport from trunk r187586:
+   2012-05-16  Igor Zamyatin  
+
+   * configure.ac: Stack protector enabling for Android targets.
+   * configure: Regenerate.
+
 2012-05-18   Teresa Johnson  
 
Backport from google/main r187660:

--
This patch is available for review at http://codereview.appspot.com/6220051


Re: [PATCH, i386, Android] -mandroid support for i386 target

2012-03-28 Thread Jing Yu
This patch looks good for Android toolchain. But I am not a maintainer.
Can any x86 backend maintainer help to review the patch?

Thanks,
Jing

On Tue, Mar 27, 2012 at 6:55 AM, Ilya Enkovich  wrote:
> Ping
>
> 13 марта 2012 г. 15:13 пользователь Ilya Enkovich
>  написал:
>> Ping
>>
>> 27 февраля 2012 г. 6:41 пользователь Ilya Enkovich
>>  написал:
 You should keep those *_SPEC and define them with new
 GNU_*_SPEC in gnu-user.h since gnu-user.h is also used
 by other non-linux targets.  In linux.h, you undef *_SPEC
 before defining them.


 --
 H.J.
>>>
>>> Thanks for the note. Here is fixed version. Is it OK now?
>>>
>>> Thanks,
>>> Ilya
>>> --
>>> 2012-02-27  Enkovich Ilya  
>>>
>>>        * gcc/config/i386/gnu-user.h (GNU_USER_TARGET_CC1_SPEC): New.
>>>        (CC1_SPEC): Use GNU_USER_TARGET_CC1_SPEC.
>>>        (GNU_USER_TARGET_LINK_SPEC): New.
>>>        (LINK_SPEC): Use GNU_USER_TARGET_LINK_SPEC.
>>>        (GNU_USER_TARGET_MATHFILE_SPEC): New.
>>>        (ENDFILE_SPEC): Use GNU_USER_TARGET_MATHFILE_SPEC.
>>>
>>>        * gcc/config/i386/linux.h (CC1_SPEC): New.
>>>        (LINK_SPEC): New.
>>>        (LIB_SPEC): New.
>>>        (STARTFILE_SPEC): New.
>>>        (ENDFILE_SPEC): New.
>>>
>>>
>>> diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
>>> index 98d0a25..33ceab7 100644
>>> --- a/gcc/config/i386/gnu-user.h
>>> +++ b/gcc/config/i386/gnu-user.h
>>> @@ -77,8 +77,11 @@ along with GCC; see the file COPYING3.  If not see
>>>  #undef CPP_SPEC
>>>  #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
>>>
>>> +#undef GNU_USER_TARGET_CC1_SPEC
>>> +#define GNU_USER_TARGET_CC1_SPEC "%(cc1_cpu) %{profile:-p}"
>>> +
>>>  #undef CC1_SPEC
>>> -#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
>>> +#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC
>>>
>>>  /* Provide a LINK_SPEC appropriate for GNU userspace.  Here we provide 
>>> support
>>>    for the special GCC options -static and -shared, which allow us to
>>> @@ -97,22 +100,28 @@ along with GCC; see the file COPYING3.  If not see
>>>   { "link_emulation", GNU_USER_LINK_EMULATION },\
>>>   { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
>>>
>>> -#undef LINK_SPEC
>>> -#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
>>> +#define GNU_USER_TARGET_LINK_SPEC \
>>> +  "-m %(link_emulation) %{shared:-shared} \
>>>   %{!shared: \
>>>     %{!static: \
>>>       %{rdynamic:-export-dynamic} \
>>>       -dynamic-linker %(dynamic_linker)} \
>>>       %{static:-static}}"
>>>
>>> +#undef LINK_SPEC
>>> +#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
>>> +
>>>  /* Similar to standard GNU userspace, but adding -ffast-math support.  */
>>> -#undef  ENDFILE_SPEC
>>> -#define ENDFILE_SPEC \
>>> +#define GNU_USER_TARGET_MATHFILE_SPEC \
>>>   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
>>>    %{mpc32:crtprec32.o%s} \
>>>    %{mpc64:crtprec64.o%s} \
>>> -   %{mpc80:crtprec80.o%s} \
>>> -   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
>>> +   %{mpc80:crtprec80.o%s}"
>>> +
>>> +#undef  ENDFILE_SPEC
>>> +#define ENDFILE_SPEC \
>>> +  GNU_USER_TARGET_MATHFILE_SPEC " " \
>>> +  GNU_USER_TARGET_ENDFILE_SPEC
>>>
>>>  /* A C statement (sans semicolon) to output to the stdio stream
>>>    FILE the assembler definition of uninitialized global DECL named
>>> diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
>>> index 73681fe..a832ddc 100644
>>> --- a/gcc/config/i386/linux.h
>>> +++ b/gcc/config/i386/linux.h
>>> @@ -22,3 +22,30 @@ along with GCC; see the file COPYING3.  If not see
>>>
>>>  #define GNU_USER_LINK_EMULATION "elf_i386"
>>>  #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
>>> +
>>> +#undef CC1_SPEC
>>> +#define CC1_SPEC \
>>> +  LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
>>> +                      GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC)
>>> +
>>> +#undef LINK_SPEC
>>> +#define LINK_SPEC \
>>> +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
>>> +                      GNU_USER_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
>>> +
>>> +#undef  LIB_SPEC
>>> +#define LIB_SPEC \
>>> +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \
>>> +                      GNU_USER_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC)
>>> +
>>> +#undef  STARTFILE_SPEC
>>> +#define STARTFILE_SPEC \
>>> +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \
>>> +                      ANDROID_STARTFILE_SPEC)
>>> +
>>> +#undef  ENDFILE_SPEC
>>> +#define ENDFILE_SPEC \
>>> +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_MATHFILE_SPEC " " \
>>> +                      GNU_USER_TARGET_ENDFILE_SPEC,     \
>>> +                      GNU_USER_TARGET_MATHFILE_SPEC " " \
>>> +                      ANDROID_ENDFILE_SPEC)


Re: [PATCH, i386, Android] Enable __ANDROID__ macro for Android i386 target

2012-03-28 Thread Jing Yu
This patch looks good for Android toolchain. But I am not a maintainer.
Can any x86 backend maintainer help to review the patch?

Thanks,
Jing

On Tue, Mar 27, 2012 at 6:56 AM, Ilya Enkovich  wrote:
> Ping
>
> 13 марта 2012 г. 15:12 пользователь Ilya Enkovich
>  написал:
>> Ping
>>
>> 27 февраля 2012 г. 6:39 пользователь Ilya Enkovich
>>  написал:

 Undef TARGET_OS_CPP_BUILTINS and define TARGET_OS_CPP_BUILTINS
 in linux.h with GNU_USER_TARGET_OS_CPP_BUILTINS and
 ANDROID_TARGET_OS_CPP_BUILTINS.


 --
 H.J.
>>>
>>> Hello,
>>>
>>> Here is a variant with linux.h modification. Does it look fine?
>>>
>>> Thanks,
>>> Ilya
>>> --
>>> 2012-02-27  Enkovich Ilya  
>>>
>>>        * gcc/config/i386/linux.h (TARGET_OS_CPP_BUILTINS): New.
>>>
>>>
>>> diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
>>> index 73681fe..03c7b29 100644
>>> --- a/gcc/config/i386/linux.h
>>> +++ b/gcc/config/i386/linux.h
>>> @@ -22,3 +22,12 @@ along with GCC; see the file COPYING3.  If not see
>>>
>>>  #define GNU_USER_LINK_EMULATION "elf_i386"
>>>  #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
>>> +
>>> +#undef TARGET_OS_CPP_BUILTINS
>>> +#define TARGET_OS_CPP_BUILTINS()               \
>>> +  do                                           \
>>> +    {                                          \
>>> +       GNU_USER_TARGET_OS_CPP_BUILTINS();      \
>>> +       ANDROID_TARGET_OS_CPP_BUILTINS();       \
>>> +    }                                          \
>>> +  while (0)


[google]Backport r171347 and r181549 from trunk (strict volatile bitfield) (issue5449092)

2011-12-05 Thread Jing Yu
Hi Ahmad,

This is a backport for two upstream patches into our 4.6-mobile branch.
These two patches have been backported to google-4.6 by Doug Kwan last week.

2011-12-05  Jing Yu  
   Backport r171347 and r181549 from trunk.

   gcc/
   2011-03-23  Julian Brown  

* expr.c (expand_expr_real_1): Only use BLKmode for volatile
accesses which are not naturally aligned.

2011-11-20  Joey Ye  
* expr.c (expand_expr_real_1): Correctly handle strict volatile
bitfield loads smaller than mode size.

gcc/testsuite/
2011-11-20  Joey Ye  
* gcc.dg/volatile-bitfields-1.c: New.


2011-12-05   Jing Yu  

* gcc/expr.c:
* gcc/testsuite/gcc.dg/volatile-bitfields-1.c (void check):
(int main):

Index: gcc/expr.c
===
--- gcc/expr.c  (revision 182019)
+++ gcc/expr.c  (working copy)
@@ -9192,8 +9192,16 @@
&& modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER)
/* If the field is volatile, we always want an aligned
-  access.  */
-   || (volatilep && flag_strict_volatile_bitfields > 0)
+  access.  Do this in following two situations:
+  1. the access is not already naturally
+  aligned, otherwise "normal" (non-bitfield) volatile fields
+  become non-addressable.
+  2. the bitsize is narrower than the access size. Need
+  to extract bitfields from the access.  */
+   || (volatilep && flag_strict_volatile_bitfields > 0
+   && (bitpos % GET_MODE_ALIGNMENT (mode) != 0 
+   || (mode1 != BLKmode
+   && bitsize < GET_MODE_SIZE (mode1) * BITS_PER_UNIT)))
/* If the field isn't aligned enough to fetch as a memref,
   fetch it as a bit field.  */
|| (mode1 != BLKmode
Index: gcc/testsuite/gcc.dg/volatile-bitfields-1.c
===
--- gcc/testsuite/gcc.dg/volatile-bitfields-1.c (revision 0)
+++ gcc/testsuite/gcc.dg/volatile-bitfields-1.c (revision 0)
@@ -0,0 +1,23 @@
+/* { dg-options "-fstrict-volatile-bitfields" } */
+/* { dg-do run } */
+
+extern int puts(const char *);
+extern void abort(void) __attribute__((noreturn));
+
+typedef struct {
+  volatile unsigned short a:8, b:8;
+} BitStruct;
+
+BitStruct bits = {1, 2};
+
+void check(int i, int j)
+{
+  if (i != 1 || j != 2) puts("FAIL"), abort();
+}
+
+int main ()
+{
+  check(bits.a, bits.b);
+
+  return 0;
+}

--
This patch is available for review at http://codereview.appspot.com/5449092


[google] Backport r171347 and r181549 from trunk (strict volatile bitfield) (issue5453050)

2011-12-05 Thread Jing Yu
Hi Ahmad,

This is a backport for two upstream patches into our 4.6-mobile branch.
These two patches have been backported to google-4.6 by Doug Kwan last week.

2011-12-05  Jing Yu  
   Backport r171347 and r181549 from trunk.

   gcc/
   2011-03-23  Julian Brown  

* expr.c (expand_expr_real_1): Only use BLKmode for volatile
accesses which are not naturally aligned.

2011-11-20  Joey Ye  
* expr.c (expand_expr_real_1): Correctly handle strict volatile
bitfield loads smaller than mode size.

gcc/testsuite/
2011-11-20  Joey Ye  
* gcc.dg/volatile-bitfields-1.c: New.

Index: gcc/expr.c
===
--- gcc/expr.c  (revision 182019)
+++ gcc/expr.c  (working copy)
@@ -9192,8 +9192,16 @@
&& modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER)
/* If the field is volatile, we always want an aligned
-  access.  */
-   || (volatilep && flag_strict_volatile_bitfields > 0)
+  access.  Do this in following two situations:
+  1. the access is not already naturally
+  aligned, otherwise "normal" (non-bitfield) volatile fields
+  become non-addressable.
+  2. the bitsize is narrower than the access size. Need
+  to extract bitfields from the access.  */
+   || (volatilep && flag_strict_volatile_bitfields > 0
+   && (bitpos % GET_MODE_ALIGNMENT (mode) != 0 
+   || (mode1 != BLKmode
+   && bitsize < GET_MODE_SIZE (mode1) * BITS_PER_UNIT)))
/* If the field isn't aligned enough to fetch as a memref,
   fetch it as a bit field.  */
|| (mode1 != BLKmode
Index: gcc/testsuite/gcc.dg/volatile-bitfields-1.c
===
--- gcc/testsuite/gcc.dg/volatile-bitfields-1.c (revision 0)
+++ gcc/testsuite/gcc.dg/volatile-bitfields-1.c (revision 0)
@@ -0,0 +1,23 @@
+/* { dg-options "-fstrict-volatile-bitfields" } */
+/* { dg-do run } */
+
+extern int puts(const char *);
+extern void abort(void) __attribute__((noreturn));
+
+typedef struct {
+  volatile unsigned short a:8, b:8;
+} BitStruct;
+
+BitStruct bits = {1, 2};
+
+void check(int i, int j)
+{
+  if (i != 1 || j != 2) puts("FAIL"), abort();
+}
+
+int main ()
+{
+  check(bits.a, bits.b);
+
+  return 0;
+}

--
This patch is available for review at http://codereview.appspot.com/5453050


Re: PATCH [google/gcc-4_6-branch]: Include in config/locale/generic/c_locale.h

2011-12-14 Thread Jing Yu
The patch r172595 was intended for bionic setlocale() which always
returns 0. I don't remember I put NULL there initially.

We can simply replace all NULL in r172595 with 0.

I attached the updated patch.
If it is ok, I will commit the patch into google/gcc-4_6 and
google/gcc-4_6-mobile branches.

2011-12-14  H.J. Lu  
  Jing Yu  

  * config/locale/generic/c_locale.h (__convert_from_v): Replace
NULL with 0.
  * config/locale/generic/c_locale.cc (__convert_to_v): Likewise
  * config/locale/generic/time_members.cc (_M_put): Likewise

Thanks,
Jing

On Wed, Dec 14, 2011 at 10:12 AM, Diego Novillo  wrote:
> On 11-12-14 13:09 , Paolo Carlini wrote:
>>
>> Hi,
>>
>>> Hi,
>>>
>>> Revision 172595:
>>>
>>> http://gcc.gnu.org/viewcvs?view=revision&revision=172595
>>>
>>> added NULL to config/locale/generic/c_locale.h on
>>> google/gcc-4_6-branch. But  isn't included, which lead to
>>> build failure since NULL isn't defined.  This patch
>>> includes.  OK for google/gcc-4_6-branch?
>>
>>
>> If you are interested in my personal opinion, I have of course
>> nothing to do with this branch, I think this code should not simply
>> use NULL. After all, its C++, right? ;)
>
>
> Seems reasonable.  Jing, 172595 was a patch from you.  Would it be the same
> if you just used 0 instead of NULL?
>
>
> Diego.


patchnull.diff
Description: Binary data


Re: PATCH [google/gcc-4_6-branch]: Include in config/locale/generic/c_locale.h

2011-12-19 Thread Jing Yu
Committed to both google/gcc-4_6-google and google/gcc-4_6-mobile
(mobile release branch).

Diego,

I just realize we need this patch for google/gcc-main, since it is a
local patch. OK?

Thanks,
Jing

On Thu, Dec 15, 2011 at 4:42 AM, Diego Novillo  wrote:
> On 11-12-14 13:43 , Jing Yu wrote:
>
>> Index: config/locale/generic/c_locale.cc
>> ===
>> --- config/locale/generic/c_locale.cc   (revision 182019)
>> +++ config/locale/generic/c_locale.cc   (working copy)
>> @@ -52,8 +52,8 @@
>>     {
>>       // Assumes __s formatted for "C" locale.
>>       char* __old = setlocale(LC_ALL, 0);
>> -      char* __sav = NULL;
>> -      if (__old != NULL)
>> +      char* __sav = 0;
>> +      if (__old != 0)
>
>
>
> Just 'if (__old)', as Paolo suggested.  Similarly in all the other uses.
>
>
> OK with that change.
>
>
> Diego.


Re: [PATCH] Fix sibcall argument overlap checking if pretend_args_size (PR target/52129)

2012-02-09 Thread Jing Yu
On Thu, Feb 9, 2012 at 12:54 AM, Carrot Wei  wrote:
> Hi Richard and Jakub
>
> Since 4.6 contains the same bug, I would like to back port it to 4.6
> branch. Could you approve it for 4.6?
>
> Jing and Doug
>
> Could you approve it for google/gcc-4_6-mobile branch?
>

OK for google/gcc-4_6-mobile and gcc-4_6_2-mobile

Jing

> thanks
> Carrot
>
> On Mon, Feb 6, 2012 at 9:14 PM, Richard Guenther
>  wrote:
>> On Mon, Feb 6, 2012 at 2:01 PM, Jakub Jelinek  wrote:
>>> Hi!
>>>
>>> The attached testcase is miscompiled on arm*, by doing a sibcall when setup
>>> of one argument overwrites incoming arguments used to setup parameters in
>>> later insns.
>>> The reason why
>>> mem_overlaps_already_clobbered_arg_p/check_sibcall_argument_overlap
>>> fails to detect is that the caller has non-zero
>>> crtl->args.pretend_args_size, and in that case the base:
>>>      /* The argument block when performing a sibling call is the
>>>         incoming argument block.  */
>>>      if (pass == 0)
>>>        {
>>>          argblock = crtl->args.internal_arg_pointer;
>>>          argblock
>>> #ifdef STACK_GROWS_DOWNWARD
>>>            = plus_constant (argblock, crtl->args.pretend_args_size);
>>> #else
>>>            = plus_constant (argblock, -crtl->args.pretend_args_size);
>>> #endif
>>>          stored_args_map = sbitmap_alloc (args_size.constant);
>>>          sbitmap_zero (stored_args_map);
>>>        }
>>> apparently isn't virtual-incoming-rtx, but that plus pretend_args_size
>>> (8 in this case).  When we store bits into stored_args_map sbitmap,
>>> we use arg->locate.slot_offset.constant based values (or something different
>>> for ARGS_GROW_DOWNWARD, but when mem_overlaps_already_clobbered_arg_p is
>>> testing those bits, it uses just virtual-incoming-rtx offsets (or something
>>> different for ARGS_GROW_DOWNWARD).  This patch fixes it by adjusting the
>>> virtual-incoming-rtx relative offset to be actually argblock relative
>>> offset.
>>>
>>> Bootstrapped/regtested on x86_64-linux and i686-linux and tested on the
>>> testcase on arm cross.  Ok for trunk?
>>
>> Ok.
>>
>> Thanks,
>> Richard.
>>
>>> 2012-02-06  Jakub Jelinek  
>>>
>>>        PR target/52129
>>>        * calls.c (mem_overlaps_already_clobbered_arg_p): If val is
>>>        CONST_INT_P, subtract resp. add crtl->args.pretend_args_size to it.
>>>
>>>        * gcc.c-torture/execute/pr52129.c: New test.
>>>
>>> --- gcc/calls.c.jj      2012-02-01 14:44:27.0 +0100
>>> +++ gcc/calls.c 2012-02-06 10:19:12.112132905 +0100
>>> @@ -1808,6 +1808,11 @@ mem_overlaps_already_clobbered_arg_p (rt
>>>     return true;
>>>   else
>>>     i = INTVAL (val);
>>> +#ifdef STACK_GROWS_DOWNWARD
>>> +  i -= crtl->args.pretend_args_size;
>>> +#else
>>> +  i += crtl->args.pretend_args_size;
>>> +#endif
>>>
>>>  #ifdef ARGS_GROW_DOWNWARD
>>>   i = -i - size;
>>> --- gcc/testsuite/gcc.c-torture/execute/pr52129.c.jj    2012-02-06 
>>> 10:27:50.988876791 +0100
>>> +++ gcc/testsuite/gcc.c-torture/execute/pr52129.c       2012-02-06 
>>> 10:25:26.0 +0100
>>> @@ -0,0 +1,28 @@
>>> +/* PR target/52129 */
>>> +
>>> +extern void abort (void);
>>> +struct S { void *p; unsigned int q; };
>>> +struct T { char a[64]; char b[64]; } t;
>>> +
>>> +__attribute__((noinline, noclone)) int
>>> +foo (void *x, struct S s, void *y, void *z)
>>> +{
>>> +  if (x != &t.a[2] || s.p != &t.b[5] || s.q != 27 || y != &t.a[17] || z != 
>>> &t.b[17])
>>> +    abort ();
>>> +  return 29;
>>> +}
>>> +
>>> +__attribute__((noinline, noclone)) int
>>> +bar (void *x, void *y, void *z, struct S s, int t, struct T *u)
>>> +{
>>> +  return foo (x, s, &u->a[t], &u->b[t]);
>>> +}
>>> +
>>> +int
>>> +main ()
>>> +{
>>> +  struct S s = { &t.b[5], 27 };
>>> +  if (bar (&t.a[2], (void *) 0, (void *) 0, s, 17, &t) != 29)
>>> +    abort ();
>>> +  return 0;
>>> +}
>>>
>>>        Jakub


[google]Emit GNU-stack note for arm targets by default (issue5649090)

2012-02-14 Thread Jing Yu
arm-eabi toolchain needs GNU-stack note for security purpose.
Will Keep this patch in google branches.

OK for google/main?
I would like to port this patch to google/gcc-4_6, google/gcc-4_6-mobile,
google/gcc-4_6_2-moible.

2012-02-14  Jing Yu  
Google ref 42402-p2
* config/arm/arm.h: Emit GNU-stack note for all arm targets by
default.

Index: gcc/config/arm/arm.h
===
--- gcc/config/arm/arm.h(revision 184221)
+++ gcc/config/arm/arm.h(working copy)
@@ -2157,9 +2157,9 @@
: arm_gen_return_addr_mask ())


-/* Do not emit .note.GNU-stack by default.  */
+/* Do emit .note.GNU-stack by default.  */
 #ifndef NEED_INDICATE_EXEC_STACK
-#define NEED_INDICATE_EXEC_STACK   0
+#define NEED_INDICATE_EXEC_STACK   1
 #endif

 /* The maximum number of parallel loads or stores we support in an ldm/stm

--
This patch is available for review at http://codereview.appspot.com/5649090


Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-17 Thread Jing Yu
OK. Thanks for porting the patch.
I will commit the patch into google/gcc-4_6_2-mobile for you.

I would also like to commit it into google/gcc-4_6 branch if all tests
pass. This patch is almost the same as Google Ref 47894.

Thanks,
Jing

On Fri, Feb 17, 2012 at 5:20 PM, H.J. Lu  wrote:
> Hi,
>
> This patch backports the fix from trunk:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
>
> for google/gcc-4_6_2-mobile branch.  This is needed to support C++
> global constructors/destructiors on Android/x86.  OK for
> google/gcc-4_6_2-mobile branch?
>
> Thanks.
>
> H.J.
> ---
> 2011-08-20  H.J. Lu  
>
>        PR other/46770
>        * config.gcc (tm_file): Add initfini-array.h if
>        .init_arrary/.fini_array are supported.
>
>        * crtstuff.c: Don't generate .ctors nor .dtors sections if
>        USE_INITFINI_ARRAY is defined.
>
>        * output.h (default_elf_init_array_asm_out_constructor): New.
>        (default_elf_fini_array_asm_out_destructor): Likewise.
>        * varasm.c (elf_init_array_section): Likewise.
>        (elf_fini_array_section): Likewise.
>        (get_elf_initfini_array_priority_section): Likewise.
>        (default_elf_init_array_asm_out_constructor): Likewise.
>        (default_elf_fini_array_asm_out_destructor): Likewise.
>
>        * config/initfini-array.h: New.
>
> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177933 
> 138bc75d-0d04-0410-961f-82ee72b054a4
>
> Conflicts:
>
>        gcc/ChangeLog
> ---
>  gcc/ChangeLog.hjl           |   21 +++
>  gcc/config.gcc              |    5 +++
>  gcc/config/initfini-array.h |   37 +++
>  gcc/crtstuff.c              |   11 +++-
>  gcc/output.h                |    2 +
>  gcc/varasm.c                |   58 
> +++
>  6 files changed, 133 insertions(+), 1 deletions(-)
>  create mode 100644 gcc/ChangeLog.hjl
>  create mode 100644 gcc/config/initfini-array.h
>
> diff --git a/gcc/ChangeLog.hjl b/gcc/ChangeLog.hjl
> new file mode 100644
> index 000..3527b27
> --- /dev/null
> +++ b/gcc/ChangeLog.hjl
> @@ -0,0 +1,21 @@
> +2011-12-07  H.J. Lu  
> +
> +       Backport from mainline
> +       2011-08-20  H.J. Lu  
> +
> +       PR other/46770
> +       * config.gcc (tm_file): Add initfini-array.h if
> +       .init_arrary/.fini_array are supported.
> +
> +       * crtstuff.c: Don't generate .ctors nor .dtors sections if
> +       USE_INITFINI_ARRAY is defined.
> +
> +       * output.h (default_elf_init_array_asm_out_constructor): New.
> +       (default_elf_fini_array_asm_out_destructor): Likewise.
> +       * varasm.c (elf_init_array_section): Likewise.
> +       (elf_fini_array_section): Likewise.
> +       (get_elf_initfini_array_priority_section): Likewise.
> +       (default_elf_init_array_asm_out_constructor): Likewise.
> +       (default_elf_fini_array_asm_out_destructor): Likewise.
> +
> +       * config/initfini-array.h: New.
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index d9ac0fa..b386424 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -3176,6 +3176,11 @@ if test x$with_schedule = x; then
>        esac
>  fi
>
> +# Support --enable-initfini-array.
> +if test x$enable_initfini_array = xyes; then
> +  tm_file="${tm_file} initfini-array.h"
> +fi
> +
>  # Validate and mark as valid any --with options supported
>  # by this target.  In order to use a particular --with option
>  # you must list it in supported_defaults; validating the value
> diff --git a/gcc/config/initfini-array.h b/gcc/config/initfini-array.h
> new file mode 100644
> index 000..8aaadf6
> --- /dev/null
> +++ b/gcc/config/initfini-array.h
> @@ -0,0 +1,37 @@
> +/* Definitions for ELF systems with .init_array/.fini_array section
> +   support.
> +   Copyright (C) 2011
> +   Free Software Foundation, Inc.
> +
> +   This file is part of GCC.
> +
> +   GCC is free software; you can redistribute it and/or modify it
> +   under the terms of the GNU General Public License as published
> +   by the Free Software Foundation; either version 3, or (at your
> +   option) any later version.
> +
> +   GCC is distributed in the hope that it will be useful, but WITHOUT
> +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> +   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
> +   License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with GCC; see the file COPYING3.  If not see
> +   .  */
> +
> +#define USE_INITFINI_ARRAY
> +
> +#undef INIT_SECTION_ASM_OP
> +#undef FINI_SECTION_ASM_OP
> +
> +#undef INIT_ARRAY_SECTION_ASM_OP
> +#define INIT_ARRAY_SECTION_ASM_OP
> +
> +#undef FINI_ARRAY_SECTION_ASM_OP
> +#define FINI_ARRAY_SECTION_ASM_OP
> +
> +/* Use .init_array/.fini_array section for constructors and destructors. */
> +#undef TARGET_ASM_CONSTRUCTOR
> +#define TARGET_ASM_CONSTRUCTOR default_elf_init_array_asm_out_constructor
> +#undef TARGET_ASM_DESTRUCTO

Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-20 Thread Jing Yu
Sorry -- I will fix it in google/gcc-4_6_2-mobile.

Thanks,
Jing

On Mon, Feb 20, 2012 at 7:15 AM, Ilya Enkovich  wrote:
> Hello,
>
>> Hey, Jing, you broke the google/gcc-4_6 branch by checking the new
>> header file into the wrong directory.
>>
>> Fixed via r184386.
>>
>
> google/gcc-4_6_2-mobile branch still has the same problem. Could
> please someone fix it?
>
> Thanks
> Ilya
>
>> Ollie
>>
>> On Fri, Feb 17, 2012 at 10:25 PM, Jing Yu  wrote:
>>>
>>> OK. Thanks for porting the patch.
>>> I will commit the patch into google/gcc-4_6_2-mobile for you.
>>>
>>> I would also like to commit it into google/gcc-4_6 branch if all tests
>>> pass. This patch is almost the same as Google Ref 47894.
>>>
>>> Thanks,
>>> Jing
>>>
>>> On Fri, Feb 17, 2012 at 5:20 PM, H.J. Lu  wrote:
>>> > Hi,
>>> >
>>> > This patch backports the fix from trunk:
>>> >
>>> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
>>> >
>>> > for google/gcc-4_6_2-mobile branch.  This is needed to support C++
>>> > global constructors/destructiors on Android/x86.  OK for
>>> > google/gcc-4_6_2-mobile branch?
>>> >
>>> > Thanks.
>>> >
>>> > H.J.
>>> > ---
>>> > 2011-08-20  H.J. Lu  
>>> >
>>> >        PR other/46770
>>> >        * config.gcc (tm_file): Add initfini-array.h if
>>> >        .init_arrary/.fini_array are supported.
>>> >
>>> >        * crtstuff.c: Don't generate .ctors nor .dtors sections if
>>> >        USE_INITFINI_ARRAY is defined.
>>> >
>>> >        * output.h (default_elf_init_array_asm_out_constructor): New.
>>> >        (default_elf_fini_array_asm_out_destructor): Likewise.
>>> >        * varasm.c (elf_init_array_section): Likewise.
>>> >        (elf_fini_array_section): Likewise.
>>> >        (get_elf_initfini_array_priority_section): Likewise.
>>> >        (default_elf_init_array_asm_out_constructor): Likewise.
>>> >        (default_elf_fini_array_asm_out_destructor): Likewise.
>>> >
>>> >        * config/initfini-array.h: New.
>>> >
>>> > git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177933 
>>> > 138bc75d-0d04-0410-961f-82ee72b054a4
>>> >
>>> > Conflicts:
>>> >
>>> >        gcc/ChangeLog
>>> > ---
>>> >  gcc/ChangeLog.hjl           |   21 +++
>>> >  gcc/config.gcc              |    5 +++
>>> >  gcc/config/initfini-array.h |   37 +++
>>> >  gcc/crtstuff.c              |   11 +++-
>>> >  gcc/output.h                |    2 +
>>> >  gcc/varasm.c                |   58 
>>> > +++
>>> >  6 files changed, 133 insertions(+), 1 deletions(-)
>>> >  create mode 100644 gcc/ChangeLog.hjl
>>> >  create mode 100644 gcc/config/initfini-array.h
>>> >
>>> > diff --git a/gcc/ChangeLog.hjl b/gcc/ChangeLog.hjl
>>> > new file mode 100644
>>> > index 000..3527b27
>>> > --- /dev/null
>>> > +++ b/gcc/ChangeLog.hjl
>>> > @@ -0,0 +1,21 @@
>>> > +2011-12-07  H.J. Lu  
>>> > +
>>> > +       Backport from mainline
>>> > +       2011-08-20  H.J. Lu  
>>> > +
>>> > +       PR other/46770
>>> > +       * config.gcc (tm_file): Add initfini-array.h if
>>> > +       .init_arrary/.fini_array are supported.
>>> > +
>>> > +       * crtstuff.c: Don't generate .ctors nor .dtors sections if
>>> > +       USE_INITFINI_ARRAY is defined.
>>> > +
>>> > +       * output.h (default_elf_init_array_asm_out_constructor): New.
>>> > +       (default_elf_fini_array_asm_out_destructor): Likewise.
>>> > +       * varasm.c (elf_init_array_section): Likewise.
>>> > +       (elf_fini_array_section): Likewise.
>>> > +       (get_elf_initfini_array_priority_section): Likewise.
>>> > +       (default_elf_init_array_asm_out_constructor): Likewise.
>>> > +       (default_elf_fini_array_asm_out_destructor): Likewise.
>>> > +
>>> > +       * config/initfini-array.h: New.
>>> > diff --git a/gcc/config.gcc b/gcc/config.gcc
>>> > index d9ac0fa..b386424 100644
>>> > --

Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-20 Thread Jing Yu
Hi H.J.,

I think the patch itself is not enough.
I compared "AC_DEFUN([gcc_AC_INITFINI_ARRAY]" part (in acinclude.m4)
of gcc trunk and google/gcc-4_6_2-mobile, and found how
enable_initfini_array is
configured is different.

The patch breaks some of our tests. enable_initfini_array should be
disabled for cross compile by default. But it is not true in our
branch. Could you please point us all related patches?

Thanks,
Jing

On Mon, Feb 20, 2012 at 8:30 AM, H.J. Lu  wrote:
> On Sat, Feb 18, 2012 at 1:54 AM, Jakub Jelinek  wrote:
>> On Fri, Feb 17, 2012 at 05:20:02PM -0800, H.J. Lu wrote:
>>> This patch backports the fix from trunk:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
>>>
>>> for google/gcc-4_6_2-mobile branch.  This is needed to support C++
>>> global constructors/destructiors on Android/x86.  OK for
>>> google/gcc-4_6_2-mobile branch?
>>
>> Don't you want to backport also all the follow-ups on this?
>>
>
> The original patch works with cross compile since it is disabled by
> default.  For native compile, it works with the default GNU assembler
> and linker.  If there are additional failure for native compile, it should
> be disabled at configure time.
>
>
> --
> H.J.


Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-22 Thread Jing Yu
The attachment is a complete patch for [google/gcc-4_6] branch, to
replace .ctors/.dtors with .init_array/.fini_array.

Bootstrap and crosstool testers pass.
I have verified that "gcc_cv_initfini_array=no", which means the
crosstool will do whatever it did before (won't replace .ctors/.dtors
with .init_array/.fini_array).

I also built Android toolchain and verified "gcc_cv_initfini_array=no".

r177933 is already in google/gcc-4_6_2-mobile and
google/gcc-4_6-mobile. I need to backport the rest to these two
branches.

ok?

2012-02-21   Jing Yu  

Google Ref 47894
Backport from mainline r177933, r175181, r177963, r178116, r183299.

2011-08-20  H.J. Lu  
PR other/46770
* config.gcc (tm_file): Add initfini-array.h if
.init_arrary/.fini_array are supported.
* crtstuff.c: Don't generate .ctors nor .dtors sections if
USE_INITFINI_ARRAY is defined.
* output.h (default_elf_init_array_asm_out_constructor): New.
(default_elf_fini_array_asm_out_destructor): Likewise.
* varasm.c (elf_init_array_section): Likewise.
(elf_fini_array_section): Likewise.
(get_elf_initfini_array_priority_section): Likewise.
(default_elf_init_array_asm_out_constructor): Likewise.
(default_elf_fini_array_asm_out_destructor): Likewise.
* config/initfini-array.h: New.

2011-06-18  H.J. Lu  
PR other/49325
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Properly check if
.init_array can be used with .ctors on targets.
* configure: Regenerated.

2011-08-22  H.J. Lu  
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Error if __ELF__ isn't
defined.
* configure: Regenerated.

2011-08-26  Rainer Orth  
PR target/50166
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
* configure: Regenerate.

2012-01-19  Jakub Jelinek  
PR bootstrap/50237
* config/initfini-array.h: Guard content of the header
with #ifdef HAVE_INITFINI_ARRAY.
* configure.ac: Move gcc_AC_INITFINI_ARRAY much later into the
file.
Add initfini-array.h to tm_file here.
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): For non-ia64 do a
linker test.
* config.gcc: Don't add initfini-array.h to tm_file here.
* configure: Regenerated.

Thanks,
Jing

On Tue, Feb 21, 2012 at 9:34 AM, H.J. Lu  wrote:
> On Mon, Feb 20, 2012 at 11:31 PM, Jing Yu  wrote:
>> Hi H.J.,
>>
>> I think the patch itself is not enough.
>> I compared "AC_DEFUN([gcc_AC_INITFINI_ARRAY]" part (in acinclude.m4)
>> of gcc trunk and google/gcc-4_6_2-mobile, and found how
>> enable_initfini_array is
>> configured is different.
>>
>> The patch breaks some of our tests. enable_initfini_array should be
>> disabled for cross compile by default. But it is not true in our
>> branch. Could you please point us all related patches?
>>
>
> I missed this backport. There are some additional changes needed for
> non-Linux systems:
>
> http://gcc.gnu.org/ml/gcc-cvs/2011-08/msg00978.html
> http://gcc.gnu.org/ml/gcc-cvs/2011-08/msg01132.html
> http://gcc.gnu.org/ml/gcc-cvs/2012-01/msg00544.html
>
>
>
> --
> H.J.


initfini.patch
Description: Binary data


Re: [PATCH, i386, Android] Enable exceptions and RTTI by default for Android

2012-02-22 Thread Jing Yu
So far, Android ARM toolchain, which builds Android platform for ARM
boards, does not enable RTTI and exceptions by default. There are
license concerns with the use of GNU libstdc++ and libsupc++.

Thanks,
Jing

On Wed, Feb 22, 2012 at 7:07 AM, Richard Guenther
 wrote:
> On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich  wrote:
>> Hello,
>>
>> Here is a simple patch which enables exceptions and RTTI by default
>> for Android target. OK for trunk?
>
> Err - isn't that the default?  Thus, simply delete the bogus spec?
>
> Richard.
>
>
>> Thanks,
>> Ilya
>> --
>>
>> 2012-02-22  Enkovich Ilya  
>>
>>        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
>>        exceptions and rtti by default.
>>
>>
>> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
>> index 94c5274..7256082 100644
>> --- a/gcc/config/linux-android.h
>> +++ b/gcc/config/linux-android.h
>> @@ -46,8 +46,8 @@
>>   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC"
>>
>>  #define ANDROID_CC1PLUS_SPEC                                           \
>> -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "               \
>> -  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
>> +  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "          \
>> +  "%{!frtti:%{!fno-rtti: -frtti}}"
>>
>>  #define ANDROID_LIB_SPEC \
>>   "%{!static: -ldl}"


Re: PATCH: Use crtbegin_so%O%s/crtend_so%O%s for -mandroid -shared

2012-02-22 Thread Jing Yu
I am OK with the patch, I am not a maintainer though.

Jing

On Wed, Dec 14, 2011 at 9:11 AM, H.J. Lu  wrote:
> Hi,
>
> Android uses crtbegin_so.o and crtend_so.o to build shared library with
> -mshared.  OK for trunk in stage 1?
>
>
> H.J.
> ---
> 2011-12-13  H.J. Lu  
>
>        * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
>        crtbegin_so%O%s for -shared.
>        (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
> ---
>  gcc/ChangeLog.android      |    5 +
>  gcc/config/linux-android.h |    4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/ChangeLog.android
>
> diff --git a/gcc/ChangeLog.android b/gcc/ChangeLog.android
> new file mode 100644
> index 000..fc54522
> --- /dev/null
> +++ b/gcc/ChangeLog.android
> @@ -0,0 +1,5 @@
> +2011-12-13  H.J. Lu  
> +
> +       * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
> +       crtbegin_so%O%s for -shared.
> +       (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
> index 94c5274..acbc662 100644
> --- a/gcc/config/linux-android.h
> +++ b/gcc/config/linux-android.h
> @@ -53,8 +53,8 @@
>   "%{!static: -ldl}"
>
>  #define ANDROID_STARTFILE_SPEC                                         \
> -  "%{!shared:"                                                         \
> +  "%{shared: crtbegin_so%O%s;:"                                              
>   \
>   "  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}"
>
>  #define ANDROID_ENDFILE_SPEC \
> -  "%{!shared: crtend_android%O%s}"
> +  "%{shared: crtend_so%O%s;: crtend_android%O%s}"
> --
> 1.7.6.4
>


Re: [PATCH, i386, Android] Enable exceptions and RTTI by default for Android

2012-02-24 Thread Jing Yu
My comment is(was) not on the format of the patch. Instead, I am
thinking whether Android toolchain customer, which is Android AOSP,
wants this patch.

I don't know the scenario behind this patch. I think the question
behind this patch is, if RTTI and exceptions are enabled by default,
who is supposed to handle RTTI and exceptions by default? The answer
is no answer, for now.

Android AOSP tree provides very limited C++ support. Android NDK
provides four options for C++ support. Some of the options support
both exceptions and rttit, some options only support rtti.

Therefore I guess Android AOSP probably would not like to enable
exceptions and RTTI by default.

Questions/complaints/requests on Android limited C++ support, should
go to Android forum.
Questions about license concerns, should go to Android AOSP lawyer.

Thanks,
Jing

On Fri, Feb 24, 2012 at 2:36 AM, Richard Guenther
 wrote:
> On Fri, Feb 24, 2012 at 11:22 AM, Ilya Enkovich  
> wrote:
>>> On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich  
>>> wrote:
 Hello,

 Here is a simple patch which enables exceptions and RTTI by default
 for Android target. OK for trunk?
>>>
>>> Err - isn't that the default?  Thus, simply delete the bogus spec?
>>>
>>> Richard.
>>>
>>>
>> Hi,
>>
>> Is following patch OK or it's better to remove whole macro and its usages?
>
> The latter.
>
> Richard.
>
>> Thanks,
>> Ilya
>> --
>> 2012-02-22  Enkovich Ilya  
>>
>>        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
>>        exceptions and rtti by default.
>>
>>
>> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
>> index 94c5274..180b62b 100644
>> --- a/gcc/config/linux-android.h
>> +++ b/gcc/config/linux-android.h
>> @@ -45,9 +45,7 @@
>>   "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} "                      \
>>   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC"
>>
>> -#define ANDROID_CC1PLUS_SPEC                                           \
>> -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "               \
>> -  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
>> +#define ANDROID_CC1PLUS_SPEC ""
>>
>>  #define ANDROID_LIB_SPEC \
>>   "%{!static: -ldl}"


Re: [PATCH, i386, Android] Enable exceptions and RTTI by default for Android

2012-02-27 Thread Jing Yu
On Mon, Feb 27, 2012 at 12:28 AM, Ilya Enkovich  wrote:
>> My comment is(was) not on the format of the patch. Instead, I am
>> thinking whether Android toolchain customer, which is Android AOSP,
>> wants this patch.
>>
>> I don't know the scenario behind this patch. I think the question
>> behind this patch is, if RTTI and exceptions are enabled by default,
>> who is supposed to handle RTTI and exceptions by default? The answer
>> is no answer, for now.
>>
>> Android AOSP tree provides very limited C++ support. Android NDK
>> provides four options for C++ support. Some of the options support
>> both exceptions and rttit, some options only support rtti.
>>
>> Therefore I guess Android AOSP probably would not like to enable
>> exceptions and RTTI by default.
>
> Actually when you rebuild Android NDK similar patch (named
> 0001-Enable-C-exceptions-and-RTTI-by-default.patch) is applied to GCC
> sources before toolchain rebuild.

Right. The patch is used to build NDK toolchain which is to build NDK
applications, and NDK offers several options for RTTI and exception
support. But Android AOSP platform does not support exception, and the
toolchain to build Android AOSP platform does not use this patch.
That's why the patch exists in NDK package, not in AOSP toolchain
source repository.

Thanks,
Jing

>
> Ilya
>
>>
>> Questions/complaints/requests on Android limited C++ support, should
>> go to Android forum.
>> Questions about license concerns, should go to Android AOSP lawyer.
>>
>> Thanks,
>> Jing
>>
>> On Fri, Feb 24, 2012 at 2:36 AM, Richard Guenther
>>  wrote:
>>> On Fri, Feb 24, 2012 at 11:22 AM, Ilya Enkovich  
>>> wrote:
> On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich  
> wrote:
>> Hello,
>>
>> Here is a simple patch which enables exceptions and RTTI by default
>> for Android target. OK for trunk?
>
> Err - isn't that the default?  Thus, simply delete the bogus spec?
>
> Richard.
>
>
 Hi,

 Is following patch OK or it's better to remove whole macro and its usages?
>>>
>>> The latter.
>>>
>>> Richard.
>>>
 Thanks,
 Ilya
 --
 2012-02-22  Enkovich Ilya  

        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
        exceptions and rtti by default.


 diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
 index 94c5274..180b62b 100644
 --- a/gcc/config/linux-android.h
 +++ b/gcc/config/linux-android.h
 @@ -45,9 +45,7 @@
   "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} "                      \
   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC"

 -#define ANDROID_CC1PLUS_SPEC                                           \
 -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "               \
 -  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
 +#define ANDROID_CC1PLUS_SPEC ""

  #define ANDROID_LIB_SPEC \
   "%{!static: -ldl}"


[google/4.6]Backport r184061 from upstream 4.6 (issue5712053)

2012-03-01 Thread Jing Yu
Backport r184061 from gcc-4_6 branch to fix an invalid
constant simplification (PR52060).

bootstrap and crosstool tests pass.

OK for google/gcc-4_6 and google/gcc-4_6_2-mobile?


2012-03-01  Jing Yu  
Backport r184061 from gcc-4_6-branch to fix PR52060.

2012-02-07  Jakub Jelinek  
PR rtl-optimization/52060
* gcc.dg/torture/pr52060.c: New test.

2012-03-01   Jing Yu  
Backport r184061 from gcc-4_6-branch to fix PR52060.

2012-02-07  Jakub Jelinek  
PR rtl-optimization/52060
* combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
copy i1src to i1src_copy whenever added_sets_2 && i1_feeds_i2_n
already before i1dest -> i1src substitution in newpat, copy i0src
to i0src_copy and/or i0src_copy2 when needed.


Index: testsuite/ChangeLog.google-4_6
===
--- testsuite/ChangeLog.google-4_6  (revision 184667)
+++ testsuite/ChangeLog.google-4_6  (working copy)
@@ -1,3 +1,10 @@
+2012-03-01  Jing Yu  
+   Backport r184061 from gcc-4_6-branch to fix PR52060.
+
+   2012-02-07  Jakub Jelinek  
+   PR rtl-optimization/52060
+   * gcc.dg/torture/pr52060.c: New test.
+
 2012-02-19  Jeffrey Yasskin 
 Backport r183223 from gcc-4_6-branch to fix a segfault in C++11
mode.
Index: testsuite/gcc.dg/torture/pr52060.c
===
--- testsuite/gcc.dg/torture/pr52060.c  (revision 0)
+++ testsuite/gcc.dg/torture/pr52060.c  (revision 0)
@@ -0,0 +1,57 @@
+/* PR rtl-optimization/52060 */
+/* { dg-do run { target int32plus } } */
+
+extern void abort (void);
+union U { float f; unsigned int i; };
+
+static inline __attribute__((always_inline)) unsigned int
+foo (float x)
+{
+  union U u;
+  unsigned int a, b, c;
+  int d;
+  int e;
+  u.f = x;
+  d = ((unsigned) u.i >> 23) & 0xFF;
+  c = d < 126 ? 0 : ~0;
+  e = 127 + 30 - d;
+  a = (u.i << 8) | 0x8000U;
+  b = a & ((1 << e) - 1);
+  a = a >> e;
+  c &= (b | (a & 2)) ? ~0 : ~1;
+  a = ((a + 1U) >> 1) & c;
+  return a;
+}
+
+__attribute__((noinline)) unsigned int
+bar (float x)
+{
+  unsigned int a, b, c;
+  static const unsigned int d[128] =
+  {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 7
+  };
+  a = foo (1048575.0f * x);
+  c = d[a >> 13];
+  b = (c << 13) | ((a >> (7 - c)) & 0x1fff);
+  return b;
+}
+
+int
+main ()
+{
+  union U u;
+  u.f = 1048575.0f;
+  if (sizeof (u.i) == sizeof (u.f)
+  && u.i == 0x4970U
+  && bar (1.0f) != 65535)
+abort ();
+  return 0;
+}
Index: ChangeLog.google-4_6
===
--- ChangeLog.google-4_6    (revision 184667)
+++ ChangeLog.google-4_6(working copy)
@@ -1,3 +1,13 @@
+2012-03-01   Jing Yu  
+   Backport r184061 from gcc-4_6-branch to fix PR52060.
+
+   2012-02-07  Jakub Jelinek  
+   PR rtl-optimization/52060
+   * combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
+   copy i1src to i1src_copy whenever added_sets_2 && i1_feeds_i2_n
+   already before i1dest -> i1src substitution in newpat, copy i0src
+   to i0src_copy and/or i0src_copy2 when needed.
+
 2012-02-21   Jing Yu  
 
Google Ref 47894
Index: combine.c
===
--- combine.c   (revision 184667)
+++ combine.c   (working copy)
@@ -2551,8 +2551,8 @@
   rtx i3dest_killed = 0;
   /* SET_DEST and SET_SRC of I2, I1 and I0.  */
   rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
-  /* Copy of SET_SRC of I1, if needed.  */
-  rtx i1src_copy = 0;
+  /* Copy of SET_SRC of I1 and I0, if needed.  */
+  rtx i1src_copy = 0, i0src_copy = 0, i0src_copy2 = 0;
   /* Set if I2DEST was reused as a scratch register.  */
   bool i2scratch = false;
   /* The PATTERNs of I0, I1, and I2, or a copy of them in certain cases.  */
@@ -3164,6 +3164,11 @@
   n_occurrences = 0;
   subst_low_luid = DF_INSN_LUID (i1);
 
+  /* If the following substitution will modify I1SRC, make a copy of it
+for the case where it is substituted for I1DEST in I2PAT later.  */
+  if (added_sets_2 && i1_feeds_i2_n)
+   i1src_copy = copy_rtx (i1src);
+
   /* If I0 feeds into I1 and I0DEST is in I0SRC, we need to make a unique
 copy of I1SRC each time we substitute it, in order to avoid creating
 self-referential RTL when we

Re: [google/4.6]Backport r184061 from upstream 4.6 (issue5712053)

2012-03-01 Thread Jing Yu
The patch will be auto-merged into google/gcc-4_6 in near future.
I will cherry-pick it into google/gcc-4_6_2-mobile.

On Thu, Mar 1, 2012 at 10:50 AM, Jing Yu  wrote:
> Backport r184061 from gcc-4_6 branch to fix an invalid
> constant simplification (PR52060).
>
> bootstrap and crosstool tests pass.
>
> OK for google/gcc-4_6 and google/gcc-4_6_2-mobile?
>
>
> 2012-03-01  Jing Yu  
>        Backport r184061 from gcc-4_6-branch to fix PR52060.
>
>        2012-02-07  Jakub Jelinek  
>        PR rtl-optimization/52060
>        * gcc.dg/torture/pr52060.c: New test.
>
> 2012-03-01   Jing Yu  
>        Backport r184061 from gcc-4_6-branch to fix PR52060.
>
>        2012-02-07  Jakub Jelinek  
>        PR rtl-optimization/52060
>        * combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
>        copy i1src to i1src_copy whenever added_sets_2 && i1_feeds_i2_n
>        already before i1dest -> i1src substitution in newpat, copy i0src
>        to i0src_copy and/or i0src_copy2 when needed.
>
>
> Index: testsuite/ChangeLog.google-4_6
> ===
> --- testsuite/ChangeLog.google-4_6      (revision 184667)
> +++ testsuite/ChangeLog.google-4_6      (working copy)
> @@ -1,3 +1,10 @@
> +2012-03-01  Jing Yu  
> +       Backport r184061 from gcc-4_6-branch to fix PR52060.
> +
> +       2012-02-07  Jakub Jelinek  
> +       PR rtl-optimization/52060
> +       * gcc.dg/torture/pr52060.c: New test.
> +
>  2012-02-19  Jeffrey Yasskin 
>         Backport r183223 from gcc-4_6-branch to fix a segfault in C++11
>        mode.
> Index: testsuite/gcc.dg/torture/pr52060.c
> ===
> --- testsuite/gcc.dg/torture/pr52060.c  (revision 0)
> +++ testsuite/gcc.dg/torture/pr52060.c  (revision 0)
> @@ -0,0 +1,57 @@
> +/* PR rtl-optimization/52060 */
> +/* { dg-do run { target int32plus } } */
> +
> +extern void abort (void);
> +union U { float f; unsigned int i; };
> +
> +static inline __attribute__((always_inline)) unsigned int
> +foo (float x)
> +{
> +  union U u;
> +  unsigned int a, b, c;
> +  int d;
> +  int e;
> +  u.f = x;
> +  d = ((unsigned) u.i >> 23) & 0xFF;
> +  c = d < 126 ? 0 : ~0;
> +  e = 127 + 30 - d;
> +  a = (u.i << 8) | 0x8000U;
> +  b = a & ((1 << e) - 1);
> +  a = a >> e;
> +  c &= (b | (a & 2)) ? ~0 : ~1;
> +  a = ((a + 1U) >> 1) & c;
> +  return a;
> +}
> +
> +__attribute__((noinline)) unsigned int
> +bar (float x)
> +{
> +  unsigned int a, b, c;
> +  static const unsigned int d[128] =
> +  {
> +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> +    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> +    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
> +    3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 7
> +  };
> +  a = foo (1048575.0f * x);
> +  c = d[a >> 13];
> +  b = (c << 13) | ((a >> (7 - c)) & 0x1fff);
> +  return b;
> +}
> +
> +int
> +main ()
> +{
> +  union U u;
> +  u.f = 1048575.0f;
> +  if (sizeof (u.i) == sizeof (u.f)
> +      && u.i == 0x4970U
> +      && bar (1.0f) != 65535)
> +    abort ();
> +  return 0;
> +}
> Index: ChangeLog.google-4_6
> ===
> --- ChangeLog.google-4_6        (revision 184667)
> +++ ChangeLog.google-4_6        (working copy)
> @@ -1,3 +1,13 @@
> +2012-03-01   Jing Yu  
> +       Backport r184061 from gcc-4_6-branch to fix PR52060.
> +
> +       2012-02-07  Jakub Jelinek  
> +       PR rtl-optimization/52060
> +       * combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
> +       copy i1src to i1src_copy whenever added_sets_2 && i1_feeds_i2_n
> +       already before i1dest -> i1src substitution in newpat, copy i0src
> +       to i0src_copy and/or i0src_copy2 when needed.
> +
>  2012-02-21   Jing Yu  
>
>        Google Ref 47894
> Index: combine.c
> ===
> --- combine.c   (revision 184667)
> +++ combine.c   (working copy)
> @@ -2551,8 +2551,8 @@
>   rtx i3dest_killed = 0;
>   /* SET_DEST and SET_SRC of I2, I1 and I0.  */
>   rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
> -  /* Copy of SET_SRC of I1, if needed.  */
> -  rtx i1src_copy = 0;
> +  /* Copy

Re: [google][4.6]Bug fix to function reordering plugin to check presence of elf.h

2012-03-01 Thread Jing Yu
I ported this patch into google/gcc-4_6_2-mobile.
Thanks,
Jing

On Sat, Feb 25, 2012 at 1:40 PM, Sriraman Tallam  wrote:
> Committed now, thanks.
>
> -Sri.
>
> On Fri, Feb 24, 2012 at 11:18 PM, Xinliang David Li  
> wrote:
>> ok.
>>
>> David
>>
>> On Fri, Feb 24, 2012 at 4:19 PM, Sriraman Tallam  wrote:
>>> function_reordering_plugin.c includes  which is not available
>>> on non-ELF platforms building a cross-compiler. This patch checks for
>>>  before including it. Otherwise, it redefines the macros used.
>>> This is safe becaue the macros will not change.
>>>
>>> For context, this linker plugin itself is only available in the google
>>> 4_6 branch and I will port it to other branches and make it available
>>> for review for trunk soon.
>>>
>>>
>>> 2012-02-24  Sriraman Tallam  
>>>
>>>        * function_reordering_plugin.c: Check for presence of elf.h.
>>>        Otherwise, redefine the elf macros used.
>>>
>>> Ok to commit?
>>>
>>> Thanks,
>>> -Sri.


Re: [google] Disable getpagesize() for Android toolchain (issue4515131)

2011-05-25 Thread Jing Yu
Hi Joseph,

We notice that gcc starts to build libiberty for target as a multilib
since gcc-4.6, even if we give --disable-stdc++-v3.
Since then, we run into the incompatible getpagesize() error.

I am wondering how to disable build of libiberty for target? I
searched mailing list. One guy said --disable-libiberty controls the
host libiberty, not the target one, another guy said the option
controls both host and target builds.

In some environment we still need to build libstdc++ libraries, where
libiberty has to be built for target. Can we use #ifndef __ANDROID__
to wrap around the getpagesize() definition? It is working for us.

Thanks,
Jing


On Tue, May 24, 2011 at 11:07 AM, Doug Kwan (關振德)  wrote:
> Shouldn't we test
>
> ifndef __ANDROID__
>
> instead?
>
> -Doug
>
> On Tue, May 24, 2011 at 2:39 AM, Guozhi Wei  wrote:
>> Hi
>>
>> This patch is for google/main.
>>
>> In order to be compatible with current bionic and sysroot, we need to disable
>> getpagesize(). After getpagesize() in bionic is changed and ndk contains that
>> change, we can reenable it.
>>
>> Jing can give more details about it.
>>
>> This patch has been tested on arm qemu without regression.
>>
>> thanks
>> Carrot
>>
>> 2011-05-24  Jing Yu  
>>
>>        * ChangeLog.google-main: New file.
>>        * getpagesize.c(getpagesize): Disable it for bionic.
>>
>>
>> Index: ChangeLog.google-main
>> ===
>> --- ChangeLog.google-main       (revision 0)
>> +++ ChangeLog.google-main       (revision 0)
>> @@ -0,0 +1,5 @@
>> +Copyright (C) 2011 Free Software Foundation, Inc.
>> +
>> +Copying and distribution of this file, with or without modification,
>> +are permitted in any medium without royalty provided the copyright
>> +notice and this notice are preserved.
>> Index: getpagesize.c
>> ===
>> --- getpagesize.c       (revision 174099)
>> +++ getpagesize.c       (working copy)
>> @@ -60,11 +60,13 @@ BUGS
>>  # endif /* PAGESIZE */
>>  #endif /* GNU_OUR_PAGESIZE */
>>
>> +#if DEFAULT_LIBC != LIBC_BIONIC
>>  int
>>  getpagesize (void)
>>  {
>>   return (GNU_OUR_PAGESIZE);
>>  }
>> +#endif
>>
>>  #else /* VMS */
>>
>>
>> --
>> This patch is available for review at http://codereview.appspot.com/4515131
>>
>


Re: [google] Disable getpagesize() for Android toolchain (issue4515131)

2011-05-25 Thread Jing Yu
Actually I don't know why in gcc-4.6 libiberty is built for target
when --disable-stdc++-v3 is given. Is libiberty used by other target
libraries now? If not, we can skip libiberty for general Android
toolchain.
But, I still think it would be nice to make libiberty work, in case it
is needed in some cases.

Jing

On Wed, May 25, 2011 at 5:25 PM, Doug Kwan (關振德)  wrote:
> Jing
>
> Can't we just skip libiberty in top-level configure.ac?  Look for the
> comment "Disable target libiberty for some systems."
>
> -Doug
>
> On Wed, May 25, 2011 at 5:17 PM, Jing Yu  wrote:
>> Hi Joseph,
>>
>> We notice that gcc starts to build libiberty for target as a multilib
>> since gcc-4.6, even if we give --disable-stdc++-v3.
>> Since then, we run into the incompatible getpagesize() error.
>>
>> I am wondering how to disable build of libiberty for target? I
>> searched mailing list. One guy said --disable-libiberty controls the
>> host libiberty, not the target one, another guy said the option
>> controls both host and target builds.
>>
>> In some environment we still need to build libstdc++ libraries, where
>> libiberty has to be built for target. Can we use #ifndef __ANDROID__
>> to wrap around the getpagesize() definition? It is working for us.
>>
>> Thanks,
>> Jing
>>
>>
>> On Tue, May 24, 2011 at 11:07 AM, Doug Kwan (關振德)  
>> wrote:
>>> Shouldn't we test
>>>
>>> ifndef __ANDROID__
>>>
>>> instead?
>>>
>>> -Doug
>>>
>>> On Tue, May 24, 2011 at 2:39 AM, Guozhi Wei  wrote:
>>>> Hi
>>>>
>>>> This patch is for google/main.
>>>>
>>>> In order to be compatible with current bionic and sysroot, we need to 
>>>> disable
>>>> getpagesize(). After getpagesize() in bionic is changed and ndk contains 
>>>> that
>>>> change, we can reenable it.
>>>>
>>>> Jing can give more details about it.
>>>>
>>>> This patch has been tested on arm qemu without regression.
>>>>
>>>> thanks
>>>> Carrot
>>>>
>>>> 2011-05-24  Jing Yu  
>>>>
>>>>* ChangeLog.google-main: New file.
>>>>* getpagesize.c(getpagesize): Disable it for bionic.
>>>>
>>>>
>>>> Index: ChangeLog.google-main
>>>> ===
>>>> --- ChangeLog.google-main   (revision 0)
>>>> +++ ChangeLog.google-main   (revision 0)
>>>> @@ -0,0 +1,5 @@
>>>> +Copyright (C) 2011 Free Software Foundation, Inc.
>>>> +
>>>> +Copying and distribution of this file, with or without modification,
>>>> +are permitted in any medium without royalty provided the copyright
>>>> +notice and this notice are preserved.
>>>> Index: getpagesize.c
>>>> ===
>>>> --- getpagesize.c   (revision 174099)
>>>> +++ getpagesize.c   (working copy)
>>>> @@ -60,11 +60,13 @@ BUGS
>>>>  # endif /* PAGESIZE */
>>>>  #endif /* GNU_OUR_PAGESIZE */
>>>>
>>>> +#if DEFAULT_LIBC != LIBC_BIONIC
>>>>  int
>>>>  getpagesize (void)
>>>>  {
>>>>   return (GNU_OUR_PAGESIZE);
>>>>  }
>>>> +#endif
>>>>
>>>>  #else /* VMS */
>>>>
>>>>
>>>> --
>>>> This patch is available for review at http://codereview.appspot.com/4515131
>>>>
>>>
>>
>


Re: [google] Disable getpagesize() for Android toolchain (issue4515131)

2011-05-26 Thread Jing Yu
I have tested the following patch to skip building target libiberty
for arm*-*-linux-androideabi. It works as intended when building
Android arm-linux-androideabi toolchain.

Doug, do we want to skip building libiberty for non arm android
toolchain, say *-linux-android*?

Joseph, do you think if similar patch is possible for trunk? I will
send a separate email for review if this approach is the right way to
go.

Thanks,
Jing

Index: configure.ac
===
--- configure.ac(revision 174299)
+++ configure.ac(working copy)
@@ -515,7 +515,7 @@
   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
-  arm*-*-symbianelf*)
+  arm*-*-symbianelf*|arm*-*-linux-androideabi)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
   avr-*-*)
Index: configure
===
--- configure   (revision 174299)
+++ configure   (working copy)
@@ -3069,7 +3069,7 @@
   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
-  arm*-*-symbianelf*)
+  arm*-*-symbianelf*|arm*-*-linux-androideabi)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
   avr-*-*)




On Thu, May 26, 2011 at 5:00 AM, Joseph S. Myers
 wrote:
> On Wed, 25 May 2011, Jing Yu wrote:
>
>> I am wondering how to disable build of libiberty for target? I
>
> Tear out all the target-libiberty code unconditionally?  See
> <http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01308.html> and references
> therein; building target libiberty at all is a bug in my view.
>
>> In some environment we still need to build libstdc++ libraries, where
>> libiberty has to be built for target. Can we use #ifndef __ANDROID__
>> to wrap around the getpagesize() definition? It is working for us.
>
> See what I said in
> <http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01311.html>.  libstdc++-v3
> does not use target libiberty; it uses one source file from the libiberty
> directory.
>
> --
> Joseph S. Myers
> jos...@codesourcery.com
>


Skip building target libiberty for arm*-*-linux-androideabi

2011-05-27 Thread Jing Yu
 Building gcc-4.6 arm android toolchain fails because of an
incompatible function definition between libiberty and bionic.

Thanking Joseph, I have learned that "there's no such thing as a
target libiberty" and we should rip all the target-libiberty rules
out. I don't know if someone is working on it. Before that patch comes
out, can we add arm*-*-linux-androideabi to the list of targets where
target-libiberty is skipped?

Thanks,
Jing

2011-05-08  Jing Yu  

* configure.ac: Skip target-libiberty for
arm*-*-linux-androideabi.
* configure: Regenerated.

Index: configure.ac
===
--- configure.ac(revision 174364)
+++ configure.ac(working copy)
@@ -515,7 +515,7 @@ case "${target}" in
   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
-  arm*-*-symbianelf*)
+  arm*-*-symbianelf*|arm*-*-linux-androideabi)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
   avr-*-*)
Index: configure
===
--- configure   (revision 174364)
+++ configure   (working copy)
@@ -3069,7 +3069,7 @@ case "${target}" in
   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
-  arm*-*-symbianelf*)
+  arm*-*-symbianelf*|arm*-*-linux-androideabi)
 noconfigdirs="$noconfigdirs target-libiberty"
 ;;
   avr-*-*)


approved but not committed? - [PATCH, ARM] Testcases incorrectly run in Thumb/Xscale

2011-05-27 Thread Jing Yu
Hi Sofiane,

I find your following patch has been approved by Richard in Oct last
year, but it is not trunk.
Is there any problem with it?
http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00266.html

If you don't mind, I can help to commit the patch.

Thanks,
Jing


Re: Skip building target libiberty for arm*-*-linux-androideabi

2011-05-31 Thread Jing Yu
Based on discussion on another thread
(http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg06627.html),
what Joseph recommended was ripping out all support for building
libiberty for the target side as it is not needed. Thus I doubt
skipping target-libiberty for all targets is acceptable.
I don't have the bandwidth to work on the ideal patch. Thus I am
wondering if we can skip target-libiberty for androideabi target
before the ideal patch is out.

Thanks,
Jing

On Sun, May 29, 2011 at 9:23 PM, Ye Joey  wrote:
> On Sat, May 28, 2011 at 5:42 AM, Jing Yu  wrote:
>>
>>  Building gcc-4.6 arm android toolchain fails because of an
>> incompatible function definition between libiberty and bionic.
>>
>> Thanking Joseph, I have learned that "there's no such thing as a
>> target libiberty" and we should rip all the target-libiberty rules
>> out. I don't know if someone is working on it. Before that patch comes
>> out, can we add arm*-*-linux-androideabi to the list of targets where
>> target-libiberty is skipped?
>>
> How about skip libiberty for all targets then?
>
> - Joey


Re: approved but not committed? - [PATCH, ARM] Testcases incorrectly run in Thumb/Xscale

2011-05-31 Thread Jing Yu
Since this patch has been properly approved, if there is no objection
in 24 hours, I will commit this patch to trunk.

Thanks,
Jing

On Fri, May 27, 2011 at 3:55 PM, Jing Yu  wrote:
> Hi Sofiane,
>
> I find your following patch has been approved by Richard in Oct last
> year, but it is not trunk.
> Is there any problem with it?
> http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00266.html
>
> If you don't mind, I can help to commit the patch.
>
> Thanks,
> Jing
>


[google]Skip target-libiberty for arm*-*-linux-androideabi (issue4564050)

2011-05-31 Thread Jing Yu
Building gcc-4.6 arm android toolchain fails because of conflicting
getpagesize() definition between libiberty and bionic.
Based on discussions on another thread
(http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg06627.html),
reviewer recommended ripping out all support for building libiberty
for the target side as it is not needed. However, I don't know if
someone is working on that. Before the ideal patch is out, we have to
clear the blocking issue and make the toolchain built.

The following patch simply skips building target-libiberty for
arm*-*-linux-androideabi target. I have tested the patch by
building arm-linux-androideabi toolchain.

I sent the similar patch to trunk for review. The patch to trunk
is slightly different because this part of configure.ac has been
modified. The logic is the same though.
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02457.html
The review is on going. I am not sure how long it would be.
I would suggest we first commit this tiny patch in google/main and
make our toolchain built. Then do further update if the trunk version is final.

Thanks,
Jing

2011-05-31  Jing Yu  

* configure.ac: Skip target-libiberty for arm*-*-linux-androideabi
* configure: Regenerate

Index: configure.ac
===
--- configure.ac(revision 174299)
+++ configure.ac(working copy)
@@ -682,6 +682,9 @@
 noconfigdirs="$noconfigdirs target-libffi target-qthreads"
 libgloss_dir=arm
 ;;
+  arm*-*-linux-androideabi)
+noconfigdirs="$noconfigdirs target-libiberty"
+;;
   arm*-*-linux-gnueabi)
 noconfigdirs="$noconfigdirs target-qthreads"
 case ${with_newlib} in
Index: configure
===
--- configure   (revision 174299)
+++ configure   (working copy)
@@ -3236,6 +3236,9 @@
 noconfigdirs="$noconfigdirs target-libffi target-qthreads"
 libgloss_dir=arm
 ;;
+  arm*-*-linux-androideabi)
+noconfigdirs="$noconfigdirs target-libiberty"
+;;
   arm*-*-linux-gnueabi)
 noconfigdirs="$noconfigdirs target-qthreads"
 case ${with_newlib} in

--
This patch is available for review at http://codereview.appspot.com/4564050


Re: approved but not committed? - [PATCH, ARM] Testcases incorrectly run in Thumb/Xscale

2011-06-01 Thread Jing Yu
On Wed, Jun 1, 2011 at 1:51 AM, Richard Earnshaw  wrote:
>
> On Tue, 2011-05-31 at 12:49 -0700, Jing Yu wrote:
>> Since this patch has been properly approved, if there is no objection
>> in 24 hours, I will commit this patch to trunk.
>>
>
> Once a patch has been approved by an appropriate maintainer, anybody
> with an account for gcc can commit the patch.

I see. I will commit this patch then.
Thanks!

Jing

>
> R.
>
>> Thanks,
>> Jing
>>
>> On Fri, May 27, 2011 at 3:55 PM, Jing Yu  wrote:
>> > Hi Sofiane,
>> >
>> > I find your following patch has been approved by Richard in Oct last
>> > year, but it is not trunk.
>> > Is there any problem with it?
>> > http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00266.html
>> >
>> > If you don't mind, I can help to commit the patch.
>> >
>> > Thanks,
>> > Jing
>> >
>>
>
>
>


[google]Backport r174549 Fix 3 test cases incorrectly run in Thumb/Xscale (issue4524090)

2011-06-01 Thread Jing Yu
http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00134.html
Backport r174549 to fix three testcases that are specific to ARM mode
and therefore should be skipped when compiling for thumb.

Thanks,
Jing

2011-06-01  Jing Yu  
Backport r174549

2011-06-01  Sofiane Naci  

* gcc.target/arm/mmx-1.c: Skip test in -mthumb.
* gcc.target/arm/g2.c: Skip test in -mthumb.
Skip test unless cpu is xscale.
* gcc.target/arm/scd42-2.c: Likewise.

Index: gcc.target/arm/mmx-1.c
===
--- gcc.target/arm/mmx-1.c  (revision 174299)
+++ gcc.target/arm/mmx-1.c  (working copy)
@@ -4,6 +4,7 @@
 /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { 
"-mcpu=iwmmxt" } } */
 /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { 
"-mabi=iwmmxt" } } */
 /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { 
"-march=iwmmxt" } } */
+/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" 
} } */
 /* { dg-options "-O -mno-apcs-frame -mcpu=iwmmxt -mabi=iwmmxt" } */
 /* { dg-require-effective-target arm32 } */
 /* { dg-require-effective-target arm_iwmmxt_ok } */
Index: gcc.target/arm/g2.c
===
--- gcc.target/arm/g2.c (revision 174299)
+++ gcc.target/arm/g2.c (working copy)
@@ -2,6 +2,8 @@
 /* { dg-do compile } */
 /* { dg-options "-mcpu=xscale -O2" } */
 /* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-march=*" } { 
"-march=xscale" } } */
+/* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-mcpu=*" } { 
"-mcpu=xscale" } } */
+/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" 
} } */
 /* { dg-require-effective-target arm32 } */
 
 /* Brett Gaines' test case. */
Index: gcc.target/arm/scd42-2.c
===
--- gcc.target/arm/scd42-2.c(revision 174299)
+++ gcc.target/arm/scd42-2.c(working copy)
@@ -2,6 +2,8 @@
 /* { dg-do compile } */
 /* { dg-options "-mcpu=xscale -O" } */
 /* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-march=*" } { 
"-march=xscale" } } */
+/* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-mcpu=*" } { 
"-mcpu=xscale" } } */
+/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" 
} } */
 /* { dg-require-effective-target arm32 } */
 
 unsigned load2(void) __attribute__ ((naked));

--
This patch is available for review at http://codereview.appspot.com/4524090


Ping:Re: Skip building target libiberty for arm*-*-linux-androideabi

2011-06-03 Thread Jing Yu
Ping.
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02208.html

On Tue, May 31, 2011 at 11:32 AM, Jing Yu  wrote:
> Based on discussion on another thread
> (http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg06627.html),
> what Joseph recommended was ripping out all support for building
> libiberty for the target side as it is not needed. Thus I doubt
> skipping target-libiberty for all targets is acceptable.
> I don't have the bandwidth to work on the ideal patch. Thus I am
> wondering if we can skip target-libiberty for androideabi target
> before the ideal patch is out.
>
> Thanks,
> Jing
>
> On Sun, May 29, 2011 at 9:23 PM, Ye Joey  wrote:
>> On Sat, May 28, 2011 at 5:42 AM, Jing Yu  wrote:
>>>
>>>  Building gcc-4.6 arm android toolchain fails because of an
>>> incompatible function definition between libiberty and bionic.
>>>
>>> Thanking Joseph, I have learned that "there's no such thing as a
>>> target libiberty" and we should rip all the target-libiberty rules
>>> out. I don't know if someone is working on it. Before that patch comes
>>> out, can we add arm*-*-linux-androideabi to the list of targets where
>>> target-libiberty is skipped?
>>>
>> How about skip libiberty for all targets then?
>>
>> - Joey
>


Re: Ping:Re: Skip building target libiberty for arm*-*-linux-androideabi

2011-06-03 Thread Jing Yu
ARM maintainers,

Is it ok to skip building target-libiberty for arm*-*-linux-androideabi target?
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02208.html

Thanks,
Jing

On Fri, Jun 3, 2011 at 11:26 AM, DJ Delorie  wrote:
>
>> Ping.
>> http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02208.html
>>
>> > I don't have the bandwidth to work on the ideal patch. Thus I am
>> > wondering if we can skip target-libiberty for androideabi target
>> > before the ideal patch is out.
>
> Target-specific changes in the build are up to the target maintainers.
>


Re: [google] Handle NULL return values in setlocale calls (issue4444046)

2011-04-16 Thread Jing Yu
Thanks Diego for committing this patch.

Yes, I would like to submit the patch to trunk. The reason is for this
patch is that setlocale() in bionicC always returns NULL (bionicC does
not support setlocale()), however libstdc++ does not handle the NULL
return value of setlocale(xxx,NULL) and thus causes segmentation
fault.

Thanks,
Jing

On Sat, Apr 16, 2011 at 1:20 PM, Diego Novillo  wrote:
> I'm committing this patch for Jing Yu on google/main.
>
> The patch handles NULL values returned from setlocale.  Jing, could
> you please describe why this was needed?  Is this a patch that you
> will want to submit for trunk?
>
> Tested on x86_64.  Committed to google/main.
>
>
> Diego.
>
> 2011-04-15  Jing Yu  
>
>        Google ref 46499.
>
>        * config/locale/generic/c_locale.cc (__convert_to_v): Handle
>        NULL return value from setlocale.
>        * config/locale/generic/c_locale.h (__convert_from_v): Likewise.
>        * config/locale/generic/time_members.cc (_M_put): Likewise.
>
> diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc 
> b/libstdc++-v3/config/locale/generic/c_locale.cc
> index fb9b425..7e34fcf 100644
> --- a/libstdc++-v3/config/locale/generic/c_locale.cc
> +++ b/libstdc++-v3/config/locale/generic/c_locale.cc
> @@ -52,10 +52,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     {
>       // Assumes __s formatted for "C" locale.
>       char* __old = setlocale(LC_ALL, 0);
> -      const size_t __len = strlen(__old) + 1;
> -      char* __sav = new char[__len];
> -      memcpy(__sav, __old, __len);
> -      setlocale(LC_ALL, "C");
> +      char* __sav = NULL;
> +      if (__old != NULL)
> +        {
> +          const size_t __len = strlen(__old) + 1;
> +          __sav = new char[__len];
> +          memcpy(__sav, __old, __len);
> +          setlocale(LC_ALL, "C");
> +        }
>       char* __sanity;
>       bool __overflow = false;
>
> @@ -117,10 +121,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     {
>       // Assumes __s formatted for "C" locale.
>       char* __old = setlocale(LC_ALL, 0);
> -      const size_t __len = strlen(__old) + 1;
> -      char* __sav = new char[__len];
> -      memcpy(__sav, __old, __len);
> -      setlocale(LC_ALL, "C");
> +      char* __sav = NULL;
> +      if (__old != NULL)
> +        {
> +          const size_t __len = strlen(__old) + 1;
> +          __sav = new char[__len];
> +          memcpy(__sav, __old, __len);
> +          setlocale(LC_ALL, "C");
> +        }
>       char* __sanity;
>
>  #if !__DBL_HAS_INFINITY__
> @@ -162,10 +170,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     {
>       // Assumes __s formatted for "C" locale.
>       char* __old = setlocale(LC_ALL, 0);
> -      const size_t __len = strlen(__old) + 1;
> -      char* __sav = new char[__len];
> -      memcpy(__sav, __old, __len);
> -      setlocale(LC_ALL, "C");
> +      char* __sav = NULL;
> +      if (__old != NULL)
> +        {
> +          const size_t __len = strlen(__old) + 1;
> +          __sav = new char[__len];
> +          memcpy(__sav, __old, __len);
> +          setlocale(LC_ALL, "C");
> +        }
>
>  #if !__LDBL_HAS_INFINITY__
>       errno = 0;
> diff --git a/libstdc++-v3/config/locale/generic/c_locale.h 
> b/libstdc++-v3/config/locale/generic/c_locale.h
> index 2c76000..6e6f673 100644
> --- a/libstdc++-v3/config/locale/generic/c_locale.h
> +++ b/libstdc++-v3/config/locale/generic/c_locale.h
> @@ -60,7 +60,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>   {
>     char* __old = std::setlocale(LC_NUMERIC, 0);
>     char* __sav = 0;
> -    if (__builtin_strcmp(__old, "C"))
> +    if (__old != NULL && __builtin_strcmp(__old, "C"))
>       {
>        const size_t __len = __builtin_strlen(__old) + 1;
>        __sav = new char[__len];
> diff --git a/libstdc++-v3/config/locale/generic/time_members.cc 
> b/libstdc++-v3/config/locale/generic/time_members.cc
> index 3031075..fb9eb6e 100644
> --- a/libstdc++-v3/config/locale/generic/time_members.cc
> +++ b/libstdc++-v3/config/locale/generic/time_members.cc
> @@ -45,10 +45,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>           const tm* __tm) const throw()
>     {
>       char* __old = setlocale(LC_ALL, 0);
> -      const size_t __llen = strlen(__old) + 1;
> -      char* __sav = new char[__llen];
> -      memcpy(__sav, __old, __llen);
> -      setlocale(LC_ALL, _M_name_timepunct);
> +      char* __sav = NULL;
> +      if (__old != NULL)
> +        {
> +          const size_t __llen = strlen(__old) + 1;
> +          __sav = new char[__llen];
> +          memcpy(__sav, __old, __llen);
>