This commit is contained in:
Jakub Jelinek 2007-03-27 15:39:46 +00:00
parent 9cc4671e57
commit 1b4610da54
4 changed files with 124 additions and 6 deletions

View File

@ -1 +1 @@
gcc-4.1.2-20070317.tar.bz2
gcc-4.1.2-20070327.tar.bz2

View File

@ -0,0 +1,106 @@
2007-03-23 Andrew Haley <aph@redhat.com>
* jvgenmain.c (main): Change main to use class$, not class$$.
(do_mangle_classname): Likewise.
* class.c (hide): New function.
(add_field): Hide everything that shouldn't be visible outside a
DSO.
(build_static_class_ref): Likewise.
(build_classdollar_field): Likewise.
(make_class_data): Likewise.
(layout_class_method): Likewise.
--- gcc/java/class.c (revision 123084)
+++ gcc/java/class.c (working copy)
@@ -691,6 +691,13 @@
return fntype;
}
+static void
+hide (tree decl)
+{
+ DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
+ DECL_VISIBILITY_SPECIFIED (decl) = 1;
+}
+
tree
add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
{
@@ -801,6 +808,10 @@
/* Always make field externally visible. This is required so
that native methods can always access the field. */
TREE_PUBLIC (field) = 1;
+ /* Hide everything that shouldn't be visible outside a DSO. */
+ if (flag_indirect_classes
+ || (FIELD_PRIVATE (field)))
+ hide (field);
/* Considered external unless we are compiling it into this
object file. */
DECL_EXTERNAL (field) = (is_compiled_class (class) != 2);
@@ -958,7 +969,11 @@
decl = build_decl (VAR_DECL, decl_name, class_type_node);
TREE_STATIC (decl) = 1;
if (! flag_indirect_classes)
- TREE_PUBLIC (decl) = 1;
+ {
+ TREE_PUBLIC (decl) = 1;
+ if (CLASS_PRIVATE (TYPE_NAME (type)))
+ hide (decl);
+ }
DECL_IGNORED_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
if (is_compiled_class (type) == 1)
@@ -997,6 +1012,7 @@
TREE_CONSTANT (decl) = 1;
TREE_READONLY (decl) = 1;
TREE_PUBLIC (decl) = 1;
+ hide (decl);
DECL_IGNORED_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
@@ -1684,6 +1700,10 @@
TREE_PUBLIC (dtable_decl) = 1;
DECL_INITIAL (dtable_decl) = dtable;
+ /* The only dispatch table exported from a DSO is the dispatch
+ table for java.lang.Class. */
+ if (DECL_NAME (type_decl) != id_class)
+ hide (dtable_decl);
if (! flag_indirect_classes)
rest_of_decl_compilation (dtable_decl, 1, 0);
/* Maybe we're compiling Class as the first class. If so, set
@@ -2553,6 +2573,10 @@
TREE_PUBLIC (method_decl) = 1;
+ if (flag_indirect_classes
+ || (METHOD_PRIVATE (method_decl) && METHOD_STATIC (method_decl)))
+ hide (method_decl);
+
/* Considered external unless it is being compiled into this object
file, or it was already flagged as external. */
if (!DECL_EXTERNAL (method_decl))
--- gcc/java/jvgenmain.c (revision 123084)
+++ gcc/java/jvgenmain.c (working copy)
@@ -143,8 +143,8 @@
fprintf (stream, " JvRunMainName (\"%s\", argc, argv);\n", classname);
else
{
- fprintf (stream, " extern void *%s;\n", mangled_classname);
- fprintf (stream, " JvRunMain (%s, argc, argv);\n", mangled_classname);
+ fprintf (stream, " extern char %s;\n", mangled_classname);
+ fprintf (stream, " JvRunMain (&%s, argc, argv);\n", mangled_classname);
}
fprintf (stream, "}\n");
if (stream != stdout && fclose (stream) != 0)
@@ -176,7 +176,7 @@
count++;
}
append_gpp_mangled_name (&ptr [-count], count);
- obstack_grow (mangle_obstack, "7class$$E", strlen ("7class$$E"));
+ obstack_grow (mangle_obstack, "6class$E", strlen ("6class$E"));
obstack_1grow (mangle_obstack, '\0');
return obstack_finish (mangle_obstack);
}

View File

@ -1,6 +1,6 @@
%define DATE 20070317
%define DATE 20070327
%define gcc_version 4.1.2
%define gcc_release 5
%define gcc_release 6
%define _unpackaged_files_terminate_build 0
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%define include_gappletviewer 1
@ -141,8 +141,10 @@ Patch29: gcc41-pr30113.patch
Patch30: gcc41-rh228769.patch
Patch31: gcc41-pr30045.patch
Patch32: gcc41-rh227376.patch
Patch33: gcc41-rh231134.patch
Patch33: gcc41-pr30863.patch
Patch34: gcc41-java-bogus-debugline.patch
Patch35: gcc41-libffi-selinux.patch
Patch36: gcc41-libjava-visibility.patch
%define _gnu %{nil}
%ifarch sparc
%define gcc_target_platform sparc64-%{_vendor}-%{_target_os}
@ -451,8 +453,10 @@ which are required to run programs compiled with the GNAT.
%patch30 -p0 -b .rh228769~
%patch31 -p0 -b .pr30045~
%patch32 -p0 -b .rh227376~
%patch33 -p0 -b .rh231134~
%patch33 -p0 -b .pr30863~
%patch34 -p0 -b .java-bogus-debugline~
%patch35 -p0 -b .libffi-selinux~
%patch36 -p0 -b .libjava-visibility~
sed -i -e 's/4\.1\.3/4.1.2/' gcc/BASE-VER gcc/version.c
sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@ -1575,6 +1579,14 @@ fi
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
%changelog
* Tue Mar 27 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-6
- update from gcc-4_1-branch (-r123011:123245)
- PRs fortran/31184, target/31245, tree-optimization/30590
- libjava W^X support (Alexandre Oliva, #202209)
- fix gcjh -jni and gjavah -cni (Stepan Kasal, #233349)
- fix C++ accepts invalid bug (Mark Mitchell, PR c++/30863)
- use hidden visibility for Java private methods (Andrew Haley)
* Sat Mar 17 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-5
- update from gcc-4_1-branch (-r122833:123011)
- PRs debug/29906, middle-end/30364, middle-end/30433, target/31123

View File

@ -1 +1 @@
37b9ba44114c5c5905f8f176010d263f gcc-4.1.2-20070317.tar.bz2
52e0d3ac7387126916b31fe65d188d9c gcc-4.1.2-20070327.tar.bz2