From 41051c5e81306c44db27315e2ddbb8db9d522c3e Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 26 Feb 2016 21:22:26 +0100 Subject: Added some gcc linker options. CompCert now recognizes the gcc linker options: -nostartfiles -nodefaultlibs -nostdlib -s -Xlinker -u Bug 18066. --- driver/Driver.ml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/driver/Driver.ml b/driver/Driver.ml index bdccbf16..6969cbf6 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -511,9 +511,19 @@ Assembling options: Linking options: -l Link library -L Add to search path for libraries + -nostartfiles (GCC only) Do not use the standard system startup files when + linking + -nodefaultlibs (GCC only) Do no use the standard system libraries + -nostdlib (GCC only) Do not use the standard system libraries when + linking + -s Remove all symbol table and relocation information from the + executable -static Prevent linking with the shared libraries -T Use as linker command file + -Xlinker Pass as an option to the linker -Wl, Pass option to the linker + -u Pretend the symbol is undefined to force linking of + library modules to define it. Tracing options: -dprepro Save C file after preprocessing in .i -dparse Save C file after parsing and elaboration in .parse.c @@ -557,6 +567,9 @@ let optimization_options = [ let set_all opts = List.iter (fun r -> r := true) opts let unset_all opts = List.iter (fun r -> r := false) opts +let gnu_linker_opt s = + if Configuration.system <> "diab" then + push_linker_arg s let num_source_files = ref 0 @@ -632,6 +645,10 @@ let cmdline_actions = (* Linking options *) Prefix "-l", Self push_linker_arg; Prefix "-L", Self push_linker_arg; + Exact "-nostartfiles", Self gnu_linker_opt; + Exact "-nodefaultlibs", Self gnu_linker_opt; + Exact "-nostdlib", Self gnu_linker_opt; + Exact "-s", Self push_linker_arg; Exact "-static", Self push_linker_arg; Exact "-T", String (fun s -> if Configuration.system = "diab" then push_linker_arg ("-Wm"^s) @@ -639,7 +656,12 @@ let cmdline_actions = push_linker_arg ("-T"); push_linker_arg(s) end); + Exact "-Xlinker", String (fun s -> if Configuration.system = "diab" then + push_linker_arg ("-Wl,"^s) + else + push_linker_arg s); Prefix "-Wl,", Self push_linker_arg; + Exact "-u", Self push_linker_arg; (* Tracing options *) Exact "-dprepro", Set option_dprepro; Exact "-dparse", Set option_dparse; -- cgit