Use termux patches

This commit is contained in:
khanhduytran0 2020-09-16 06:28:15 +07:00
parent bb01bff739
commit 54bec9973f
33 changed files with 251 additions and 75017 deletions

View File

@ -3,3 +3,5 @@ set -e
hg clone http://hg.openjdk.java.net/mobile/jdk9 openjdk
cd openjdk
bash ./get_source.sh
hg import ../termux-openjdk-aarch64-patches/*.patch

File diff suppressed because it is too large Load Diff

View File

@ -1,727 +0,0 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
// no precompiled headers
#include "asm/macroAssembler.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
#include "code/vtableStubs.hpp"
#include "code/nativeInst.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm_linux.h"
#include "memory/allocation.inline.hpp"
#include "os_share_linux.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm.h"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/osThread.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/timer.hpp"
#include "utilities/events.hpp"
#include "utilities/vmError.hpp"
#ifdef BUILTIN_SIM
#include "../../../../../../simulator/simulator.hpp"
#endif
// put OS-includes here
# include <sys/types.h>
# include <sys/mman.h>
# include <pthread.h>
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>
# include <pthread.h>
# include <sys/stat.h>
# include <sys/time.h>
# include <sys/utsname.h>
# include <sys/socket.h>
# include <sys/wait.h>
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
#ifndef __ANDROID__
# include <fpu_control.h>
#endif
#ifdef BUILTIN_SIM
#define REG_SP REG_RSP
#define REG_PC REG_RIP
#define REG_FP REG_RBP
#define SPELL_REG_SP "rsp"
#define SPELL_REG_FP "rbp"
#else
#define REG_FP 29
#define REG_LR 30
#define SPELL_REG_SP "sp"
#define SPELL_REG_FP "x29"
#endif
address os::current_stack_pointer() {
register void *esp __asm__ (SPELL_REG_SP);
return (address) esp;
}
char* os::non_memory_address_word() {
// Must never look like an address returned by reserve_memory,
// even in its subfields (as defined by the CPU immediate fields,
// if the CPU splits constants across multiple instructions).
return (char*) 0xffffffffffff;
}
void os::initialize_thread(Thread *thr) {
}
address os::Linux::ucontext_get_pc(const ucontext_t * uc) {
#ifdef BUILTIN_SIM
return (address)uc->uc_mcontext.gregs[REG_PC];
#else
return (address)uc->uc_mcontext.pc;
#endif
}
void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
#ifdef BUILTIN_SIM
uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc;
#else
uc->uc_mcontext.pc = (intptr_t)pc;
#endif
}
intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
#ifdef BUILTIN_SIM
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
#else
return (intptr_t*)uc->uc_mcontext.sp;
#endif
}
intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
#ifdef BUILTIN_SIM
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
#else
return (intptr_t*)uc->uc_mcontext.regs[REG_FP];
#endif
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
// is currently interrupted by SIGPROF.
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
// frames. Currently we don't do that on Linux, so it's the same as
// os::fetch_frame_from_context().
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp != NULL, "just checking");
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
return epc;
}
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
}
bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
address pc = (address) os::Linux::ucontext_get_pc(uc);
if (Interpreter::contains(pc)) {
// interpreter performs stack banging after the fixed frame header has
// been generated while the compilers perform it before. To maintain
// semantic consistency between interpreted and compiled frames, the
// method returns the Java sender of the current frame.
*fr = os::fetch_frame_from_context(uc);
if (!fr->is_first_java_frame()) {
assert(fr->safe_for_sender(thread), "Safety check");
*fr = fr->java_sender();
}
} else {
// more complex code with compiled code
assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above");
CodeBlob* cb = CodeCache::find_blob(pc);
if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) {
// Not sure where the pc points to, fallback to default
// stack overflow handling
return false;
} else {
// In compiled code, the stack banging is performed before LR
// has been saved in the frame. LR is live, and SP and FP
// belong to the caller.
intptr_t* fp = os::Linux::ucontext_get_fp(uc);
intptr_t* sp = os::Linux::ucontext_get_sp(uc);
address pc = (address)(uc->uc_mcontext.regs[REG_LR]
- NativeInstruction::instruction_size);
*fr = frame(sp, fp, pc);
if (!fr->is_java_frame()) {
assert(fr->safe_for_sender(thread), "Safety check");
assert(!fr->is_first_frame(), "Safety check");
*fr = fr->java_sender();
}
}
}
assert(fr->is_java_frame(), "Safety check");
return true;
}
// By default, gcc always saves frame pointer rfp on this stack. This
// may get turned off by -fomit-frame-pointer.
frame os::get_sender_for_C_frame(frame* fr) {
#ifdef BUILTIN_SIM
return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
#else
return frame(fr->link(), fr->link(), fr->sender_pc());
#endif
}
intptr_t* _get_previous_fp() {
register intptr_t **ebp __asm__ (SPELL_REG_FP);
return (intptr_t*) *ebp; // we want what it points to.
}
frame os::current_frame() {
intptr_t* fp = _get_previous_fp();
frame myframe((intptr_t*)os::current_stack_pointer(),
(intptr_t*)fp,
CAST_FROM_FN_PTR(address, os::current_frame));
if (os::is_first_C_frame(&myframe)) {
// stack is not walkable
return frame();
} else {
return os::get_sender_for_C_frame(&myframe);
}
}
// Utility functions
// From IA32 System Programming Guide
enum {
trap_page_fault = 0xE
};
#ifdef BUILTIN_SIM
extern "C" void Fetch32PFI () ;
extern "C" void Fetch32Resume () ;
extern "C" void FetchNPFI () ;
extern "C" void FetchNResume () ;
#endif
extern "C" JNIEXPORT int
JVM_handle_linux_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
ucontext_t* uc = (ucontext_t*) ucVoid;
Thread* t = Thread::current_or_null_safe();
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
// (no destructors can be run)
os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
SignalHandlerMark shm(t);
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.
if (sig == SIGPIPE || sig == SIGXFSZ) {
// allow chained handler to go first
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
} else {
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}
JavaThread* thread = NULL;
VMThread* vmthread = NULL;
if (os::Linux::signal_handlers_are_installed) {
if (t != NULL ){
if(t->is_Java_thread()) {
thread = (JavaThread*)t;
}
else if(t->is_VM_thread()){
vmthread = (VMThread *)t;
}
}
}
/*
NOTE: does not seem to work on linux.
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
// can't decode this kind of signal
info = NULL;
} else {
assert(sig == info->si_signo, "bad siginfo");
}
*/
// decide if this trap can be handled by a stub
address stub = NULL;
address pc = NULL;
//%note os_trap_1
if (info != NULL && uc != NULL && thread != NULL) {
pc = (address) os::Linux::ucontext_get_pc(uc);
#ifdef BUILTIN_SIM
if (pc == (address) Fetch32PFI) {
uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ;
return 1 ;
}
if (pc == (address) FetchNPFI) {
uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ;
return 1 ;
}
#else
if (StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
#endif
// Handle ALL stack overflow variations here
if (sig == SIGSEGV) {
address addr = (address) info->si_addr;
// check if fault address is within thread stack
if (thread->on_local_stack(addr)) {
// stack overflow
if (thread->in_stack_yellow_reserved_zone(addr)) {
thread->disable_stack_yellow_reserved_zone();
if (thread->thread_state() == _thread_in_Java) {
if (thread->in_stack_reserved_zone(addr)) {
frame fr;
if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) {
assert(fr.is_java_frame(), "Must be a Java frame");
frame activation =
SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);
if (activation.sp() != NULL) {
thread->disable_stack_reserved_zone();
if (activation.is_interpreted_frame()) {
thread->set_reserved_stack_activation((address)(
activation.fp() + frame::interpreter_frame_initial_sp_offset));
} else {
thread->set_reserved_stack_activation((address)activation.unextended_sp());
}
return 1;
}
}
}
// Throw a stack overflow exception. Guard pages will be reenabled
// while unwinding the stack.
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
} else {
// Thread was in the vm or native code. Return and try to finish.
return 1;
}
} else if (thread->in_stack_red_zone(addr)) {
// Fatal red zone violation. Disable the guard pages and fall through
// to handle_unexpected_exception way down below.
thread->disable_stack_red_zone();
tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
// This is a likely cause, but hard to verify. Let's just print
// it as a hint.
tty->print_raw_cr("Please check if any of your loaded .so files has "
"enabled executable stack (see man page execstack(8))");
} else {
// Accessing stack address below sp may cause SEGV if current
// thread has MAP_GROWSDOWN stack. This should only happen when
// current thread was created by user code with MAP_GROWSDOWN flag
// and then attached to VM. See notes in os_linux.cpp.
if (thread->osthread()->expanding_stack() == 0) {
thread->osthread()->set_expanding_stack();
if (os::Linux::manually_expand_stack(thread, addr)) {
thread->osthread()->clear_expanding_stack();
return 1;
}
thread->osthread()->clear_expanding_stack();
} else {
fatal("recursive segv. expanding stack.");
}
}
}
}
if (thread->thread_state() == _thread_in_Java) {
// Java thread running in Java code => find exception handler if any
// a fault inside compiled code, the interpreter, or a stub
// Handle signal from NativeJump::patch_verified_entry().
if ((sig == SIGILL || sig == SIGTRAP)
&& nativeInstruction_at(pc)->is_sigill_zombie_not_entrant()) {
if (TraceTraps) {
tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
}
stub = SharedRuntime::get_handle_wrong_method_stub();
} else if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) {
stub = SharedRuntime::get_poll_stub(pc);
} else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
// BugId 4454115: A read from a MappedByteBuffer can fault
// here if the underlying file has been truncated.
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
address next_pc = pc + NativeCall::instruction_size;
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
else
if (sig == SIGFPE &&
(info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
stub =
SharedRuntime::
continuation_for_implicit_exception(thread,
pc,
SharedRuntime::
IMPLICIT_DIVIDE_BY_ZERO);
} else if (sig == SIGSEGV &&
!MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
// Determination of interpreter/vtable stub/compiled code null exception
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
}
} else if (thread->thread_state() == _thread_in_vm &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
address next_pc = pc + NativeCall::instruction_size;
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
// jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
// and the heap gets shrunk before the field access.
if ((sig == SIGSEGV) || (sig == SIGBUS)) {
address addr = JNI_FastGetField::find_slowcase_pc(pc);
if (addr != (address)-1) {
stub = addr;
}
}
// Check to see if we caught the safepoint code in the
// process of write protecting the memory serialization page.
// It write enables the page immediately after protecting it
// so we can just return to retry the write.
if ((sig == SIGSEGV) &&
os::is_memory_serialize_page(thread, (address) info->si_addr)) {
// Block current thread until the memory serialize page permission restored.
os::block_on_serialize_page_trap();
return true;
}
}
if (stub != NULL) {
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
os::Linux::ucontext_set_pc(uc, stub);
return true;
}
// signal-chaining
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
}
if (!abort_if_unrecognized) {
// caller wants another chance, so give it to him
return false;
}
if (pc == NULL && uc != NULL) {
pc = os::Linux::ucontext_get_pc(uc);
}
// unmask current signal
sigset_t newset;
sigemptyset(&newset);
sigaddset(&newset, sig);
sigprocmask(SIG_UNBLOCK, &newset, NULL);
VMError::report_and_die(t, sig, pc, info, ucVoid);
ShouldNotReachHere();
return true; // Mute compiler
}
void os::Linux::init_thread_fpu_state(void) {
}
int os::Linux::get_fpu_control_word(void) {
return 0;
}
void os::Linux::set_fpu_control_word(int fpu_control) {
}
// Check that the linux kernel version is 2.4 or higher since earlier
// versions do not support SSE without patches.
bool os::supports_sse() {
return true;
}
bool os::is_allocatable(size_t bytes) {
return true;
}
////////////////////////////////////////////////////////////////////////////////
// thread stack
// Minimum usable stack sizes required to get to user code. Space for
// HotSpot guard pages is added later.
size_t os::Posix::_compiler_thread_min_stack_allowed = 72 * K;
size_t os::Posix::_java_thread_min_stack_allowed = 72 * K;
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 72 * K;
// return default stack size for thr_type
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
// default stack size (compiler thread needs larger stack)
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
return s;
}
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Registers:");
#ifdef BUILTIN_SIM
st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]);
st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]);
st->cr();
st->print( "RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]);
st->print(", RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]);
st->print(", RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]);
st->print(", RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]);
st->cr();
st->print( "R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]);
st->print(", R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]);
st->print(", R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]);
st->print(", R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]);
st->cr();
st->print( "R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]);
st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]);
st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]);
st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]);
st->cr();
st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]);
st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]);
st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]);
st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]);
st->cr();
st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]);
st->cr();
#else
for (int r = 0; r < 31; r++) {
st->print("R%-2d=", r);
print_location(st, uc->uc_mcontext.regs[r]);
}
#endif
st->cr();
intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t));
st->cr();
// Note: it may be unsafe to inspect memory near pc. For example, pc may
// point to garbage if entry point in an nmethod is corrupted. Leave
// this at the end, and hope for the best.
address pc = os::Linux::ucontext_get_pc(uc);
st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Register to memory mapping:");
st->cr();
// this is horrendously verbose but the layout of the registers in the
// context does not match how we defined our abstract Register set, so
// we can't just iterate through the gregs area
// this is only for the "general purpose" registers
#ifdef BUILTIN_SIM
st->print("RAX="); print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
st->print("RBX="); print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
st->print("RCX="); print_location(st, uc->uc_mcontext.gregs[REG_RCX]);
st->print("RDX="); print_location(st, uc->uc_mcontext.gregs[REG_RDX]);
st->print("RSP="); print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
st->print("RBP="); print_location(st, uc->uc_mcontext.gregs[REG_RBP]);
st->print("RSI="); print_location(st, uc->uc_mcontext.gregs[REG_RSI]);
st->print("RDI="); print_location(st, uc->uc_mcontext.gregs[REG_RDI]);
st->print("R8 ="); print_location(st, uc->uc_mcontext.gregs[REG_R8]);
st->print("R9 ="); print_location(st, uc->uc_mcontext.gregs[REG_R9]);
st->print("R10="); print_location(st, uc->uc_mcontext.gregs[REG_R10]);
st->print("R11="); print_location(st, uc->uc_mcontext.gregs[REG_R11]);
st->print("R12="); print_location(st, uc->uc_mcontext.gregs[REG_R12]);
st->print("R13="); print_location(st, uc->uc_mcontext.gregs[REG_R13]);
st->print("R14="); print_location(st, uc->uc_mcontext.gregs[REG_R14]);
st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]);
#else
for (int r = 0; r < 31; r++)
st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.regs[r]);
#endif
st->cr();
}
void os::setup_fpu() {
}
#ifndef PRODUCT
void os::verify_stack_alignment() {
assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
}
#endif
int os::extra_bang_size_in_bytes() {
// AArch64 does not require the additional stack bang.
return 0;
}
extern "C" {
int SpinPause() {
return 0;
}
void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
if (from > to) {
jshort *end = from + count;
while (from < end)
*(to++) = *(from++);
}
else if (from < to) {
jshort *end = from;
from += count - 1;
to += count - 1;
while (from >= end)
*(to--) = *(from--);
}
}
void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
if (from > to) {
jint *end = from + count;
while (from < end)
*(to++) = *(from++);
}
else if (from < to) {
jint *end = from;
from += count - 1;
to += count - 1;
while (from >= end)
*(to--) = *(from--);
}
}
void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
if (from > to) {
jlong *end = from + count;
while (from < end)
os::atomic_copy64(from++, to++);
}
else if (from < to) {
jlong *end = from;
from += count - 1;
to += count - 1;
while (from >= end)
os::atomic_copy64(from--, to--);
}
}
void _Copy_arrayof_conjoint_bytes(HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count);
}
void _Copy_arrayof_conjoint_jshorts(HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * 2);
}
void _Copy_arrayof_conjoint_jints(HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * 4);
}
void _Copy_arrayof_conjoint_jlongs(HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * 8);
}
};

