8239563: Reduce public exports in dynamic libraries built from JDK static libraries
Reviewed-by: dholmes, ihse
This commit is contained in:
parent
9e9f110d05
commit
c17ed6a5e5
@ -697,7 +697,10 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
|
|||||||
# JDK libraries.
|
# JDK libraries.
|
||||||
STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
|
STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
|
||||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||||
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections"
|
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections \
|
||||||
|
-DJNIEXPORT='__attribute__((visibility(\"hidden\")))'"
|
||||||
|
else
|
||||||
|
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -DJNIEXPORT="
|
||||||
fi
|
fi
|
||||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||||
# Disable relax-relocation to enable compatibility with older linkers
|
# Disable relax-relocation to enable compatibility with older linkers
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,16 +29,26 @@
|
|||||||
#ifndef __has_attribute
|
#ifndef __has_attribute
|
||||||
#define __has_attribute(x) 0
|
#define __has_attribute(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef JNIEXPORT
|
||||||
#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
|
#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
|
||||||
#ifdef ARM
|
#ifdef ARM
|
||||||
#define JNIEXPORT __attribute__((externally_visible,visibility("default")))
|
#define JNIEXPORT __attribute__((externally_visible,visibility("default")))
|
||||||
#define JNIIMPORT __attribute__((externally_visible,visibility("default")))
|
|
||||||
#else
|
#else
|
||||||
#define JNIEXPORT __attribute__((visibility("default")))
|
#define JNIEXPORT __attribute__((visibility("default")))
|
||||||
#define JNIIMPORT __attribute__((visibility("default")))
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define JNIEXPORT
|
#define JNIEXPORT
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
|
||||||
|
#ifdef ARM
|
||||||
|
#define JNIIMPORT __attribute__((externally_visible,visibility("default")))
|
||||||
|
#else
|
||||||
|
#define JNIIMPORT __attribute__((visibility("default")))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
#define JNIIMPORT
|
#define JNIIMPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,9 @@
|
|||||||
#ifndef _JAVASOFT_JNI_MD_H_
|
#ifndef _JAVASOFT_JNI_MD_H_
|
||||||
#define _JAVASOFT_JNI_MD_H_
|
#define _JAVASOFT_JNI_MD_H_
|
||||||
|
|
||||||
|
#ifndef JNIEXPORT
|
||||||
#define JNIEXPORT __declspec(dllexport)
|
#define JNIEXPORT __declspec(dllexport)
|
||||||
|
#endif
|
||||||
#define JNIIMPORT __declspec(dllimport)
|
#define JNIIMPORT __declspec(dllimport)
|
||||||
#define JNICALL __stdcall
|
#define JNICALL __stdcall
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user