Commit 4f355d7f authored by Kunshan Wang's avatar Kunshan Wang

Force --no-as-needed linker flag on Linux.

Some Linux distributions (notably Ubuntu) sets the --as-needed linker
flag by default, which makes the linker sensitive of the order of the
libraries the executable file depends on in the command line. Other
distributions (such as ArchLinux) do not set this flag by default. For
safety, this flag is explicitly turned off in both the Makefile and the
refimpl2-config script on Linux.
parent a76483c4
......@@ -26,7 +26,7 @@ endif
ifeq ($(OS),LINUX)
CFLAGS += -I $(JAVA_HOME)/include/linux
LDFLAGS += -L $(JAVA_HOME)/jre/lib/amd64/server -l jvm -Wl,-rpath,$(JAVA_HOME)/jre/lib/amd64/server
LDFLAGS += -Wl,--no-as-needed -L $(JAVA_HOME)/jre/lib/amd64/server -l jvm -Wl,-rpath,$(JAVA_HOME)/jre/lib/amd64/server
......@@ -5,6 +5,9 @@ from __future__ import print_function # compatible with python2
import sys
import os
import os.path
import platform
plat_sys = platform.system()
whereami = os.path.dirname(os.path.realpath(__file__))
......@@ -27,7 +30,9 @@ if '--istart' in args:
if '--cflags' in args:
print("-I {} ".format(whereami), end="")
if '--libs' in args:
print("-L {} -l murefimpl2start -Wl,-rpath,{}".format(
if plat_sys == "Linux":
print("-Wl,--no-as-needed ", end="")
print("-L {} -l murefimpl2start -Wl,-rpath,{} ".format(
whereami, whereami), end="")
if '--cflags' in args:
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment