Skip to content

Commit

Permalink
sulong: remove special library loading for c++
Browse files Browse the repository at this point in the history
  • Loading branch information
zapster committed Mar 26, 2020
1 parent e64e412 commit 25b161b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2017, 2019, Oracle and/or its affiliates.
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
#
# All rights reserved.
#
Expand Down Expand Up @@ -74,8 +74,7 @@ bin/$(LIBSULONG): bin/libsulong.bc
$(QUIETLY) $(CLANG_PREFIX) $(CLANG) -o $@ -fPIC -nostdlib -shared -rpath $(ORIGIN_TOKEN) $(LD_FLAGS) $+

bin/$(LIBSULONGXX): bin/libsulong++.bc
$(QUIETLY) $(CLANG_PREFIX) $(CLANG) -o $@ -fPIC -nostdlib -shared -rpath $(ORIGIN_TOKEN) -stdlib=libc++ -lc++abi $(LD_FLAGS) -Wno-undefined-internal \
-L$(LLVM_TOOLCHAIN_LIB) $+
$(QUIETLY) $(CLANG_PREFIX) $(CLANGXX) -o $@ -fPIC -shared -rpath $(ORIGIN_TOKEN) -stdlib=libc++ $(LD_FLAGS) -Wno-undefined-internal $+

bin/%.bc: bin/%.noopt.bc
$(QUIETLY) $(OPT) -o $@ $+ ${OPT_FLAGS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import java.nio.file.Path;
import java.util.List;

import com.oracle.truffle.api.CompilerDirectives;
import org.graalvm.collections.EconomicMap;
import org.graalvm.collections.MapCursor;

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.TruffleLanguage.Env;
Expand All @@ -48,8 +48,6 @@
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.llvm.runtime.except.LLVMLinkerException;
import com.oracle.truffle.llvm.runtime.interop.nfi.LLVMNativeWrapper;
import com.oracle.truffle.llvm.runtime.nodes.asm.syscall.LLVMInfo;
import com.oracle.truffle.llvm.runtime.options.SulongEngineOption;
import com.oracle.truffle.llvm.runtime.types.FunctionType;
import com.oracle.truffle.llvm.runtime.types.PointerType;
import com.oracle.truffle.llvm.runtime.types.PrimitiveType;
Expand Down Expand Up @@ -133,9 +131,6 @@ public TruffleObject createNativeWrapper(LLVMFunctionDescriptor descriptor) {
private void addLibraries(LLVMContext context) {
CompilerAsserts.neverPartOfCompilation();
context.addInternalLibrary("libsulong-native." + getNativeLibrarySuffix(), "<default nfi library>");
if (context.getEnv().getOptions().get(SulongEngineOption.LOAD_CXX_LIBRARIES)) {
context.addInternalLibrary(getLibCxxName(), "<default nfi library>");
}
List<ExternalLibrary> libraries = context.getExternalLibraries(lib -> lib.isNative());
for (ExternalLibrary l : libraries) {
addLibrary(l, context);
Expand Down Expand Up @@ -179,10 +174,6 @@ private static boolean handleSpecialLibraries(ExternalLibrary lib) {
}
}

private static String getLibCxxName() {
return LLVMInfo.SYSNAME.toLowerCase().contains("mac") ? "libc++.dylib" : "libc++.so.1";
}

private TruffleObject loadLibrary(ExternalLibrary lib, LLVMContext context) {
CompilerAsserts.neverPartOfCompilation();
String libName = lib.getPath().toString();
Expand Down

0 comments on commit 25b161b

Please sign in to comment.