Bug 26007 - initialized final static data should go in .rodata, not .data
Summary: initialized final static data should go in .rodata, not .data
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-28 20:36 UTC by Anthony Green
Modified: 2011-05-17 16:12 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-31 17:31:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Green 2006-01-28 20:36:39 UTC
For the following code...

public class b
{
  public static final int FOOBAR = 555;
}

..I would expect to see FOOBAR in .rodata.  However gcj currently places this in .data.

If you poke through the .jar.so files we have in Fedora Core you'll see big chunks of .data that should actually .rodata.
Comment 1 Andrew Pinski 2006-01-28 20:38:25 UTC
Note there are ticks for final static data to be changed IIRC.  I don't know how useful they are or if they really are valid.
Comment 2 David Daney 2006-01-31 17:31:09 UTC
If you fix this, you need to also make sure the Method.set* never modifies the data under any circumstances.  Attempts at modification will result in SIGSEGV which is usually converted to NPE.  The real exception should probably be IllegalAccessException if modification is attempted.
Comment 3 licheng.1212@gmail.com 2011-05-17 15:47:32 UTC
(In reply to comment #1)
> Note there are ticks for final static data to be changed IIRC.  I don't know
> how useful they are or if they really are valid.

put it to .rodata is very useful to embebed system,this will release many memory useage.
Comment 4 licheng.1212@gmail.com 2011-05-17 16:12:07 UTC
can anybody tell me how to change the final form .data to .rodata.
which files have the check in gcc?