[m-rev.] for review: Add option --no-default-runtime-library-directory.
Peter Wang
novalazy at gmail.com
Thu Mar 31 17:50:33 AEDT 2016
Add an option to prevent the compiler adding any directories to the
runtime search path automatically. The user can set the entire RPATH
using --runtime-library-directory or leave it empty, without any
defaults from the compiler.
compiler/options.m:
compiler/handle_options.m:
doc/user_guide.texi:
NEWS:
As above.
---
NEWS | 4 ++++
compiler/handle_options.m | 23 +++++++++++++++++------
compiler/options.m | 7 +++++++
doc/user_guide.texi | 5 +++++
4 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS
index 4ab9d6c..5910514 100644
--- a/NEWS
+++ b/NEWS
@@ -325,6 +325,10 @@ Changes to the Mercury compiler:
* The compiler does not set the runtime search path when
--mercury-linkage=static is used.
+* We have added an option --no-default-runtime-library-directory to
+ prevent the compiler adding any directories to the runtime search path
+ automatically.
+
Change to the Mercury debugger:
* Interactive queries are now supported on OS X.
diff --git a/compiler/handle_options.m b/compiler/handle_options.m
index a02b7dc..1047cdf 100644
--- a/compiler/handle_options.m
+++ b/compiler/handle_options.m
@@ -1909,7 +1909,16 @@ convert_options_to_globals(OptionTable0, OpMode, Target,
),
globals.lookup_string_option(!.Globals, target_arch, TargetArch),
+
globals.lookup_string_option(!.Globals, mercury_linkage, MercuryLinkage),
+ ( if MercuryLinkage = "static" then
+ DefaultRuntimeLibraryDirs = no,
+ globals.set_option(default_runtime_library_directory, bool(no),
+ !Globals)
+ else
+ globals.lookup_bool_option(!.Globals,
+ default_runtime_library_directory, DefaultRuntimeLibraryDirs)
+ ),
% Add the standard library directory.
globals.lookup_maybe_string_option(!.Globals,
@@ -1927,13 +1936,14 @@ convert_options_to_globals(OptionTable0, OpMode, Target,
globals.set_option(link_library_directories,
accumulating([StdLibDir/"lib" | LinkLibDirs0]), !Globals),
- ( if MercuryLinkage = "shared" then
+ (
+ DefaultRuntimeLibraryDirs = yes,
globals.lookup_accumulating_option(!.Globals,
runtime_link_library_directories, Rpath0),
globals.set_option(runtime_link_library_directories,
accumulating([StdLibDir/"lib" | Rpath0]), !Globals)
- else
- true
+ ;
+ DefaultRuntimeLibraryDirs = no
)
;
MaybeStdLibDir = no
@@ -1987,13 +1997,14 @@ convert_options_to_globals(OptionTable0, OpMode, Target,
globals.set_option(link_library_directories,
accumulating(LinkLibDirs1 ++ ExtraLinkLibDirs), !Globals),
- ( if MercuryLinkage = "shared" then
+ (
+ DefaultRuntimeLibraryDirs = yes,
globals.lookup_accumulating_option(!.Globals,
runtime_link_library_directories, Rpath),
globals.set_option(runtime_link_library_directories,
accumulating(Rpath ++ ExtraLinkLibDirs), !Globals)
- else
- true
+ ;
+ DefaultRuntimeLibraryDirs = no
),
ExtraIncludeDirs = list.map(
diff --git a/compiler/options.m b/compiler/options.m
index bc4eb88..3dbdab9 100644
--- a/compiler/options.m
+++ b/compiler/options.m
@@ -866,6 +866,7 @@
; quoted_ld_libflag
; link_library_directories
; runtime_link_library_directories
+ ; default_runtime_library_directory
; link_libraries
; link_objects
; mercury_library_directories
@@ -1751,6 +1752,7 @@ option_defaults_2(link_option, [
quoted_ld_libflag - string_special,
link_library_directories - accumulating([]),
runtime_link_library_directories - accumulating([]),
+ default_runtime_library_directory - bool(yes),
link_libraries - accumulating([]),
link_objects - accumulating([]),
mercury_library_directory_special - string_special,
@@ -2717,6 +2719,8 @@ long_option("ld-libflags", ld_libflags).
long_option("ld-libflag", quoted_ld_libflag).
long_option("library-directory", link_library_directories).
long_option("runtime-library-directory", runtime_link_library_directories).
+long_option("default-runtime-library-directory",
+ default_runtime_library_directory).
long_option("library", link_libraries).
long_option("link-object", link_objects).
long_option("mercury-library", mercury_library_special).
@@ -5520,6 +5524,9 @@ options_help_link -->
"-R <directory>, --runtime-library-directory <directory>",
"\tAppend <directory> to the list of directories in which",
"\tto search for shared libraries at runtime.",
+ "--no-default-runtime-library-directory",
+ "\tDo not add any directories to the runtime search path",
+ "\tautomatically.",
"--shlib-linker-install-name-path <directory>",
"\tSpecify the path where a shared library will be installed.",
"\tThis option is useful on systems where the runtime search",
diff --git a/doc/user_guide.texi b/doc/user_guide.texi
index 54b424f..0d64a77 100644
--- a/doc/user_guide.texi
+++ b/doc/user_guide.texi
@@ -9568,6 +9568,11 @@ Append @var{directory} to the list of directories in which
to search for shared libraries at runtime.
@sp 1
+ at item --no-default-runtime-library-directory
+ at findex --no-default-runtime-library-directory
+Do not add any directories to the runtime search path automatically.
+
+ at sp 1
@item --shlib-linker-install-name-path @var{directory}
@findex --shlib-linker-install-name-path
@cindex Mac OS X, Darwin, Install name
--
2.6.4
More information about the reviews
mailing list