Skip to content

Commit 8f4ed4d

Browse files
committed
fix incorrect EXPORT definition for Windows/x86_64 in boot-javahome.cpp
We should define EXPORT to be __declspec(dllexport) on Windows regardless of architecture, not just non-x86_64 arches. This fixes errors to to embedded JAVA_HOME files not being found in openjdk-src builds, e.g. lib/currency.data.
1 parent f7614bf commit 8f4ed4d

File tree

3 files changed

+9
-42
lines changed

3 files changed

+9
-42
lines changed

src/boot-javahome.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@
88
There is NO WARRANTY for this software. See license.txt for
99
details. */
1010

11-
#ifdef _MSC_VER
12-
13-
typedef unsigned char uint8_t;
14-
15-
#else
16-
# include "stdint.h"
17-
#endif
11+
#include "avian/common.h"
1812

1913
#ifdef BOOT_JAVAHOME
2014

2115
#if (! defined __x86_64__) && ((defined __MINGW32__) || (defined _MSC_VER))
22-
# define EXPORT __declspec(dllexport)
2316
# define SYMBOL(x) binary_javahome_jar_##x
2417
#else
25-
# define EXPORT __attribute__ ((visibility("default"))) \
26-
__attribute__ ((used))
2718
# define SYMBOL(x) _binary_javahome_jar_##x
2819
#endif
2920

@@ -32,7 +23,7 @@ extern "C" {
3223
extern const uint8_t SYMBOL(start)[];
3324
extern const uint8_t SYMBOL(end)[];
3425

35-
EXPORT const uint8_t*
26+
AVIAN_EXPORT const uint8_t*
3627
javahomeJar(unsigned* size)
3728
{
3829
*size = SYMBOL(end) - SYMBOL(start);

src/boot.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,14 @@
88
There is NO WARRANTY for this software. See license.txt for
99
details. */
1010

11-
#include "stdlib.h"
11+
#include <stdlib.h>
1212

13-
#ifdef _MSC_VER
14-
15-
typedef unsigned char uint8_t;
16-
17-
#else // not _MSC_VER
18-
19-
# include "stdint.h"
13+
#include "avian/common.h"
2014

2115
// since we aren't linking against libstdc++, we must implement this
2216
// ourselves:
2317
extern "C" void __cxa_pure_virtual(void) { abort(); }
2418

25-
#endif // not _MSC_VER
26-
27-
#if (defined __MINGW32__) || (defined _MSC_VER)
28-
# define EXPORT __declspec(dllexport)
29-
#else
30-
# define EXPORT __attribute__ ((visibility("default"))) \
31-
__attribute__ ((used))
32-
#endif
33-
3419
#ifdef BOOT_IMAGE
3520

3621
#if (! defined __x86_64__) && ((defined __MINGW32__) || (defined _MSC_VER))
@@ -46,7 +31,7 @@ extern "C" {
4631
extern const uint8_t BOOTIMAGE_SYMBOL(start)[];
4732
extern const uint8_t BOOTIMAGE_SYMBOL(end)[];
4833

49-
EXPORT const uint8_t*
34+
AVIAN_EXPORT const uint8_t*
5035
bootimageBin(unsigned* size)
5136
{
5237
*size = BOOTIMAGE_SYMBOL(end) - BOOTIMAGE_SYMBOL(start);
@@ -56,7 +41,7 @@ extern "C" {
5641
extern const uint8_t CODEIMAGE_SYMBOL(start)[];
5742
extern const uint8_t CODEIMAGE_SYMBOL(end)[];
5843

59-
EXPORT const uint8_t*
44+
AVIAN_EXPORT const uint8_t*
6045
codeimageBin(unsigned* size)
6146
{
6247
*size = CODEIMAGE_SYMBOL(end) - CODEIMAGE_SYMBOL(start);
@@ -82,7 +67,7 @@ extern "C" {
8267
extern const uint8_t SYMBOL(start)[];
8368
extern const uint8_t SYMBOL(end)[];
8469

85-
EXPORT const uint8_t*
70+
AVIAN_EXPORT const uint8_t*
8671
classpathJar(unsigned* size)
8772
{
8873
*size = SYMBOL(end) - SYMBOL(start);

src/embedded-loader.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,15 @@
1313
#include <stdint.h>
1414

1515
#include "avian/embed.h"
16+
#include "avian/common.h"
1617
#include "jni.h"
1718

18-
#if (defined __MINGW32__) || (defined _MSC_VER)
19-
# define EXPORT __declspec(dllexport)
20-
# ifdef _MSC_VER
21-
# define not !
22-
# endif
23-
#else
24-
# define EXPORT __attribute__ ((visibility("default"))) \
25-
__attribute__ ((used))
26-
#endif
27-
2819
extern "C" {
2920
// since we aren't linking against libstdc++, we must implement this
3021
// ourselves:
3122
void __cxa_pure_virtual(void) { abort(); }
3223

33-
EXPORT const uint8_t*
24+
AVIAN_EXPORT const uint8_t*
3425
bootJar(unsigned* size)
3526
{
3627
if(HRSRC hResInfo = FindResourceW(NULL, RESID_BOOT_JAR, reinterpret_cast<LPCWSTR>(RT_RCDATA)))

0 commit comments

Comments
 (0)