author | pchelko |
Wed, 23 Apr 2014 17:56:05 +0400 | |
changeset 24529 | c580bcb3aabc |
parent 22597 | 7515a991bb37 |
permissions | -rw-r--r-- |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
1 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
2 |
* Copyright 2012, 2013 SAP AG. All rights reserved. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
4 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
8 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
13 |
* accompanied this code). |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
14 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
18 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
21 |
* questions. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
22 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
23 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
24 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
25 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
26 |
* Header file to contain porting-relevant code which does not have a |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
27 |
* home anywhere else. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
28 |
* This is intially based on hotspot/src/os/aix/vm/{loadlib,porting}_aix.{hpp,cpp} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
29 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
30 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
31 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
32 |
* Aix' own version of dladdr(). |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
33 |
* This function tries to mimick dladdr(3) on Linux |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
34 |
* (see http://linux.die.net/man/3/dladdr) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
35 |
* dladdr(3) is not POSIX but a GNU extension, and is not available on AIX. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
36 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
37 |
* Differences between AIX dladdr and Linux dladdr: |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
38 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
39 |
* 1) Dl_info.dli_fbase: can never work, is disabled. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
40 |
* A loaded image on AIX is divided in multiple segments, at least two |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
41 |
* (text and data) but potentially also far more. This is because the loader may |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
42 |
* load each member into an own segment, as for instance happens with the libC.a |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
43 |
* 2) Dl_info.dli_sname: This only works for code symbols (functions); for data, a |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
44 |
* zero-length string is returned (""). |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
45 |
* 3) Dl_info.dli_saddr: For code, this will return the entry point of the function, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
46 |
* not the function descriptor. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
47 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
48 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
49 |
typedef struct { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
50 |
const char *dli_fname; /* file path of loaded library */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
51 |
void *dli_fbase; /* doesn't make sence on AIX */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
52 |
const char *dli_sname; /* symbol name; "" if not known */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
53 |
void *dli_saddr; /* address of *entry* of function; not function descriptor; */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
54 |
} Dl_info; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
55 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
56 |
#ifdef __cplusplus |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
57 |
extern "C" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
58 |
#endif |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
59 |
int dladdr(void *addr, Dl_info *info); |