[Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj

licheng.1212 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Apr 7 07:54:00 GMT 2012


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

licheng.1212@gmail.com <licheng.1212 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker

--- Comment #2 from licheng.1212 at gmail dot com <licheng.1212 at gmail dot com> 2012-04-07 07:53:34 UTC ---
[licheng@rda ~]$ cat hello.java 
class hello{
    public void notused()
    {
        System.out.println("not used");
    }
    public static void main(String argv[])
    {
        System.out.println("Hello");    
    }
}
[licheng@rda ~]$ gcj --main=hello  hello.java -o hello -ffunction-sections
-Wl,--gc-sections,--print-gc-sections
/usr/bin/ld: Removing unused section '.rodata' in file
'/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../crt1.o'
/usr/bin/ld: Removing unused section '.rodata' in file
'/usr/lib/gcc/i686-redhat-linux/4.6.3/crtbegin.o'
[licheng@rda ~]$ ./hello 
Hello
[licheng@rda ~]$ objdump -d hello > hello.asm
[licheng@rda ~]$ cat hello.asm | grep notused -C 5
 8048866:    e8 a5 fe ff ff           call   8048710
<_ZN4java4lang6ObjectC1Ev@plt>
 804886b:    c9                       leave  
 804886c:    c3                       ret    
 804886d:    90                       nop

0804886e <_ZN5hello7notusedEJvv>:
 804886e:    55                       push   %ebp
 804886f:    89 e5                    mov    %esp,%ebp
 8048871:    53                       push   %ebx
 8048872:    83 ec 24                 sub    $0x24,%esp
 8048875:    bb 00 00 00 00           mov    $0x0,%ebx
 804887a:    84 db                    test   %bl,%bl
 804887c:    75 0c                    jne    804888a
<_ZN5hello7notusedEJvv+0x1c>
 804887e:    c7 04 24 c0 9e 04 08     movl   $0x8049ec0,(%esp)
 8048885:    e8 46 fe ff ff           call   80486d0 <_Jv_InitClass@plt>
 804888a:    a1 a0 9e 04 08           mov    0x8049ea0,%eax
 804888f:    89 45 f4                 mov    %eax,-0xc(%ebp)
 8048892:    8b 45 f4                 mov    -0xc(%ebp),%eax
[licheng@rda ~]$ 

my gcj version is gcj (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)



More information about the Java-prs mailing list