[Bug libstdc++/35597] libstdc++ -ffunction-sections -fdata-sections disabled on AIX

brian at dessent dot net gcc-bugzilla@gcc.gnu.org
Thu Mar 20 22:20:00 GMT 2008



------- Comment #4 from brian at dessent dot net  2008-03-20 22:19 -------
Subject: Re:  libstdc++ -ffunction-sections -fdata-sections 
 disabled on AIX

bkoz at gcc dot gnu dot org wrote:

> Question to me is, what is the behavior on cygwin? Does -ffunction-sections -g
> work? Does it warn?

Yes it warns, and yes this warning needs to die.  I see no problem
debugging with -ffunction-sections on Cygwin:

$ cat <<EOF >tc.c

int func1 (int a)
{
  return a + 1;
}

int func2 (int a)
{
  return a + 1;
}

int func3 (int a)
{
  return a + 1;
}

int func4 (int a)
{
  return a + 1;
}

int func5 (int a)
{
  return a + 1;
}

int func6 (int a)
{
  return a + 1;
}

int func7 (int a)
{
  return a + 1;
}

int func8 (int a)
{
  return a + 1;
}

int main (int argc, char **argv)
{
  return func5 (func6 (func7 (func8 (argc)))) * 
         func4 (func3 (func2 (func1 (argc))));
}
EOF

$ gcc -ggdb3 -ffunction-sections -fdata-sections -c tc.c -o tc.o
tc.c:1: warning: -ffunction-sections may affect debugging on some
targets

$ objdump -h tc.o | egrep '\.text'
  0 .text         00000000  00000000  00000000  00000000  2**4
  7 .text$func1   0000000c  00000000  00000000  00000e8b  2**2
  8 .text$func2   0000000c  00000000  00000000  00000e97  2**2
  9 .text$func3   0000000c  00000000  00000000  00000ea3  2**2
 10 .text$func4   0000000c  00000000  00000000  00000eaf  2**2
 11 .text$func5   0000000c  00000000  00000000  00000ebb  2**2
 12 .text$func6   0000000c  00000000  00000000  00000ec7  2**2
 13 .text$func7   0000000c  00000000  00000000  00000ed3  2**2
 14 .text$func8   0000000c  00000000  00000000  00000edf  2**2
 15 .text$main    00000080  00000000  00000000  00000eeb  2**2

$ gcc tc.o -o tc

$ gdb --quiet tc
(gdb) start
Breakpoint 1 at 0x4013c6: file tc.c, line 43.
[New thread 3064.0xee4]
[New thread 3064.0x19a4]
main (argc=1, argv=0x6aa1a8) at tc.c:43
43      {
(gdb) rbreak func[1-8]
Breakpoint 2 at 0x401343: file tc.c, line 4.
int func1(int);
Breakpoint 3 at 0x40134f: file tc.c, line 9.
int func2(int);
Breakpoint 4 at 0x40135b: file tc.c, line 14.
int func3(int);
Breakpoint 5 at 0x401367: file tc.c, line 19.
int func4(int);
Breakpoint 6 at 0x401373: file tc.c, line 24.
int func5(int);
Breakpoint 7 at 0x40137f: file tc.c, line 29.
int func6(int);
Breakpoint 8 at 0x40138b: file tc.c, line 34.
int func7(int);
Breakpoint 9 at 0x401397: file tc.c, line 39.
int func8(int);
(gdb) disp/i $pc
(gdb) c

Breakpoint 9, func8 (a=1) at tc.c:39
39        return a + 1;
1: x/i $pc
0x401397 <func8+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 8, func7 (a=2) at tc.c:34
34        return a + 1;
1: x/i $pc
0x40138b <func7+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 7, func6 (a=3) at tc.c:29
29        return a + 1;
1: x/i $pc
0x40137f <func6+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 6, func5 (a=4) at tc.c:24
24        return a + 1;
1: x/i $pc
0x401373 <func5+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 2, func1 (a=1) at tc.c:4
4         return a + 1;
1: x/i $pc
0x401343 <func1+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 3, func2 (a=2) at tc.c:9
9         return a + 1;
1: x/i $pc
0x40134f <func2+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 4, func3 (a=3) at tc.c:14
14        return a + 1;
1: x/i $pc
0x40135b <func3+3>:     mov    0x8(%ebp),%eax
(gdb)

Breakpoint 5, func4 (a=4) at tc.c:19
19        return a + 1;
1: x/i $pc
0x401367 <func4+3>:     mov    0x8(%ebp),%eax
(gdb)

Program exited with code 014400.
(gdb) quit


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35597



More information about the Gcc-bugs mailing list