Re: [PATCH] gcc: explicitly use CFLAGS_FOR_TARGET instead of --enable-target-optspace

2014-07-14 Thread Alexey Brodkin
Hi Carmelo,


On Mon, 2014-07-14 at 15:47 +0200, Carmelo Amoroso wrote:
> Hello Alexey,
> I guess you sent it to the wrong list.
> 
> You need to send to buildroot team.
> 
> Regards,
> Carmelo

Ooops my bad.
Re-sent to buildroot list.

Thanks for pointing at it.

Regards,
Alexey
___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


Re: [PATCH] gcc: explicitly use CFLAGS_FOR_TARGET instead of --enable-target-optspace

2014-07-14 Thread Carmelo Amoroso

Hello Alexey,
I guess you sent it to the wrong list.

You need to send to buildroot team.

Regards,
Carmelo

On 7/11/2014 6:31 PM, Alexey Brodkin wrote:

Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id= it's impossible
to specify custom CFLAGS_FOR_TARGET, it is always gets overriden with values
from "config/mt-ospace":
===
  CFLAGS_FOR_TARGET = -g -Os
  CXXFLAGS_FOR_TARGET = -g -Os
===

But in some situations it's required to pass custom flags on buildong of libgcc:
  * Default flags "-g -Os" lead to build isses as with PowerPC on gcc 4.5
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810)
  * Particular CPU requires specific instructions for HW support
  * Deep optimizations

Tested by toolchain building for ARC, ARM and PowerPC with GCC 4.5

Signed-off-by: Alexey Brodkin 

Cc: Anton Kolesov 
Cc: Thomas Petazzoni 
Cc: Peter Korsgaard 
Cc: Gustavo Zacarias 
---
  package/gcc/gcc-intermediate/gcc-intermediate.mk | 13 +
  package/gcc/gcc.mk   | 10 --
  2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/package/gcc/gcc-intermediate/gcc-intermediate.mk 
b/package/gcc/gcc-intermediate/gcc-intermediate.mk
index db84d18..0543574 100644
--- a/package/gcc/gcc-intermediate/gcc-intermediate.mk
+++ b/package/gcc/gcc-intermediate/gcc-intermediate.mk
@@ -46,4 +46,17 @@ ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
  HOST_GCC_INTERMEDIATE_INSTALL_OPT += install-target-libgcc
  endif

+ifeq ($(ARCH),powerpc)
+ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
+   # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810
+   # Workaround until it's fixed in 4.5.4 or later
+   HOST_GCC_INTERMEDIATE_CONF_ENV += CFLAGS_FOR_TARGET="-g -O2"
+   HOST_GCC_INTERMEDIATE_CONF_ENV += CXXFLAGS_FOR_TARGET="-g -O2"
+endif
+else
+   # Defaults are "-g -Os" from "config/mt-ospace"
+   HOST_GCC_INTERMEDIATE_CONF_ENV += CFLAGS_FOR_TARGET="-g -Os"
+   HOST_GCC_INTERMEDIATE_CONF_ENV += CXXFLAGS_FOR_TARGET="-g -Os"
+endif
+
  $(eval $(host-autotools-package))
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 5b60bc3..c6f6e41 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -107,16 +107,6 @@ HOST_GCC_COMMON_CONF_OPT = \
  HOST_GCC_COMMON_CONF_ENV = \
MAKEINFO=missing

-# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810
-# Workaround until it's fixed in 4.5.4 or later
-ifeq ($(ARCH),powerpc)
-ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
-HOST_GCC_COMMON_CONF_OPT += --disable-target-optspace
-endif
-else
-HOST_GCC_COMMON_CONF_OPT += --enable-target-optspace
-endif
-
  # gcc 4.6.x quadmath requires wchar
  ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
  HOST_GCC_COMMON_CONF_OPT += --disable-libquadmath



___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


Segment fault while calling vfork

2014-07-14 Thread Qi Li
Hi all,

I am developing openwrt on ARMv7, and the "vfork" function in popen sometimes 
cause segfault.
I have traced with gdb, but I can't find the root cause.
However, I doubt the problem is related with uClibc.

The function call chain in my test is as follows:
Netifd (main.c:335) --> netifd_init_script_handlers (handler.c:133) --> 
proto_shell_add_handler (handler.c:93) --> popen (libc/stdio/popen.c:72) --> 
vfork 
(libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S:71)
  -->  SAVE_PID (and segfault here)

And following is my gdb debug trace flow.

(gdb) target remote 192.168.1.1
192.168.1.1: No such file or directory.
(gdb) target remote 192.168.1.1:1234
Remote debugging using 192.168.1.1:1234
Reading symbols from 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/root-mmp/lib/ld-uClibc.so.0...(no
 debugging symbols found)...done.
Loaded symbols for 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/root-mmp/lib/ld-uClibc.so.0
0xb6ff1e38 in _start ()
   from 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/root-mmp/lib/ld-uClibc.so.0

..
step or next and continue operations, until I get into popen.
..

(gdb) where
#0  0xb6f6a960 in popen (command=0x6 , 
command@entry=0xbefffc68 "./3g.sh '' dump",
modes=modes@entry=0x1c37d "r") at libc/stdio/popen.c:72
#1  0xb544 in netifd_parse_script_handler (name=0x37688 "./3g.sh",
cb=cb@entry=0x113ac )
at 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/netifd-2014-05-10/handler.c:93
#2  0xb74c in netifd_init_script_handlers (dir_fd=, 
cb=0x113ac )
at 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/netifd-2014-05-10/handler.c:133
#3  0xa8c4 in main (argc=1, argv=)
at 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/netifd-2014-05-10/main.c:335

..
"next" to vfork, and then the segment comes in following stepi.
..

(gdb) next
90  if ((pid = vfork()) == 0) { /* Child of vfork... */
(gdb) stepi
vfork () at 
libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S:71
71  SAVE_PID
(gdb) l
66
67 #else
68 __vfork:
69
70 #ifdef __NR_vfork
71  SAVE_PID
72  DO_CALL (vfork)
73  RESTORE_PID
74  cmn r0, #4096
75  IT(t, cc)
(gdb) disassemble
Dump of assembler code for function vfork:
=> 0xb6f7bf50 <+0>:push  {lr} ; (str lr, [sp, #-4]!)
   0xb6f7bf54 <+4>:   mvn r0, #61440; 0xf000
   0xb6f7bf58 <+8>:   mov lr, pc
   0xb6f7bf5c <+12>: sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0

(gdb) stepi
0xb6f7bf54   71  SAVE_PID
(gdb) disassemble
Dump of assembler code for function vfork:
   0xb6f7bf50 <+0>:   push  {lr} ; (str lr, [sp, #-4]!)
=> 0xb6f7bf54 <+4>:mvn r0, #61440; 0xf000
   0xb6f7bf58 <+8>:   mov lr, pc
   0xb6f7bf5c <+12>: sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0
   0xb6f7bf68 <+24>: ldrr3, [r2, #-964]  ; 0x3c4

(gdb) stepi
0xb6f7bf58   71  SAVE_PID
(gdb) disassemble
Dump of assembler code for function vfork:
   0xb6f7bf50 <+0>:   push  {lr} ; (str lr, [sp, #-4]!)
   0xb6f7bf54 <+4>:   mvn r0, #61440; 0xf000
=> 0xb6f7bf58 <+8>:mov lr, pc
   0xb6f7bf5c <+12>: sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0
   0xb6f7bf68 <+24>: ldrr3, [r2, #-964]  ; 0x3c4

(gdb) stepi
0xb6f7bf5c   71  SAVE_PID
(gdb) disassemble
Dump of assembler code for function vfork:
   0xb6f7bf50 <+0>:   push  {lr} ; (str lr, [sp, #-4]!)
   0xb6f7bf54 <+4>:   mvn r0, #61440; 0xf000
   0xb6f7bf58 <+8>:   mov lr, pc
=> 0xb6f7bf5c <+12>:  sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0
   0xb6f7bf68 <+24>: ldrr3, [r2, #-964]  ; 0x3c4

(gdb) stepi

Program received signal SIGSEGV, Segmentation fault.
0x0fe0 in ?? ()

Has anyone encountered with this problem? any sort of help will be much 
appreaciated.
Thanks.

Qi

___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


fork segfault

2014-07-14 Thread Qi Li
Hi all,

I am developing openwrt on ARMv7, and the "vfork" function in popen sometimes 
cause segfault.
I have traced with gdb, but I can't find the root cause.
However, I doubt the problem is related with uClibc.

The function call chain in my test is as follows:
Netifd (main.c:335) --> netifd_init_script_handlers (handler.c:133) --> 
proto_shell_add_handler (handler.c:93) --> popen (libc/stdio/popen.c:72) --> 
vfork 
(libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S:71)
  -->  SAVE_PID (and segfault here)

And following is my gdb debug trace flow.

(gdb) target remote 192.168.1.1
192.168.1.1: No such file or directory.
(gdb) target remote 192.168.1.1:1234
Remote debugging using 192.168.1.1:1234
Reading symbols from 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/root-mmp/lib/ld-uClibc.so.0...(no
 debugging symbols found)...done.
Loaded symbols for 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/root-mmp/lib/ld-uClibc.so.0
0xb6ff1e38 in _start ()
   from 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/root-mmp/lib/ld-uClibc.so.0

..
step or next and continue operations, until I get into popen.
..

(gdb) where
#0  0xb6f6a960 in popen (command=0x6 , 
command@entry=0xbefffc68 "./3g.sh '' dump",
modes=modes@entry=0x1c37d "r") at libc/stdio/popen.c:72
#1  0xb544 in netifd_parse_script_handler (name=0x37688 "./3g.sh",
cb=cb@entry=0x113ac )
at 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/netifd-2014-05-10/handler.c:93
#2  0xb74c in netifd_init_script_handlers (dir_fd=, 
cb=0x113ac )
at 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/netifd-2014-05-10/handler.c:133
#3  0xa8c4 in main (argc=1, argv=)
at 
/home/qi/work/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_uClibc-0.9.33.2_eabi/netifd-2014-05-10/main.c:335

..
"next" to vfork, and then the segment comes in following stepi.
..

(gdb) next
90  if ((pid = vfork()) == 0) { /* Child of vfork... */
(gdb) stepi
vfork () at 
libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S:71
71  SAVE_PID
(gdb) l
66
67 #else
68 __vfork:
69
70 #ifdef __NR_vfork
71  SAVE_PID
72  DO_CALL (vfork)
73  RESTORE_PID
74  cmn r0, #4096
75  IT(t, cc)
(gdb) disassemble
Dump of assembler code for function vfork:
=> 0xb6f7bf50 <+0>:push  {lr} ; (str lr, [sp, #-4]!)
   0xb6f7bf54 <+4>:   mvn r0, #61440; 0xf000
   0xb6f7bf58 <+8>:   mov lr, pc
   0xb6f7bf5c <+12>: sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0

(gdb) stepi
0xb6f7bf54   71  SAVE_PID
(gdb) disassemble
Dump of assembler code for function vfork:
   0xb6f7bf50 <+0>:   push  {lr} ; (str lr, [sp, #-4]!)
=> 0xb6f7bf54 <+4>:mvn r0, #61440; 0xf000
   0xb6f7bf58 <+8>:   mov lr, pc
   0xb6f7bf5c <+12>: sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0
   0xb6f7bf68 <+24>: ldrr3, [r2, #-964]  ; 0x3c4

(gdb) stepi
0xb6f7bf58   71  SAVE_PID
(gdb) disassemble
Dump of assembler code for function vfork:
   0xb6f7bf50 <+0>:   push  {lr} ; (str lr, [sp, #-4]!)
   0xb6f7bf54 <+4>:   mvn r0, #61440; 0xf000
=> 0xb6f7bf58 <+8>:mov lr, pc
   0xb6f7bf5c <+12>: sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0
   0xb6f7bf68 <+24>: ldrr3, [r2, #-964]  ; 0x3c4

(gdb) stepi
0xb6f7bf5c   71  SAVE_PID
(gdb) disassemble
Dump of assembler code for function vfork:
   0xb6f7bf50 <+0>:   push  {lr} ; (str lr, [sp, #-4]!)
   0xb6f7bf54 <+4>:   mvn r0, #61440; 0xf000
   0xb6f7bf58 <+8>:   mov lr, pc
=> 0xb6f7bf5c <+12>:  sub   pc, r0, #31
   0xb6f7bf60 <+16>: pop  {lr} ; (ldr lr, [sp], #4)
   0xb6f7bf64 <+20>: mov r2, r0
   0xb6f7bf68 <+24>: ldrr3, [r2, #-964]  ; 0x3c4

(gdb) stepi

Program received signal SIGSEGV, Segmentation fault.
0x0fe0 in ?? ()

Has anyone encountered with this problem? any sort of help will be much 
appreaciated.
Thanks.

Qi


___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc