public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj
@ 2011-06-01 15:56 licheng.1212 at gmail dot com
  2011-06-01 16:08 ` [Bug java/49258] " licheng.1212 at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: licheng.1212 at gmail dot com @ 2011-06-01 15:56 UTC (permalink / raw)
  To: java-prs

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

           Summary: -ffunction-sections and --gc-sectinons have no effect
                    at gcj
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: java
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: licheng.1212@gmail.com


there is many dead code at java source,and the gcj can't remove it.
I hava been add the function-sections and gc-sections to the compiler flags.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
@ 2011-06-01 16:08 ` licheng.1212 at gmail dot com
  2011-12-31  0:05 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: licheng.1212 at gmail dot com @ 2011-06-01 16:08 UTC (permalink / raw)
  To: java-prs

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|major                       |blocker


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
  2011-06-01 16:08 ` [Bug java/49258] " licheng.1212 at gmail dot com
@ 2011-12-31  0:05 ` pinskia at gcc dot gnu.org
  2012-04-07  7:54 ` licheng.1212 at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-31  0:05 UTC (permalink / raw)
  To: java-prs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-12-31
     Ever Confirmed|0                           |1
           Severity|blocker                     |normal

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-31 00:05:14 UTC ---
>there is many dead code at java source,and the gcj can't remove it.

But Java is a dynamic language so the vtable will reference most of it.

Can you provide an example of where you think a dead function is not being
removed?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
  2011-06-01 16:08 ` [Bug java/49258] " licheng.1212 at gmail dot com
  2011-12-31  0:05 ` pinskia at gcc dot gnu.org
@ 2012-04-07  7:54 ` licheng.1212 at gmail dot com
  2012-04-07  8:50 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: licheng.1212 at gmail dot com @ 2012-04-07  7:54 UTC (permalink / raw)
  To: java-prs

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)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
                   ` (2 preceding siblings ...)
  2012-04-07  7:54 ` licheng.1212 at gmail dot com
@ 2012-04-07  8:50 ` pinskia at gcc dot gnu.org
  2012-04-07  9:02 ` licheng.1212 at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-04-07  8:50 UTC (permalink / raw)
  To: java-prs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID
           Severity|blocker                     |normal

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-04-07 08:50:03 UTC ---
There is nothing to be done here since notused is used from the vtable for the
class.

"objdump -d hello" does not show the vtables.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
                   ` (3 preceding siblings ...)
  2012-04-07  8:50 ` pinskia at gcc dot gnu.org
@ 2012-04-07  9:02 ` licheng.1212 at gmail dot com
  2012-04-07 12:11 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: licheng.1212 at gmail dot com @ 2012-04-07  9:02 UTC (permalink / raw)
  To: java-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |WAITING
         Resolution|INVALID                     |
           Severity|normal                      |blocker

--- Comment #4 from licheng.1212 at gmail dot com <licheng.1212 at gmail dot com> 2012-04-07 09:02:38 UTC ---
(In reply to comment #3)
> There is nothing to be done here since notused is used from the vtable for the
> class.
> 
> "objdump -d hello" does not show the vtables.

Yes,but why we can't remove the function notused() form vtable, since this
function will never used.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
                   ` (4 preceding siblings ...)
  2012-04-07  9:02 ` licheng.1212 at gmail dot com
@ 2012-04-07 12:11 ` schwab@linux-m68k.org
  2012-04-07 18:09 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2012-04-07 12:11 UTC (permalink / raw)
  To: java-prs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
                   ` (5 preceding siblings ...)
  2012-04-07 12:11 ` schwab@linux-m68k.org
@ 2012-04-07 18:09 ` pinskia at gcc dot gnu.org
  2012-04-09 11:15 ` licheng.1212 at gmail dot com
  2012-04-09 19:41 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-04-07 18:09 UTC (permalink / raw)
  To: java-prs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-04-07 18:08:21 UTC ---
(In reply to comment #4)
> Yes,but why we can't remove the function notused() form vtable, since this
> function will never used.

How can you tell?  Without the full exectuable and knowing the entry point,
there is no way (-fwhole-program can help but it becomes a turning machine at
that point).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
                   ` (6 preceding siblings ...)
  2012-04-07 18:09 ` pinskia at gcc dot gnu.org
@ 2012-04-09 11:15 ` licheng.1212 at gmail dot com
  2012-04-09 19:41 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: licheng.1212 at gmail dot com @ 2012-04-09 11:15 UTC (permalink / raw)
  To: java-prs

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

--- Comment #6 from licheng.1212 at gmail dot com <licheng.1212 at gmail dot com> 2012-04-09 11:14:56 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > Yes,but why we can't remove the function notused() form vtable, since this
> > function will never used.
> 
> How can you tell?  Without the full exectuable and knowing the entry point,
> there is no way (-fwhole-program can help but it becomes a turning machine at
> that point).

class hello{
    public void notused()
    {
        System.out.println("not used");
    }
    public static void main(String argv[])
    {
        System.out.println("Hello");    
    }
}

this is a full execlutable program,and it hava only one entry point "main"!

and i test a c++ file,it will remove the unused funcitons "notused":
[licheng@Soft04 ~]$ cat hello.cpp 
#include <iostream>

class hello
{
public:
        hello()
        {
        }
        void notused()
        {
                std::cout << "not used";
        }
        void used()
        {
                std::cout << "used";
        }
        ~hello()
        {
        }
}hi;

int main()
{       hello t;
        t.used();
        return 0;
}
[licheng@Soft04 ~]$


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug java/49258] -ffunction-sections and --gc-sectinons have no effect at gcj
  2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
                   ` (7 preceding siblings ...)
  2012-04-09 11:15 ` licheng.1212 at gmail dot com
@ 2012-04-09 19:41 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-04-09 19:41 UTC (permalink / raw)
  To: java-prs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-04-09 19:40:41 UTC ---
(In reply to comment #6)
> and i test a c++ file,it will remove the unused funcitons "notused":

But that is not the same as there is no vtable for hello.
Try:
#include <iostream>

class hello
{
public:
        hello()
        {
        }
        virtual void notused()
        {
                std::cout << "not used";
        }
        virtual void used()
        {
                std::cout << "used";
        }
        virtual ~hello()
        {
        }
}hi;

int main()
{       hello t;
        t.used();
        return 0;
}

And see the result.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-04-09 19:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 15:56 [Bug java/49258] New: -ffunction-sections and --gc-sectinons have no effect at gcj licheng.1212 at gmail dot com
2011-06-01 16:08 ` [Bug java/49258] " licheng.1212 at gmail dot com
2011-12-31  0:05 ` pinskia at gcc dot gnu.org
2012-04-07  7:54 ` licheng.1212 at gmail dot com
2012-04-07  8:50 ` pinskia at gcc dot gnu.org
2012-04-07  9:02 ` licheng.1212 at gmail dot com
2012-04-07 12:11 ` schwab@linux-m68k.org
2012-04-07 18:09 ` pinskia at gcc dot gnu.org
2012-04-09 11:15 ` licheng.1212 at gmail dot com
2012-04-09 19:41 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).