-
Bug
-
Resolution: Fixed
-
P3
-
OpenJDK6, 7
-
b01
-
x86
-
linux, linux_2.6
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2177158 | 7 | Xiaobin Lu | P3 | Closed | Fixed | b31 |
JDK-2172094 | 6u10 | Xiaobin Lu | P3 | Closed | Fixed | b27 |
JDK-2163632 | OpenJDK6 | Xiaobin Lu | P3 | Closed | Fixed | b11 |
JDK-2164300 | hs11 | Xiaobin Lu | P3 | Closed | Fixed | b14 |
I tried compiling openjdk6 b08 on ubuntu 8.04. The default compiler is gcc 4.2.x. The following
does not occur on ubuntu 7.10 where the default gcc is 4.1.x.
Some hotspot files fail to compile due to warnings. The default hotspot makefiles use
the -Werror flag, making warnings into errors and the build fails. The warnings are
about type conversion of strings to constants.
The obvious workaround is to edit the hotspot makefile to not use -Werror. This works.
I also made the following source changes and had a successful compile. The idea is to
in some cases change some declarations to use "const char *" instead of "char *"
and in other cases cast string constants to "char *" depending on the context.
--- ./hotspot/src/share/vm/opto/escape-orig.cpp 2008-03-24 14:42:12.000000000 -0700
+++ ./hotspot/src/share/vm/opto/escape.cpp 2008-03-24 14:45:09.000000000 -0700
@@ -54,21 +54,21 @@
}
#ifndef PRODUCT
-static char *node_type_names[] = {
+static const char *node_type_names[] = {
"UnknownType",
"JavaObject",
"LocalVar",
"Field"
};
-static char *esc_names[] = {
+static const char *esc_names[] = {
"UnknownEscape",
"NoEscape ",
"ArgEscape ",
"GlobalEscape "
};
-static char *edge_type_suffix[] = {
+static const char *edge_type_suffix[] = {
"?", // UnknownEdge
"P", // PointsToEdge
"D", // DeferredEdge
--- ./hotspot/src/share/vm/ci/ciMethodBlocks-orig.cpp 2008-03-24 14:39:19.000000000 -0700
+++ ./hotspot/src/share/vm/ci/ciMethodBlocks.cpp 2008-03-24 14:40:06.000000000 -0700
@@ -321,7 +321,7 @@
}
#ifndef PRODUCT
-static char *flagnames[] = {
+static const char *flagnames[] = {
"Processed",
"Handler",
"MayThrow",
--- ./hotspot/src/os/linux/vm/jvm_linux-orig.cpp 2008-03-24 14:01:55.000000000 -0700
+++ ./hotspot/src/os/linux/vm/jvm_linux.cpp 2008-03-24 14:02:07.000000000 -0700
@@ -135,7 +135,7 @@
*/
struct siglabel {
- char *name;
+ const char *name;
int number;
};
--- ./hotspot/src/os/linux/vm/vmError_linux-orig.cpp 2008-03-24 14:25:17.000000000 -0700
+++ ./hotspot/src/os/linux/vm/vmError_linux.cpp 2008-03-24 14:26:01.000000000 -0700
@@ -50,8 +50,8 @@
// doesn't block SIGINT et al.
int VMError::fork_and_exec(char* cmd) {
char * argv[4];
- argv[0] = "sh";
- argv[1] = "-c";
+ argv[0] = (char *)"sh";
+ argv[1] = (char *)"-c";
argv[2] = cmd;
argv[3] = NULL;
does not occur on ubuntu 7.10 where the default gcc is 4.1.x.
Some hotspot files fail to compile due to warnings. The default hotspot makefiles use
the -Werror flag, making warnings into errors and the build fails. The warnings are
about type conversion of strings to constants.
The obvious workaround is to edit the hotspot makefile to not use -Werror. This works.
I also made the following source changes and had a successful compile. The idea is to
in some cases change some declarations to use "const char *" instead of "char *"
and in other cases cast string constants to "char *" depending on the context.
--- ./hotspot/src/share/vm/opto/escape-orig.cpp 2008-03-24 14:42:12.000000000 -0700
+++ ./hotspot/src/share/vm/opto/escape.cpp 2008-03-24 14:45:09.000000000 -0700
@@ -54,21 +54,21 @@
}
#ifndef PRODUCT
-static char *node_type_names[] = {
+static const char *node_type_names[] = {
"UnknownType",
"JavaObject",
"LocalVar",
"Field"
};
-static char *esc_names[] = {
+static const char *esc_names[] = {
"UnknownEscape",
"NoEscape ",
"ArgEscape ",
"GlobalEscape "
};
-static char *edge_type_suffix[] = {
+static const char *edge_type_suffix[] = {
"?", // UnknownEdge
"P", // PointsToEdge
"D", // DeferredEdge
--- ./hotspot/src/share/vm/ci/ciMethodBlocks-orig.cpp 2008-03-24 14:39:19.000000000 -0700
+++ ./hotspot/src/share/vm/ci/ciMethodBlocks.cpp 2008-03-24 14:40:06.000000000 -0700
@@ -321,7 +321,7 @@
}
#ifndef PRODUCT
-static char *flagnames[] = {
+static const char *flagnames[] = {
"Processed",
"Handler",
"MayThrow",
--- ./hotspot/src/os/linux/vm/jvm_linux-orig.cpp 2008-03-24 14:01:55.000000000 -0700
+++ ./hotspot/src/os/linux/vm/jvm_linux.cpp 2008-03-24 14:02:07.000000000 -0700
@@ -135,7 +135,7 @@
*/
struct siglabel {
- char *name;
+ const char *name;
int number;
};
--- ./hotspot/src/os/linux/vm/vmError_linux-orig.cpp 2008-03-24 14:25:17.000000000 -0700
+++ ./hotspot/src/os/linux/vm/vmError_linux.cpp 2008-03-24 14:26:01.000000000 -0700
@@ -50,8 +50,8 @@
// doesn't block SIGINT et al.
int VMError::fork_and_exec(char* cmd) {
char * argv[4];
- argv[0] = "sh";
- argv[1] = "-c";
+ argv[0] = (char *)"sh";
+ argv[1] = (char *)"-c";
argv[2] = cmd;
argv[3] = NULL;
- backported by
-
JDK-2163632 hotspot build failure on gcc 4.2.x (ubuntu 8.04) w/ openjdk6
- Closed
-
JDK-2164300 hotspot build failure on gcc 4.2.x (ubuntu 8.04) w/ openjdk6
- Closed
-
JDK-2172094 hotspot build failure on gcc 4.2.x (ubuntu 8.04) w/ openjdk6
- Closed
-
JDK-2177158 hotspot build failure on gcc 4.2.x (ubuntu 8.04) w/ openjdk6
- Closed
- duplicates
-
JDK-6625327 usage of unsafe literal string conversion to 'char *' breaks the build on Linux with GCC 4.2
- Closed
- relates to
-
JDK-6752407 (audit) apply HSX-11 fix for 6681796 to HSX-12 and HSX-13
- Closed
(1 relates to)