View File

@ -1,51 +0,0 @@
// Copyright (c) 2015, Red Hat Inc. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 2 only, as
// published by the Free Software Foundation.
//
// This code is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// version 2 for more details (a copy is included in the LICENSE file that
// accompanied this code).
//
// You should have received a copy of the GNU General Public License version
// 2 along with this work; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
//
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
// or visit www.oracle.com if you need additional information or have any
// questions.
// JavaThread::aarch64_get_thread_helper()
//
// Return the current thread pointer in x0.
// Clobber x1, flags.
// All other registers are preserved,
.global _ZN10JavaThread25aarch64_get_thread_helperEv
.type _ZN10JavaThread25aarch64_get_thread_helperEv, %function
_ZN10JavaThread25aarch64_get_thread_helperEv:
stp x29, x30, [sp, -16]!
#ifdef __ANDROID__
adrp x0, :tlsdesc:_ZN3art6Thread14CurrentFromGdbEv
ldr x1, [x0, #:tlsdesc_lo12:_ZN3art6Thread14CurrentFromGdbEv]
add x0, x0, :tlsdesc_lo12:_ZN3art6Thread14CurrentFromGdbEv
.tlsdesccall _ZN3art6Thread14CurrentFromGdbEv
#else
adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE
ldr x1, [x0, #:tlsdesc_lo12:_ZN6Thread12_thr_currentE]
add x0, x0, :tlsdesc_lo12:_ZN6Thread12_thr_currentE
.tlsdesccall _ZN6Thread12_thr_currentE
#endif
blr x1
mrs x1, tpidr_el0
add x0, x1, x0
ldr x0, [x0]
ldp x29, x30, [sp], 16
ret
.size _ZN10JavaThread25aarch64_get_thread_helperEv, .-_ZN10JavaThread25aarch64_get_thread_helperEv

View File

@ -1,166 +0,0 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_UTILITIES_ELF_FILE_HPP
#define SHARE_VM_UTILITIES_ELF_FILE_HPP
#if !defined(_WINDOWS) && !defined(__APPLE__)
#if defined(__OpenBSD__)
#include <sys/exec_elf.h>
#else
#ifdef __ANDROID__
# include <linux/elf.h>
#else
#include <elf.h>
#endif
#endif
#include <stdio.h>
#ifdef _LP64
typedef Elf64_Half Elf_Half;
typedef Elf64_Word Elf_Word;
typedef Elf64_Off Elf_Off;
typedef Elf64_Addr Elf_Addr;
typedef Elf64_Ehdr Elf_Ehdr;
typedef Elf64_Shdr Elf_Shdr;
typedef Elf64_Phdr Elf_Phdr;
typedef Elf64_Sym Elf_Sym;
#if !defined(__ANDROID__) && (!defined(_ALLBSD_SOURCE) || defined(__APPLE__))
#define ELF_ST_TYPE ELF64_ST_TYPE
#endif
#else
typedef Elf32_Half Elf_Half;
typedef Elf32_Word Elf_Word;
typedef Elf32_Off Elf_Off;
typedef Elf32_Addr Elf_Addr;
typedef Elf32_Ehdr Elf_Ehdr;
typedef Elf32_Shdr Elf_Shdr;
typedef Elf32_Phdr Elf_Phdr;
typedef Elf32_Sym Elf_Sym;
#if (!defined(_ALLBSD_SOURCE) && !defined(__ANDROID__)) || defined(__APPLE__)
#define ELF_ST_TYPE ELF32_ST_TYPE
#endif
#endif
#include "globalDefinitions.hpp"
#include "memory/allocation.hpp"
#include "utilities/decoder.hpp"
class ElfStringTable;
class ElfSymbolTable;
class ElfFuncDescTable;
// On Solaris/Linux platforms, libjvm.so does contain all private symbols.
// ElfFile is basically an elf file parser, which can lookup the symbol
// that is the nearest to the given address.
// Beware, this code is called from vm error reporting code, when vm is already
// in "error" state, so there are scenarios, lookup will fail. We want this
// part of code to be very defensive, and bait out if anything went wrong.
class ElfFile: public CHeapObj<mtInternal> {
friend class ElfDecoder;
public:
ElfFile(const char* filepath);
~ElfFile();
bool decode(address addr, char* buf, int buflen, int* offset);
const char* filepath() {
return m_filepath;
}
bool same_elf_file(const char* filepath) {
assert(filepath, "null file path");
assert(m_filepath, "already out of memory");
return (m_filepath && !strcmp(filepath, m_filepath));
}
NullDecoder::decoder_status get_status() {
return m_status;
}
private:
// sanity check, if the file is a real elf file
bool is_elf_file(Elf_Ehdr&);
// load string tables from the elf file
bool load_tables();
// string tables are stored in a linked list
void add_string_table(ElfStringTable* table);
// symbol tables are stored in a linked list
void add_symbol_table(ElfSymbolTable* table);
// return a string table at specified section index
ElfStringTable* get_string_table(int index);
protected:
ElfFile* next() const { return m_next; }
void set_next(ElfFile* file) { m_next = file; }
public:
// Returns true if the elf file is marked NOT to require an executable stack,
// or if the file could not be opened.
// Returns false if the elf file requires an executable stack, the stack flag
// is not set at all, or if the file can not be read.
// On systems other than linux it always returns false.
bool specifies_noexecstack() NOT_LINUX({ return false; });
protected:
ElfFile* m_next;
private:
// file
const char* m_filepath;
FILE* m_file;
// Elf header
Elf_Ehdr m_elfHdr;
// symbol tables
ElfSymbolTable* m_symbol_tables;
// string tables
ElfStringTable* m_string_tables;
// function descriptors table
ElfFuncDescTable* m_funcDesc_table;
NullDecoder::decoder_status m_status;
};
#endif // !_WINDOWS && !__APPLE__
#endif // SHARE_VM_UTILITIES_ELF_FILE_HPP

View File

@ -1,116 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
ifneq ($(OPENJDK_TARGET_OS),ios)
include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, pack200, \
MAIN_MODULE := java.base, \
MAIN_CLASS := com.sun.java.util.jar.pack.Driver, \
))
################################################################################
# The order of the object files on the link command line affects the size of the resulting
# binary (at least on linux) which causes the size to differ between old and new build.
UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.pack/share/native/common-unpack \
$(JDK_TOPDIR)/src/jdk.pack/share/native/unpack200
UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.pack/share/native/common-unpack \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
ifeq ($(USE_EXTERNAL_LIBZ), true)
UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB
UNPACKEXE_LIBS := -lz
else
UNPACKEXE_CFLAGS += -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib
UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
endif
UNPACK_MAPFILE_DIR := $(JDK_TOPDIR)/make/mapfiles/libunpack
UNPACK_MAPFILE_PLATFORM_FILE := \
$(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH)
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
# if feeded with a version script which contains named tags.
ifeq ($(USING_BROKEN_SUSE_LD), yes)
UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200.anonymous
else ifneq ($(wildcard $(UNPACK_MAPFILE_PLATFORM_FILE)), )
UNPACK_MAPFILE := $(UNPACK_MAPFILE_PLATFORM_FILE)
else
UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200
endif
$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
SRC := $(UNPACKEXE_SRC), \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
OPTIMIZATION := LOW, \
CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \
CFLAGS_release := -DPRODUCT, \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \
DISABLED_WARNINGS_gcc := unused-result, \
MAPFILE := $(UNPACK_MAPFILE),\
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_android := $(UNPACKEXE_ZIPOBJS) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK), \
LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
LIBS_solaris := -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
PROGRAM := unpack200, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=unpack200.exe" \
-D "JDK_INTERNAL_NAME=unpack200" \
-D "JDK_FTYPE=0x1L", \
MANIFEST := $(JDK_TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
))
ifneq ($(USE_EXTERNAL_LIBZ), true)
$(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
endif
TARGETS += $(BUILD_UNPACKEXE)
################################################################################
endif

View File

@ -1,236 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include NativeCompilation.gmk
ifeq ($(OPENJDK_TARGET_OS), macosx)
DISABLE_MAPFILES := true
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
else
ifeq ($(OPENJDK_TARGET_OS), windows)
DISABLE_MAPFILES := true
endif
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib/jli)
# Applications expect to be able to link against libjawt without invoking
# System.loadLibrary("jawt") first. This was the behaviour described in the
# devloper documentation of JAWT and what worked with OpenJDK6.
ifneq ($(findstring $(OPENJDK_TARGET_OS), android linux solaris), )
ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib)
endif
endif
LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher
LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
#
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc
MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest
################################################################################
# Build standard launcher.
# Setup make rules for building a standard launcher.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name. It is also
# used as the name of the executable.
#
# Remaining parameters are named arguments. These include:
# MAIN_MODULE The module of the main class to launch if different from the
# current module
# MAIN_CLASS The Java main class to launch
# JAVA_ARGS Processed into a -DJAVA_ARGS C flag
# CFLAGS Additional CFLAGS
# CFLAGS_windows Additional CFLAGS_windows
# LIBS_unix Additional LIBS_unix
# LIBS_windows Additional LIBS_windows
# LDFLAGS_solaris Additional LDFLAGS_solaris
# RC_FLAGS Additional RC_FLAGS
# MACOSX_SIGNED On macosx, sign this binary
# WINDOWS_STATIC_LINK On windows, link statically with C runtime and libjli.
# OPTIMIZATION Override default optimization level (LOW)
# OUTPUT_DIR Override default output directory
# VERSION_INFO_RESOURCE Override default Windows resource file
# NO_JAVA_MS Do not add -ms8m to JAVA_ARGS.
SetupBuildLauncher = $(NamedParamsMacroTemplate)
define SetupBuildLauncherBody
# Setup default values (unless overridden)
ifeq ($$($1_VERSION_INFO_RESOURCE), )
$1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
endif
ifeq ($$($1_OUTPUT_DIR), )
$1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
endif
ifeq ($$($1_OPTIMIZATION), )
$1_OPTIMIZATION := LOW
endif
ifneq ($$($1_NO_JAVA_MS), true)
# The norm is to append -ms8m, unless otherwise instructed.
$1_JAVA_ARGS += -ms8m
endif
ifeq ($$($1_MAIN_MODULE), )
$1_MAIN_MODULE := $(MODULE)
endif
ifneq ($$($1_JAVA_ARGS), )
$1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
$$(addprefix -J, $$($1_JAVA_ARGS)) -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
$1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
endif
$1_LIBS :=
ifeq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($$($1_MACOSX_SIGNED), true)
$1_PLIST_FILE := Info-privileged.plist
$1_CODESIGN := true
else
$1_PLIST_FILE := Info-cmdline.plist
endif
$1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
$1_LDFLAGS += -Wl,-all_load \
-sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
ifeq ($(STATIC_BUILD), true)
$1_LDFLAGS += -exported_symbols_list \
$(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
$1_LIBS += \
$$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \
$(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \
-framework CoreFoundation \
-framework Foundation \
-framework SystemConfiguration \
-lstdc++ -liconv
else
$1_LIBS += $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
endif
$1_LIBS += -framework Cocoa -framework Security \
-framework ApplicationServices
endif
ifeq ($(OPENJDK_TARGET_OS), aix)
$1_LDFLAGS += -L$(SUPPORT_OUTPUTDIR)/native/java.base
$1_LIBS += -ljli_static
endif
ifeq ($(USE_EXTERNAL_LIBZ), true)
$1_LIBS += -lz
endif
ifeq ($$($1_WINDOWS_STATIC_LINK), true)
$1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE))
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib
else
$1_CFLAGS += $(CFLAGS_JDKEXE)
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
endif
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
# if feeded with a version script which contains named tags.
ifeq ($(USING_BROKEN_SUSE_LD),yes)
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), )
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous
else
$1_MAPFILE :=
endif
else
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
else
$1_MAPFILE :=
endif
endif
$$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
OPTIMIZATION := $$($1_OPTIMIZATION), \
CFLAGS := $$($1_CFLAGS) \
$(LAUNCHER_CFLAGS) \
$(VERSION_CFLAGS) \
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
-DPROGNAME='"$1"' \
$$($1_CFLAGS), \
CFLAGS_linux := -fPIC, \
CFLAGS_ios := -I$(JDK_TOPDIR)/src/java.base/macosx/native/libjli, \
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
CFLAGS_windows := $$($1_CFLAGS_windows), \
LDFLAGS := $$(LDFLAGS_JDKEXE) \
$$(ORIGIN_ARG) \
$$($1_LDFLAGS), \
LDFLAGS_android := \
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
LDFLAGS_linux := \
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
MAPFILE := $$($1_MAPFILE), \
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
LIBS_unix := $$($1_LIBS_unix), \
LIBS_android := -llog -ljli $(LIBDL) -lc, \
LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \
LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \
LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
$$($1_LIBS_windows), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
OUTPUT_DIR := $$($1_OUTPUT_DIR), \
PROGRAM := $1, \
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \
-D "JDK_INTERNAL_NAME=$1" \
-D "JDK_FTYPE=0x1L" \
$$($1_RC_FLAGS), \
MANIFEST := $(JAVA_MANIFEST), \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
CODESIGN := $$($1_CODESIGN), \
))
$1 += $$(BUILD_LAUNCHER_$1)
ifneq ($(OPENJDK_TARGET_OS), ios)
TARGETS += $$($1)
endif
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
$$($1_WINDOWS_JLI_LIB)
endif
endef

File diff suppressed because it is too large Load Diff

View File

@ -1,487 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, lib/CoreLibraries.gmk))
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
BUILD_LIBFDLIBM_OPTIMIZATION := NONE
ifeq ($(OPENJDK_TARGET_OS), solaris)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
endif
ifeq ($(OPENJDK_TARGET_OS), linux)
ifeq ($(OPENJDK_TARGET_CPU), ppc64)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
else ifeq ($(OPENJDK_TARGET_CPU), s390x)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
else ifeq ($(OPENJDK_TARGET_CPU), aarch64)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
endif
endif
LIBFDLIBM_SRC := $(JDK_TOPDIR)/src/java.base/share/native/libfdlibm
LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC)
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM, \
STATIC_LIBRARY := fdlibm, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBFDLIBM_SRC), \
OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
CFLAGS_windows_debug := -DLOGGING, \
CFLAGS_aix := -qfloat=nomaf, \
CFLAGS_linux_ppc64 := -ffp-contract=off, \
CFLAGS_linux_ppc64le := -ffp-contract=off, \
CFLAGS_linux_s390x := -ffp-contract=off, \
CFLAGS_linux_aarch64 := -ffp-contract=off, \
DISABLED_WARNINGS_gcc := sign-compare, \
DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
))
else
# On macosx the old build does partial (incremental) linking of fdlibm instead of
# a plain static library.
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC, \
LIBRARY := fdlibm, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
SRC := $(LIBFDLIBM_SRC), \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
LDFLAGS := -nostdlib -r -arch x86_64, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
))
BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
$(call install-file)
endif
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
BUILD_LIBVERIFY_REORDER := $(JDK_TOPDIR)/make/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
endif
endif
LIBVERIFY_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBVERIFY_OPTIMIZATION := LOW
endif
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
LIBRARY := verify, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(JDK_TOPDIR)/src/java.base/share/native/libverify, \
OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB), \
CFLAGS_ios := -I$(JDK_TOPDIR)/src/java.base/macosx/native/libjli, \
DISABLED_WARNINGS_microsoft := 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljvm -lc, \
LIBS_windows := jvm.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=verify.dll" \
-D "JDK_INTERNAL_NAME=verify" \
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBVERIFY_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
))
TARGETS += $(BUILD_LIBVERIFY)
##########################################################################################
LIBJAVA_SRC_DIRS := $(call FindSrcDirsForLib, java.base, java)
LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-I$(JDK_TOPDIR)/src/java.base/share/native/libfdlibm \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
# Make it possible to override this variable
LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx ios))
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
LIBJAVA_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
endif
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
LIBRARY := java, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBJAVA_SRC_DIRS), \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
CFLAGS_ios := -I$(JDK_TOPDIR)/src/java.base/macosx/native/libjava, \
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := unused-result, \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(LIBJAVA_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_android := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
LDFLAGS_windows := -export:winFileHandleOpen -export:handleLseek \
-export:getLastErrorString \
-export:getErrorString -delayload:shell32.dll, \
LIBS_unix := -ljvm -lverify, \
LIBS_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
LIBS_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
LIBS_aix := $(LIBDL) $(BUILD_LIBFDLIBM) $(LIBM),\
LIBS_macosx := -lfdlibm \
-framework CoreFoundation \
-framework Foundation \
-framework Security -framework SystemConfiguration, \
LIBS_ios := -lfdlibm \
-framework Foundation \
-framework Security -framework SystemConfiguration, \
LIBS_windows := jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
shell32.lib delayimp.lib \
advapi32.lib version.lib, \
LIBS_android := \
-lfdlibm, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=java.dll" \
-D "JDK_INTERNAL_NAME=java" \
-D "JDK_FTYPE=0x2L", \
REORDER := $(LIBJAVA_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
))
TARGETS += $(BUILD_LIBJAVA)
$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
$(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
##########################################################################################
BUILD_LIBZIP_EXCLUDES :=
ifeq ($(USE_EXTERNAL_LIBZ), true)
LIBZIP_EXCLUDES += zlib
endif
BUILD_LIBZIP_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/make/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
endif
endif
ifeq ($(LIBZIP_CAN_USE_MMAP), true)
BUILD_LIBZIP_MMAP := -DUSE_MMAP
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
LIBRARY := zip, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
OPTIMIZATION := LOW, \
SRC := $(JDK_TOPDIR)/src/java.base/share/native/libzip, \
EXCLUDES := $(LIBZIP_EXCLUDES), \
CFLAGS := $(CFLAGS_JDKLIB) \
$(ZLIB_CPPFLAGS) \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
REORDER := $(BUILD_LIBZIP_REORDER), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
-export:ZIP_ReadEntry -export:ZIP_GetNextEntry \
-export:ZIP_InflateFully -export:ZIP_CRC32 -export:ZIP_FreeEntry, \
LIBS_android := -ljvm -ljava $(LIBZ), \
LIBS_unix := -ljvm -ljava $(LIBZ), \
LIBS_solaris := -lc, \
LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=zip.dll" \
-D "JDK_INTERNAL_NAME=zip" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
))
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBZIP)
##########################################################################################
JIMAGELIB_CPPFLAGS := \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjimage \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
#
$(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
LIBRARY := jimage, \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
OPTIMIZATION := LOW, \
SRC := $(JDK_TOPDIR)/src/java.base/share/native/libjimage \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \
EXCLUDES := $(LIBJIMAGE_EXCLUDES), \
CFLAGS := $(CFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
CFLAGS_unix := -UDEBUG, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjimage/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -export:JIMAGE_Open -export:JIMAGE_Close \
-export:JIMAGE_PackageToModule \
-export:JIMAGE_FindResource -export:JIMAGE_GetResource \
-export:JIMAGE_ResourceIterator -export:JIMAGE_ResourcePath, \
LIBS_unix := -ljvm -ldl $(LIBCXX), \
LIBS_solaris := -lc, \
LIBS_macosx := -lc++, \
LIBS_ios := -lc++, \
LIBS_windows := jvm.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jimage.dll" \
-D "JDK_INTERNAL_NAME=jimage" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjimage, \
))
$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBJIMAGE)
##########################################################################################
LIBJLI_SRC_DIRS := $(call FindSrcDirsForLib, java.base, jli)
LIBJLI_CFLAGS := $(CFLAGS_JDKLIB)
ifeq ($(call check-jvm-variant, zero zeroshark), true)
ERGO_FAMILY := zero
else
ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
ERGO_FAMILY := i586
else
ERGO_FAMILY := $(OPENJDK_TARGET_CPU_ARCH)
endif
endif
LIBJLI_ALL_ERGO := $(wildcard $(addsuffix /ergo_*.c, $(LIBJLI_SRC_DIRS)))
LIBJLI_EXCLUDE_ERGO := $(filter-out %/ergo_$(ERGO_FAMILY).c, $(LIBJLI_ALL_ERGO))
# If all specialized ergo files are excluded, use generic ergo
ifeq ($(LIBJLI_ALL_ERGO), $(LIBJLI_EXCLUDE_ERGO))
LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
endif
LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO))
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx ios))
LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c ergo_i586.c
BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
# Staticically link with c runtime on windows.
LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
# Supply the name of the C runtime lib.
LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
ifneq ($(MSVCP_DLL), )
LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
endif
else
LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
endif
LIBJLI_CFLAGS += $(addprefix -I, $(LIBJLI_SRC_DIRS))
ifneq ($(USE_EXTERNAL_LIBZ), true)
LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
LIBJLI_EXTRA_FILES += \
$(addprefix $(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib/, \
inflate.c \
inftrees.c \
inffast.c \
zadler32.c \
zcrc32.c \
zutil.c \
)
endif
ifeq ($(OPENJDK_TARGET_OS),android)
ANDROID_LDFLAGS_JDKLIB := \
$(filter-out -ljava -ljvm, $(LDFLAGS_JDKLIB))
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
LIBRARY := jli, \
OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
CFLAGS_ios := -I$(JDK_TOPDIR)/src/java.base/macosx/native/libjli, \
DISABLED_WARNINGS_solstudio := \
E_ASM_DISABLES_OPTIMIZATION \
E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
LDFLAGS_ios := -framework Security, \
LDFLAGS_windows := \
-export:JLI_Launch \
-export:JLI_ManifestIterate \
-export:JLI_SetTraceLauncher \
-export:JLI_ReportErrorMessage \
-export:JLI_ReportErrorMessageSys \
-export:JLI_ReportMessage \
-export:JLI_ReportExceptionDescription \
-export:JLI_MemAlloc \
-export:JLI_CmdToArgs \
-export:JLI_GetStdArgc \
-export:JLI_GetStdArgs \
-export:JLI_List_new \
-export:JLI_List_add \
-export:JLI_StringDup \
-export:JLI_MemFree \
-export:JLI_InitArgProcessing \
-export:JLI_PreprocessArg \
-export:JLI_AddArgsFromEnvVar \
-export:JLI_GetAppArgIndex, \
LIBS_unix := $(LIBZ), \
LIBS_linux := $(LIBDL) -lc -lpthread, \
LIBS_android := $(LIBDL) -lc -llog, \
LIBS_solaris := $(LIBDL) -lc, \
LIBS_aix := $(LIBDL),\
LIBS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
LIBS_ios := -framework Security, \
LIBS_windows := advapi32.lib comctl32.lib user32.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jli.dll" \
-D "JDK_INTERNAL_NAME=jli" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
))
ifneq ($(OPENJDK_TARGET_OS), ios)
TARGETS += $(BUILD_LIBJLI)
endif
# On windows, the static library has the same suffix as the import library created by
# with the shared library, so the static library is given a different name. No harm
# in doing it for all platform to reduce complexity.
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
STATIC_LIBRARY := jli_static, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
))
TARGETS += $(BUILD_LIBJLI_STATIC)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
#
# On macosx they do partial (incremental) linking of libjli_static.a
# code it here...rather than add support to NativeCompilation
# as this is first time I see it
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
LIBRARY := jli_static, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
))
ifeq ($(STATIC_BUILD), true)
TARGETS += $(BUILD_LIBJLI_STATIC)
else
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a: $(BUILD_LIBJLI_STATIC)
$(call install-file)
TARGETS += $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a
endif
else ifeq ($(OPENJDK_TARGET_OS), aix)
# AIX also requires a static libjli because the compiler doesn't support '-rpath'
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
STATIC_LIBRARY := jli_static, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
TARGETS += $(BUILD_LIBJLI_STATIC)
endif

View File

@ -1,113 +0,0 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include SetupJavaCompilers.gmk
#
# Build ios JavaLauncher framework
#
ifeq (ios,$(OPENJDK_TARGET_OS))
JAVALAUNCHER_IOS_SRC := $(JDK_TOPDIR)/src/java.base/ios/native/JavaLauncher
JAVALAUNCHER_API_SRC := $(JDK_TOPDIR)/src/java.base/share/native/javalauncher_api
JAVALAUNCHER_INFO_PLIST := \
$(JDK_TOPDIR)/src/java.base/share/tools/jproject/ios/frameworks/JavaLauncher/JavaLauncher-Info.plist
JAVALAUNCHER_FRAMEWORK := $(JDK_OUTPUTDIR)/frameworks/JavaLauncher/JavaLauncher.framework
JAVALAUNCHER_HEADERS := \
$(JAVALAUNCHER_API_SRC)/javalauncher_api.h \
$(JAVALAUNCHER_IOS_SRC)/JavaLauncher.h \
$(JAVALAUNCHER_IOS_SRC)/JavaArgs.h
JAVALAUNCHER_SOURCES := \
$(addprefix $(JAVALAUNCHER_API_SRC)/, \
javalauncher_api.c javalauncher_api.h) \
$(addprefix $(JAVALAUNCHER_IOS_SRC)/, \
JavaLauncher.m JavaLauncher.h JavaArgs.m JavaArgs.h)
$(eval $(call SetupNativeCompilation,BUILD_JAVALAUNCHER, \
STATIC_LIBRARY := JavaLauncher, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.base/libjavalauncher, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.base/libjavalauncher, \
SRC := $(JAVALAUNCHER_SOURCES), \
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(JAVALAUNCHER_IOS_SRC) \
-I$(JAVALAUNCHER_API_SRC), \
WARNINGS_AS_ERRORS_clang := false, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
TARGETS += $(JAVALAUNCHER_FRAMEWORK)
$(JAVALAUNCHER_FRAMEWORK): $(BUILD_JAVALAUNCHER)
@$(ECHO) $(LOG_INFO) Building JavaLauncher.framework
$(MKDIR) -p $(JAVALAUNCHER_FRAMEWORK)/Headers
$(CP) $(JAVALAUNCHER_HEADERS) $(JAVALAUNCHER_FRAMEWORK)/Headers
$(CP) $(JAVALAUNCHER_INFO_PLIST) $(JAVALAUNCHER_FRAMEWORK)/Info.plist
$(CP) $(SUPPORT_OUTPUTDIR)/native/java.base/libjavalauncher/$(LIBRARY_PREFIX)JavaLauncher$(STATIC_LIBRARY_SUFFIX) \
$(JAVALAUNCHER_FRAMEWORK)/JavaLauncher
endif
#
# Build android JavaLauncher jar file.
#
ifeq ($(OPENJDK_TARGET_OS),android)
OCLDVK_SRCDIR := $(JDK_TOPDIR)/src/java.base/android/classes/com/oracle/dalvik/javalauncher
OCLDVK_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/ocldvk
OCLDVK_CLASSES := $(OCLDVK_OUTPUTDIR)/classes
OCLDVK_JAR := $(OCLDVK_OUTPUTDIR)/lib/ext/ocldvk.jar
$(eval $(call SetupJavaCompilation,BUILD_OCLDVK_JAR, \
SETUP := GENERATE_JAVA5_BYTECODE, \
SRC := $(OCLDVK_SRCDIR), \
JAR := $(OCLDVK_JAR), \
BIN := $(OCLDVK_CLASSES)))
TARGETS += $(BUILD_OCLDVK_JAR)
OCLDVK := $(JDK_TOPDIR)/src/java.base/android/native/libocldvk
JAVALAUNCHER_API := $(JDK_TOPDIR)/src/java.base/share/native/javalauncher_api
$(eval $(call SetupNativeCompilation, BUILD_LIBOCLDVK, \
LIBRARY := ocldvk, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.base/libocldvk, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.base/libocldvk, \
SRC := $(OCLDVK) $(OCLDVK)/net $(JAVALAUNCHER_API), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libocldvk/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB), \
LIBS := -llog, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(OPENJDK_TARGET_CPU_JLI_CFLAGS) \
-I$(OCLDVK)/javalauncher \
-I$(JAVALAUNCHER_API) \
-I$(OCLDVK)/net, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
TARGETS += $(BUILD_LIBOCLDVK)
endif

View File

@ -1,37 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
# Prepare the find cache.
$(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.desktop/*/native \
$(JDK_TOPDIR)/src/*/java.desktop/*/native)))
include LibosxLibraries.gmk
include PlatformLibraries.gmk
ifeq (,$(filter $(OPENJDK_TARGET_OS), android ios))
include Awt2dLibraries.gmk
endif
include SoundLibraries.gmk

View File

@ -1,101 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.instrument.gmk))
################################################################################
LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \
$(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_TYPE)/native/libinstrument \
#
LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBINSTRUMENT_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.instrument \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
#
ifeq ($(OPENJDK_TARGET_OS), windows)
# Statically link the C runtime so that there are not dependencies on modules
# not on the search patch when invoked from the Windows system directory
# (or elsewhere).
LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
# equivalent of strcasecmp is stricmp on Windows
LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
LIBRARY := instrument, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBINSTRUMENT_SRC), \
OPTIMIZATION := LOW, \
CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
CFLAGS_debug := -DJPLIS_LOGGING, \
CFLAGS_release := -DNO_JPLIS_LOGGING, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libinstrument/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
$(LIBINSTRUMENT_LDFLAGS), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
-L$(call FindLibDirForModule, java.base)/jli, \
LDFLAGS_android := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
-L$(call FindLibDirForModule, java.base)/jli, \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
-L$(call FindLibDirForModule, java.base)/jli, \
LDFLAGS_macosx := -Wl$(COMMA)-all_load, \
LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
LIBS := $(JDKLIB_LIBS), \
LIBS_unix := -ljava -ljvm $(LIBZ), \
LIBS_linux := -ljli $(LIBDL), \
LIBS_android := -ljli $(LIBDL), \
LIBS_solaris := -ljli $(LIBDL), \
LIBS_aix := -liconv -ljli_static $(LIBDL), \
LIBS_macosx := -liconv -framework Cocoa -framework Security \
-framework ApplicationServices \
$(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a, \
LIBS_ios := -liconv $(LIBZ), \
LIBS_windows := jvm.lib $(WIN_JAVA_LIB) advapi32.lib \
$(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=instrument.dll" \
-D "JDK_INTERNAL_NAME=instrument" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
))
ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
$(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
else
$(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli, /jli)
endif
$(BUILD_LIBINSTRUMENT): $(BUILD_LIBJAVA)
ifneq ($(OPENJDK_TARGET_OS), ios)
TARGETS += $(BUILD_LIBINSTRUMENT)
endif
################################################################################

View File

@ -1,72 +0,0 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.management.gmk))
################################################################################
LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement
LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
$(addprefix -I,$(LIBMANAGEMENT_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.management \
$(LIBJAVA_HEADER_FLAGS) \
#
LIBMANAGEMENT_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBMANAGEMENT_OPTIMIZATION := LOW
endif
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
LIBRARY := management, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBMANAGEMENT_SRC), \
OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_CFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(JDKLIB_LIBS), \
LIBS_solaris := -lkstat, \
LIBS_aix := -lperfstat,\
LIBS_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=management.dll" \
-D "JDK_INTERNAL_NAME=management" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
))
$(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
TARGETS += $(BUILD_LIBMANAGEMENT)
################################################################################

View File

@ -1,65 +0,0 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
################################################################################
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/macosx/native/libprefs
else
LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_TYPE)/native/libprefs
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
LIBRARY := prefs, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBPREF_SRC_DIRS), \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBPREF_SRC_DIRS)) \
$(LIBJAVA_HEADER_FLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libprefs/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljvm, \
LIBS_linux := -ljava, \
LIBS_android := -ljava, \
LIBS_solaris := -ljava -lc, \
LIBS_aix := -ljava, \
LIBS_macosx := -framework CoreFoundation -framework Foundation, \
LIBS_windows := advapi32.lib jvm.lib $(WIN_JAVA_LIB), \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=prefs.dll" \
-D "JDK_INTERNAL_NAME=prefs" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
))
$(BUILD_LIBPREFS): $(call FindLib, java.base, java)
ifneq ($(OPENJDK_TARGET_OS), ios)
TARGETS += $(BUILD_LIBPREFS)
endif
################################################################################

View File

@ -1,71 +0,0 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
# In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate
# a binary that is compatible with windows versions older than 7/2008R2.
# See MSDN documentation for GetProcessMemoryInfo for more information.
LIBATTACH_CFLAGS := -DPSAPI_VERSION=1
endif
ifneq ($(OPENJDK_TARGET_OS), android)
LIBATTACH_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS)
else
LIBATTACH_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-linux
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
LIBRARY := attach, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(call FindSrcDirsForLib, jdk.attach, attach), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
$(LIBJAVA_HEADER_FLAGS) $(LIBATTACH_CFLAGS), \
CFLAGS_windows := /Gy, \
MAPFILE := $(LIBATTACH_MAPFILE), \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=attach.dll" \
-D "JDK_INTERNAL_NAME=attach" \
-D "JDK_FTYPE=0x2L", \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -order:@$(JDK_TOPDIR)/make/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
LIBS := $(JDKLIB_LIBS), \
LIBS_solaris := -ldoor, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
))
$(BUILD_LIBATTACH): $(call FindLib, java.base, java)
TARGETS += $(BUILD_LIBATTACH)
################################################################################

View File

@ -1,125 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
################################################################################
LIBDT_SOCKET_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libdt_socket \
$(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_socket
LIBDT_SOCKET_CPPFLAGS := \
$(addprefix -I, $(LIBDT_SOCKET_SRC)) \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \
#
$(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET, \
LIBRARY := dt_socket, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBDT_SOCKET_SRC), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
$(LIBDT_SOCKET_CPPFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libdt_socket/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -export:jdwpTransport_OnLoad, \
LIBS_linux := -lpthread, \
LIBS_solaris := -lnsl -lsocket -lc, \
LIBS_windows := $(JDKLIB_LIBS) ws2_32.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=dt_socket.dll" \
-D "JDK_INTERNAL_NAME=dt_socket" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
))
$(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
# Include socket transport with JDWP agent to allow for remote debugging
TARGETS += $(BUILD_LIBDT_SOCKET)
################################################################################
LIBJDWP_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \
$(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libjdwp
LIBJDWP_CPPFLAGS := \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \
$(addprefix -I, $(LIBJDWP_SRC))
# JDWP_LOGGING causes log messages to be compiled into the library.
$(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \
LIBRARY := jdwp, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBJDWP_SRC), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \
$(LIBJDWP_CPPFLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjdwp/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_android := $(LDFLAGS_JDKLIB), \
LIBS := $(JDKLIB_LIBS), \
LIBS_linux := $(LIBDL), \
LIBS_solaris := $(LIBDL), \
LIBS_macosx := -liconv, \
LIBS_ios := -liconv, \
LIBS_aix := -liconv, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jdwp.dll" \
-D "JDK_INTERNAL_NAME=jdwp" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
))
$(BUILD_LIBJDWP): $(call FindLib, java.base, java)
TARGETS += $(BUILD_LIBJDWP)
################################################################################
ifeq ($(STATIC_BUILD), true)
JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC := \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent$(OPENJDK_TARGET_CPU_LIBDIR)/$(LIBRARY_PREFIX)dt_socket.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent$(OPENJDK_TARGET_CPU_LIBDIR)/$(LIBRARY_PREFIX)jdwp.symbols
JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/jdk.jdwp.agent.symbols
$(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE): $(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC)
$(call LogInfo, Generating jdk.jdwp.agent symbols file)
$(CAT) $^ > $@
# The individual symbol files is generated when the respective lib is built
$(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC): $(BUILD_LIBDT_SOCKET) $(BUILD_LIBJDWP)
TARGETS += $(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE)
endif
################################################################################

View File

@ -1,94 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include NativeCompilation.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, lib/LibCommon.gmk))
################################################################################
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
# elegant solution to this.
WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx windows), )
DISABLE_MAPFILES := true
endif
################################################################################
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
ifeq ($(OPENJDK_TARGET_OS), android)
FindSrcDirsForLib = \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/linux/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
else ifeq ($(OPENJDK_TARGET_OS), ios)
FindSrcDirsForLib = \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/macosx/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
else
FindSrcDirsForLib += \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
endif
################################################################################
# Find a library
# Param 1 - module name
# Param 2 - library name
# Param 3 - subdir for library
FindLib = \
$(call FindLibDirForModule, \
$(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
################################################################################
# Define the header include flags needed to compile against it.
LIBJAVA_HEADER_FLAGS := $(addprefix -I, $(call FindSrcDirsForLib, java.base, java))
# Put the libraries here.
INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
################################################################################
# Define it here since there are multiple uses.
ifeq ($(USE_EXTERNAL_LIBZ), true)
LIBZ := -lz
else
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib
endif
###############################################################################

View File

@ -1,65 +0,0 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
LIBNET_SRC_DIRS := $(call FindSrcDirsForLib, java.base, net)
ifeq ($(OPENJDK_TARGET_OS), ios)
BUILD_LIBNET_EXFILES += DefaultProxySelector.c
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
LIBRARY := net, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBNET_SRC_DIRS), \
EXCLUDE_FILES := $(BUILD_LIBNET_EXFILES), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
$(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
DISABLED_WARNINGS_gcc := format-nonliteral, \
DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
DISABLED_WARNINGS_solstudio := E_ARG_INCOMPATIBLE_WITH_ARG_L, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -delayload:secur32.dll -delayload:iphlpapi.dll, \
LIBS_unix := -ljvm -ljava, \
LIBS_android := -llog, \
LIBS_linux := $(LIBDL) -lpthread, \
LIBS_solaris := -lnsl -lsocket $(LIBDL) -lc, \
LIBS_aix := $(LIBDL),\
LIBS_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib winhttp.lib \
delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \
LIBS_macosx := -framework CoreFoundation -framework CoreServices, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=net.dll" \
-D "JDK_INTERNAL_NAME=net" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
))
$(BUILD_LIBNET): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBNET)

View File

@ -1,102 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
BUILD_LIBNIO_SRC := \
$(JDK_TOPDIR)/src/java.base/share/native/libnio \
$(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \
$(sort $(wildcard \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/fs \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/ch \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/fs)) \
#
ifeq ($(OPENJDK_TARGET_OS), android)
BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/java.base/linux/native/libnio/ch \
$(JDK_TOPDIR)/src/java.base/linux/native/libnio/fs
endif
ifeq ($(OPENJDK_TARGET_OS), ios)
BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/java.base/macosx/native/libnio/ch \
$(JDK_TOPDIR)/src/java.base/macosx/native/libnio/fs
BUILD_LIBNIO_EXFILES += UTIFileTypeDetector.c
endif
BUILD_LIBNIO_CFLAGS := \
$(addprefix -I, $(BUILD_LIBNIO_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
$(LIBJAVA_HEADER_FLAGS) \
$(addprefix -I, $(BUILD_LIBNET_SRC))
ifneq (,$(filter android linux, $(OPENJDK_TARGET_OS)))
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-linux
endif
ifneq (,$(filter ios macosx, $(OPENJDK_TARGET_OS)))
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
endif
ifeq ($(OPENJDK_TARGET_OS), aix)
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
LIBRARY := nio, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(BUILD_LIBNIO_SRC), \
EXCLUDE_FILES := $(BUILD_LIBNIO_EXFILES), \
OPTIMIZATION := HIGH, \
WARNINGS_AS_ERRORS_xlc := false, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBNIO_CFLAGS), \
MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljava -lnet, \
LIBS_linux := -lpthread $(LIBDL), \
LIBS_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
-lsendfile -lc, \
LIBS_aix := $(LIBDL), \
LIBS_macosx := \
-framework CoreFoundation -framework CoreServices, \
LIBS_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
advapi32.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=nio.dll" \
-D "JDK_INTERNAL_NAME=nio" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
))
TARGETS += $(BUILD_LIBNIO)
$(BUILD_LIBNIO): $(BUILD_LIBNET)

View File

@ -1,219 +0,0 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
LIBJSOUND_SRC_DIRS := \
$(JDK_TOPDIR)/src/java.desktop/share/native/libjsound \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjsound \
#
LIBJSOUND_CFLAGS := \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(LIBJAVA_HEADER_FLAGS) \
$(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) \
#
LIBJSOUND_SRC_FILES := Utilities.c Platform.c
EXTRA_SOUND_JNI_LIBS :=
LIBJSOUND_MIDIFILES := \
MidiInDevice.c \
MidiInDeviceProvider.c \
MidiOutDevice.c \
MidiOutDeviceProvider.c \
PlatformMidi.c
# files needed for ports
LIBJSOUND_PORTFILES := \
PortMixerProvider.c \
PortMixer.c
# files needed for direct audio
LIBJSOUND_DAUDIOFILES := \
DirectAudioDeviceProvider.c \
DirectAudioDevice.c
ifeq ($(OPENJDK_TARGET_OS), windows)
EXTRA_SOUND_JNI_LIBS += jsoundds
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS \
-DUSE_PLATFORM_MIDI_OUT=TRUE \
-DUSE_PLATFORM_MIDI_IN=TRUE \
-DUSE_PORTS=TRUE
LIBJSOUND_SRC_FILES += \
PLATFORM_API_WinOS_MidiIn.cpp \
PLATFORM_API_WinOS_MidiOut.c \
PLATFORM_API_WinOS_Util.c \
PLATFORM_API_WinOS_Ports.c
LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
endif # OPENJDK_TARGET_OS windows
ifeq ($(OPENJDK_TARGET_OS), linux)
EXTRA_SOUND_JNI_LIBS += jsoundalsa
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
endif # OPENJDK_TARGET_OS linux
ifeq ($(OPENJDK_TARGET_OS), aix)
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_AIX
endif # OPENJDK_TARGET_OS aix
ifeq ($(OPENJDK_TARGET_OS), android)
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
-DUSE_PORTS=TRUE \
-DUSE_DAUDIO=TRUE \
-DUSE_PLATFORM_MIDI_OUT=TRUE \
-DUSE_PLATFORM_MIDI_IN=TRUE
LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjsound
LIBJSOUND_SRC_FILES += \
PLATFORM_API_MacOSX_Utils.cpp \
PLATFORM_API_MacOSX_PCM.cpp \
PLATFORM_API_MacOSX_Ports.cpp \
PLATFORM_API_MacOSX_MidiIn.c \
PLATFORM_API_MacOSX_MidiOut.c \
PLATFORM_API_MacOSX_MidiUtils.c
LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
endif # OPENJDK_TARGET_OS macosx
ifeq ($(OPENJDK_TARGET_OS), solaris)
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \
-DUSE_PORTS=TRUE \
-DUSE_DAUDIO=TRUE
LIBJSOUND_SRC_FILES += \
PLATFORM_API_SolarisOS_Utils.c \
PLATFORM_API_SolarisOS_Ports.c \
PLATFORM_API_SolarisOS_PCM.c
LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
endif # OPENJDK_TARGET_OS solaris
LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
LIBRARY := jsound, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBJSOUND_SRC_DIRS), \
INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJSOUND_CFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljava -ljvm, \
LIBS_solaris := -lc, \
LIBS_macosx := -framework CoreAudio -framework CoreFoundation \
-framework CoreServices -framework AudioUnit $(LIBCXX) \
-framework CoreMIDI -framework AudioToolbox, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jsound.dll" \
-D "JDK_INTERNAL_NAME=jsound" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
))
$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
ifneq ($(OPENJDK_TARGET_OS), ios)
TARGETS += $(BUILD_LIBJSOUND)
endif
##########################################################################################
ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA, \
LIBRARY := jsoundalsa, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBJSOUND_SRC_DIRS), \
INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
$(LIBJSOUND_DAUDIOFILES) \
PLATFORM_API_LinuxOS_ALSA_CommonUtils.c \
PLATFORM_API_LinuxOS_ALSA_PCM.c \
PLATFORM_API_LinuxOS_ALSA_PCMUtils.c \
PLATFORM_API_LinuxOS_ALSA_MidiIn.c \
PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
PLATFORM_API_LinuxOS_ALSA_Ports.c, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
$(LIBJSOUND_CFLAGS) \
-DUSE_DAUDIO=TRUE \
-DUSE_PORTS=TRUE \
-DUSE_PLATFORM_MIDI_OUT=TRUE \
-DUSE_PLATFORM_MIDI_IN=TRUE, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(ALSA_LIBS) -ljava -ljvm, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
))
$(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
ifneq ($(OPENJDK_TARGET_OS), ios)
TARGETS += $(BUILD_LIBJSOUNDALSA)
endif
endif
##########################################################################################
ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS, \
LIBRARY := jsoundds, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBJSOUND_SRC_DIRS), \
INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
PLATFORM_API_WinOS_DirectSound.cpp, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJSOUND_CFLAGS) \
-DUSE_DAUDIO=TRUE, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(JDKLIB_LIBS) dsound.lib winmm.lib user32.lib ole32.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jsoundds.dll" \
-D "JDK_INTERNAL_NAME=jsoundds" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
))
$(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBJSOUNDDS)
endif

View File

@ -1,283 +0,0 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "jni.h"
#include "jni_util.h"
#include "jvm.h"
#include "jvm_md.h"
#include "jlong.h"
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "sun_nio_ch_FileChannelImpl.h"
#include "java_lang_Integer.h"
#include "nio.h"
#include "nio_util.h"
#include <dlfcn.h>
#if defined(__linux__) || defined(__solaris__)
#include <sys/sendfile.h>
#ifdef __ANDROID__
#define mmap64 mmap
// #include <sys/syscall.h>
// #define sendfile64(a,b,c,d) syscall(__NR_sendfile64, a, b, c, d);
#endif
#elif defined(_AIX)
#include <sys/socket.h>
#elif defined(_ALLBSD_SOURCE)
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#define lseek64 lseek
#define mmap64 mmap
#endif
static jfieldID chan_fd; /* jobject 'fd' in sun.io.FileChannelImpl */
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_FileChannelImpl_initIDs(JNIEnv *env, jclass clazz)
{
jlong pageSize = sysconf(_SC_PAGESIZE);
chan_fd = (*env)->GetFieldID(env, clazz, "fd", "Ljava/io/FileDescriptor;");
return pageSize;
}
static jlong
handle(JNIEnv *env, jlong rv, char *msg)
{
if (rv >= 0)
return rv;
if (errno == EINTR)
return IOS_INTERRUPTED;
JNU_ThrowIOExceptionWithLastError(env, msg);
return IOS_THROWN;
}
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_FileChannelImpl_map0(JNIEnv *env, jobject this,
jint prot, jlong off, jlong len)
{
void *mapAddress = 0;
jobject fdo = (*env)->GetObjectField(env, this, chan_fd);
jint fd = fdval(env, fdo);
int protections = 0;
int flags = 0;
if (prot == sun_nio_ch_FileChannelImpl_MAP_RO) {
protections = PROT_READ;
flags = MAP_SHARED;
} else if (prot == sun_nio_ch_FileChannelImpl_MAP_RW) {
protections = PROT_WRITE | PROT_READ;
flags = MAP_SHARED;
} else if (prot == sun_nio_ch_FileChannelImpl_MAP_PV) {
protections = PROT_WRITE | PROT_READ;
flags = MAP_PRIVATE;
}
mapAddress = mmap64(
0, /* Let OS decide location */
len, /* Number of bytes to map */
protections, /* File permissions */
flags, /* Changes are shared */
fd, /* File descriptor of mapped file */
off); /* Offset into file */
if (mapAddress == MAP_FAILED) {
if (errno == ENOMEM) {
JNU_ThrowOutOfMemoryError(env, "Map failed");
return IOS_THROWN;
}
return handle(env, -1, "Map failed");
}
return ((jlong) (unsigned long) mapAddress);
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_FileChannelImpl_unmap0(JNIEnv *env, jobject this,
jlong address, jlong len)
{
void *a = (void *)jlong_to_ptr(address);
return handle(env,
munmap(a, (size_t)len),
"Unmap failed");
}
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_FileChannelImpl_position0(JNIEnv *env, jobject this,
jobject fdo, jlong offset)
{
jint fd = fdval(env, fdo);
jlong result = 0;
if (offset < 0) {
result = lseek64(fd, 0, SEEK_CUR);
} else {
result = lseek64(fd, offset, SEEK_SET);
}
return handle(env, result, "Position failed");
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo)
{
jint fd = fdval(env, fdo);
if (fd != -1) {
jlong result = close(fd);
if (result < 0) {
JNU_ThrowIOExceptionWithLastError(env, "Close failed");
}
}
}
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
jobject srcFDO,
jlong position, jlong count,
jobject dstFDO)
{
jint srcFD = fdval(env, srcFDO);
jint dstFD = fdval(env, dstFDO);
#if defined(__linux__)
off64_t offset = (off64_t)position;
jlong n = sendfile64(dstFD, srcFD, &offset, (size_t)count);
if (n < 0) {
if (errno == EAGAIN)
return IOS_UNAVAILABLE;
if ((errno == EINVAL) && ((ssize_t)count >= 0))
return IOS_UNSUPPORTED_CASE;
if (errno == EINTR) {
return IOS_INTERRUPTED;
}
JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
return IOS_THROWN;
}
return n;
#elif defined (__solaris__)
sendfilevec64_t sfv;
size_t numBytes = 0;
jlong result;
sfv.sfv_fd = srcFD;
sfv.sfv_flag = 0;
sfv.sfv_off = (off64_t)position;
sfv.sfv_len = count;
result = sendfilev64(dstFD, &sfv, 1, &numBytes);
/* Solaris sendfilev() will return -1 even if some bytes have been
* transferred, so we check numBytes first.
*/
if (numBytes > 0)
return numBytes;
if (result < 0) {
if (errno == EAGAIN)
return IOS_UNAVAILABLE;
if (errno == EOPNOTSUPP)
return IOS_UNSUPPORTED_CASE;
if ((errno == EINVAL) && ((ssize_t)count >= 0))
return IOS_UNSUPPORTED_CASE;
if (errno == EINTR)
return IOS_INTERRUPTED;
JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
return IOS_THROWN;
}
return result;
#elif defined(__APPLE__)
off_t numBytes;
int result;
numBytes = count;
result = sendfile(srcFD, dstFD, position, &numBytes, NULL, 0);
if (numBytes > 0)
return numBytes;
if (result == -1) {
if (errno == EAGAIN)
return IOS_UNAVAILABLE;
if (errno == EOPNOTSUPP || errno == ENOTSOCK || errno == ENOTCONN)
return IOS_UNSUPPORTED_CASE;
if ((errno == EINVAL) && ((ssize_t)count >= 0))
return IOS_UNSUPPORTED_CASE;
if (errno == EINTR)
return IOS_INTERRUPTED;
JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
return IOS_THROWN;
}
return result;
#elif defined(_AIX)
jlong max = (jlong)java_lang_Integer_MAX_VALUE;
struct sf_parms sf_iobuf;
jlong result;
if (position > max)
return IOS_UNSUPPORTED_CASE;
if (count > max)
count = max;
memset(&sf_iobuf, 0, sizeof(sf_iobuf));
sf_iobuf.file_descriptor = srcFD;
sf_iobuf.file_offset = (off_t)position;
sf_iobuf.file_bytes = count;
result = send_file(&dstFD, &sf_iobuf, SF_SYNC_CACHE);
/* AIX send_file() will return 0 when this operation complete successfully,
* return 1 when partial bytes transfered and return -1 when an error has
* Occured.
*/
if (result == -1) {
if (errno == EWOULDBLOCK)
return IOS_UNAVAILABLE;
if ((errno == EINVAL) && ((ssize_t)count >= 0))
return IOS_UNSUPPORTED_CASE;
if (errno == EINTR)
return IOS_INTERRUPTED;
if (errno == ENOTSOCK)
return IOS_UNSUPPORTED;
JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
return IOS_THROWN;
}
if (sf_iobuf.bytes_sent > 0)
return (jlong)sf_iobuf.bytes_sent;
return IOS_UNSUPPORTED_CASE;
#else
return IOS_UNSUPPORTED_CASE;
#endif
}

View File

@ -1,142 +0,0 @@
/*
* Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <string.h>
#include <stdlib.h>
#include "jni.h"
#include "manifest_info.h"
#include "JarFacade.h"
typedef struct {
jarAttribute* head;
jarAttribute* tail;
} iterationContext;
static void
doAttribute(const char* name, const char* value, void* user_data) {
iterationContext* context = (iterationContext*) user_data;
jarAttribute* attribute = (jarAttribute*)malloc(sizeof(jarAttribute));
if (attribute != NULL) {
attribute->name = strdup(name);
if (attribute->name == NULL) {
free(attribute);
} else {
char *begin = (char *)value;
char *end;
size_t value_len;
/* skip any leading white space */
while (*begin == ' ') {
begin++;
}
/* skip any trailing white space */
end = &begin[strlen(begin)];
while (end > begin && end[-1] == ' ') {
end--;
}
if (begin == end) {
/* no value so skip this attribute */
free(attribute->name);
free(attribute);
return;
}
value_len = (size_t)(end - begin);
attribute->value = malloc(value_len + 1);
if (attribute->value == NULL) {
free(attribute->name);
free(attribute);
} else {
/* save the value without leading or trailing whitespace */
strncpy(attribute->value, begin, value_len);
attribute->value[value_len] = '\0';
attribute->next = NULL;
if (context->head == NULL) {
context->head = attribute;
} else {
context->tail->next = attribute;
}
context->tail = attribute;
}
}
}
}
/*
* Return a list of attributes from the main section of the given JAR
* file. Returns NULL if there is an error or there aren't any attributes.
*/
jarAttribute*
readAttributes(const char* jarfile)
{
int rc;
iterationContext context = { NULL, NULL };
printf("FIXME build: undefined reference to JLI_ManifestIterate\n");
rc = 0;
// rc = JLI_ManifestIterate(jarfile, doAttribute, (void*)&context);
if (rc == 0) {
return context.head;
} else {
freeAttributes(context.head);
return NULL;
}
}
/*
* Free a list of attributes
*/
void
freeAttributes(jarAttribute* head) {
while (head != NULL) {
jarAttribute* next = (jarAttribute*)head->next;
free(head->name);
free(head->value);
free(head);
head = next;
}
}
/*
* Get the value of an attribute in an attribute list. Returns NULL
* if attribute not found.
*/
char*
getAttribute(const jarAttribute* attributes, const char* name) {
while (attributes != NULL) {
if (strcasecmp(attributes->name, name) == 0) {
return attributes->value;
}
attributes = (jarAttribute*)attributes->next;
}
return NULL;
}

View File

@ -0,0 +1,26 @@
--- ./common/autoconf/generated-configure.sh 2017-05-14 10:01:38.475911076 +0530
+++ ../generated-configure.sh 2017-05-14 10:08:25.204273780 +0530
@@ -47809,8 +47809,8 @@
# Assume the C compiler is the assembler
BUILD_AS="$BUILD_CC -c"
# Just like for the target compiler, use the compiler as linker
- BUILD_LD="$BUILD_CC"
- BUILD_LDCXX="$BUILD_CXX"
+ BUILD_LD="$BUILD_CC -ldl -lpthread"
+ BUILD_LDCXX="$BUILD_CXX -ldl -lpthread"
PATH="$OLDPATH"
--- ./common/autoconf/generated-configure.sh 2017-05-14 10:50:10.292197720 +0530
+++ ../generated-configure.sh 2017-05-14 10:53:21.857704488 +0530
@@ -37441,8 +37441,8 @@
LDCXX="$LD"
else
# All other toolchains use the compiler to link.
- LD="$CC"
- LDCXX="$CXX"
+ LD="$CC -llog"
+ LDCXX="$CXX -llog"
fi
# FIXME: it should be CXXLD, according to standard (cf CXXCPP)

View File

@ -0,0 +1,11 @@
--- ./hotspot/src/share/vm/utilities/elfFile.hpp 2017-05-12 23:47:58.000000000 +0530
+++ ../elfFile.hpp 2017-05-14 12:27:21.069572447 +0530
@@ -50,7 +50,7 @@
typedef Elf64_Phdr Elf_Phdr;
typedef Elf64_Sym Elf_Sym;
-#if !defined(_ALLBSD_SOURCE) || defined(__APPLE__)
+#if (!defined(_ALLBSD_SOURCE) || defined(__APPLE__)) && !defined(__ANDROID__)
#define ELF_ST_TYPE ELF64_ST_TYPE
#endif

View File

@ -0,0 +1,29 @@
--- ./common/autoconf/generated-configure.sh 2017-04-01 23:19:09.508381398 +0530
+++ ../generated-configure.sh 2017-04-02 17:35:37.210373866 +0530
@@ -53412,14 +53412,7 @@
# Check if X11 is needed
- if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx || test "x$OPENJDK_TARGET_OS" = xios || test "x$OPENJDK_TARGET_OS" = xandroid; then
- # No X11 support on windows or macosx
NEEDS_LIB_X11=false
- else
- # All other instances need X11, even if building headless only, libawt still
- # needs X11 headers.
- NEEDS_LIB_X11=true
- fi
# Check if cups is needed
if test "x$OPENJDK_TARGET_OS" = xwindows; then
@@ -53435,11 +53428,7 @@
fi
# Check if alsa is needed
- if test "x$OPENJDK_TARGET_OS" = xlinux; then
- NEEDS_LIB_ALSA=true
- else
NEEDS_LIB_ALSA=false
- fi
# Check if ffi is needed
if [[ " $JVM_VARIANTS " =~ " zero " ]] || [[ " $JVM_VARIANTS " =~ " zeroshark " ]] ; then

View File

@ -0,0 +1,43 @@
--- ./jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c 2017-03-02 21:55:47.000000000 +0530
+++ ../UnixNativeDispatcher.c 2017-03-03 21:37:02.370375158 +0530
@@ -168,40 +168,6 @@
#endif
static fdopendir_func* my_fdopendir_func = NULL;
-#ifdef __ANDROID__
-/*
- * TODO: Android lacks support for the methods listed below. In it's place are
- * alternatives that use existing Android functionality, but lack reentrant
- * support. Determine if the following are the most suitable alternatives.
- *
- */
-int getgrgid_r(gid_t gid, struct group* grp, char* buf, size_t buflen, struct group** result)
-{
- *result = NULL;
- errno = 0;
- grp = getgrgid(gid);
- if (grp == NULL) {
- return errno;
- }
- // buf not used by caller (see below)
- *result = grp;
- return 0;
-}
-
-int getgrnam_r(const char *name, struct group* grp, char* buf, size_t buflen, struct group** result)
-{
- *result = NULL;
- errno = 0;
- grp = getgrnam(name);
- if (grp == NULL) {
- return errno;
- }
- // buf not used by caller (see below)
- *result = grp;
- return 0;
-}
-#endif
-
/**
* fstatat missing from glibc on Linux. Temporary workaround
* for x86/x64.

View File

@ -0,0 +1,12 @@
shoutout to @its-pointless (live_the_dream)
--- ./hotspot/src/share/vm/runtime/os.cpp 2017-03-30 20:45:45.000000000 +0530
+++ ../os.cpp 2017-03-31 11:04:17.097618021 +0530
@@ -74,7 +74,7 @@
int os::_processor_count = 0;
int os::_initial_active_processor_count = 0;
size_t os::_page_sizes[os::page_sizes_max];
-const char * os::_java_home = NULL;
+const char * os::_java_home = "@TERMUX_PREFIX@/lib/jvm/openjdk-9";
#ifndef PRODUCT
julong os::num_mallocs = 0; // # of calls to malloc/realloc

View File

@ -0,0 +1,11 @@
--- ./jdk/src/java.base/unix/native/libjli/java_md_solinux.c 2017-03-30 20:45:48.000000000 +0530
+++ ../java_md_solinux.c 2017-03-31 09:15:07.979651293 +0530
@@ -163,7 +163,7 @@
*/
#ifdef __ANDROID__
-static char * __java_home = NULL;
+static char * __java_home = "@TERMUX_PREFIX@/jre_runtime";
#endif
void SetJavaHome(char *arg) {

View File

@ -0,0 +1,82 @@
--- ./jdk/make/lib/Awt2dLibraries.gmk 2017-03-30 20:45:48.000000000 +0530
+++ ../Awt2dLibraries.gmk 2017-04-02 18:36:12.582240305 +0530
@@ -145,7 +145,7 @@
LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility
endif
-ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
+ifneq ($(filter $(OPENJDK_TARGET_OS), solaris macosx aix), )
LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
endif
@@ -212,7 +212,7 @@
LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
endif
-ifeq ($(OPENJDK_TARGET_OS), android)
+ifeq ($(OPENJDK_TARGET_OS), linux)
LIBAWT_EXFILES += \
java2d/loops/TransformHelper.c \
java2d/loops/ScaledBlit.c \
@@ -347,10 +347,10 @@
endif
endif
- LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
+ LIBAWT_XAWT_LIBS := $(LIBM) $(LIBDL) -ljava -ljvm -lc
ifeq ($(OPENJDK_TARGET_OS), linux)
- LIBAWT_XAWT_LIBS += -lpthread
+ LIBAWT_XAWT_LIBS += -lc
endif
ifeq ($(TOOLCHAIN_TYPE), gcc)
@@ -669,7 +669,7 @@
X11TextRenderer.c \
fontpath.c \
lcdglyph.c
-else ifeq ($(OPENJDK_TARGET_OS), android)
+else ifeq ($(OPENJDK_TARGET_OS), linux)
LIBFONTMANAGER_EXCLUDE_FILES += X11TextRenderer.c
else
LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
@@ -939,7 +939,7 @@
LIBSPLASHSCREEN_LDFLAGS := -delayload:user32.dll
LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
else
- LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
+ LIBSPLASHSCREEN_LIBS += $(LIBM) -lc -ldl
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBSPLASHSCREEN, \
--- ./jdk/make/lib/Lib-java.desktop.gmk 2017-03-30 20:45:48.000000000 +0530
+++ ../Lib-java.desktop.gmk 2017-04-02 19:01:58.000696690 +0530
@@ -31,7 +31,7 @@
include LibosxLibraries.gmk
include PlatformLibraries.gmk
-ifeq (,$(filter $(OPENJDK_TARGET_OS), android ios))
+ifeq (,$(filter $(OPENJDK_TARGET_OS), android ios linux))
include Awt2dLibraries.gmk
endif
include SoundLibraries.gmk
--- ./jdk/make/lib/SoundLibraries.gmk 2017-03-30 20:45:48.000000000 +0530
+++ ../SoundLibraries.gmk 2017-04-02 19:14:25.382032835 +0530
@@ -69,16 +69,11 @@
LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
endif # OPENJDK_TARGET_OS windows
-ifeq ($(OPENJDK_TARGET_OS), linux)
- EXTRA_SOUND_JNI_LIBS += jsoundalsa
- LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
-endif # OPENJDK_TARGET_OS linux
-
ifeq ($(OPENJDK_TARGET_OS), aix)
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_AIX
endif # OPENJDK_TARGET_OS aix
-ifeq ($(OPENJDK_TARGET_OS), android)
+ifeq ($(OPENJDK_TARGET_OS), linux)
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
endif

View File

@ -0,0 +1,12 @@
thanks @fornwall for finding this
--- ./jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java 2017-03-30 20:45:48.000000000 +0530
+++ ../ProcessImpl.java 2017-04-01 23:04:39.565293249 +0530
@@ -157,7 +157,7 @@
static Platform get() {
String osName = GetPropertyAction.privilegedGetProperty("os.name");
- if (osName.equals("Linux")) { return LINUX; }
+ if (osName.equals("Linux") || osName.equals("Android")) { return LINUX; }
if (osName.contains("OS X")) { return BSD; }
if (osName.equals("SunOS")) { return SOLARIS; }
if (osName.equals("AIX")) { return AIX; }

View File

@ -0,0 +1,12 @@
--- ./hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp 2017-05-12 23:47:58.000000000 +0530
+++ ../os_linux_aarch64.cpp 2017-05-14 21:36:49.672414253 +0530
@@ -77,7 +77,9 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
+# ifndef __ANDROID__
# include <fpu_control.h>
+# endif
#ifdef BUILTIN_SIM
#define REG_SP REG_RSP

View File

@ -0,0 +1,11 @@
--- ./jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c 2017-05-12 23:48:01.000000000 +0530
+++ ../FileChannelImpl.c 2017-05-14 22:51:02.292589382 +0530
@@ -41,8 +41,6 @@
#include <sys/sendfile.h>
#ifdef __ANDROID__
#define mmap64 mmap
-#include <sys/syscall.h>
-#define sendfile64(a,b,c,d) syscall(__NR_sendfile64, a, b, c, d);
#endif
#elif defined(_AIX)
#include <sys/socket.h>