Commit 431b6cf1 authored by John van Groningen's avatar John van Groningen

add linker calling convention (:convention: before linker file name) for...

add linker calling convention (:convention: before linker file name) for windows, use specified file name instead of /usr/bin/gcc for gcc calling convention on Unix
parent f6671ab1
Pipeline #39969 passed with stage
in 50 seconds
......@@ -398,10 +398,10 @@ Link linker winfun path
| len >= 14 && linker % (len - 14, len) == "lib/exe/linker"
= linkOptimizingGCC linker object_paths options1 options2 ps
| len >= 12 && linker % (len - 12, len) == "/usr/bin/gcc"
= linkGCC object_paths options2 ps
= linkGCC linker object_paths options2 ps
= linkOther linker object_paths ps
| calling_convention=="gcc"
= linkGCC object_paths options2 ps
= linkGCC linker object_paths options2 ps
| calling_convention=="linker"
= linkOther linker object_paths ps
| calling_convention=="linker+gcc"
......@@ -444,24 +444,23 @@ where
= (ps,link_ok)
= (ps,link_ok)
//Call gcc
#! (ps, link_ok) = linkGCC [temp_file_name] options2 ps
#! (ps, link_ok) = linkGCC "/usr/bin/gcc" [temp_file_name] options2 ps
| unlink (temp_file_name+++"\0")<>0
= (ps,link_ok)
= (ps,link_ok)
//Just link with gcc
linkGCC object_paths gccOptions ps
linkGCC gcc_file_name object_paths gccOptions ps
# ld_args = add_options_string_to_args 0 gccOptions (StrictListToList (Append library_file_names "-lm"))
# ld_args = ["-o", path : object_paths ] ++ ld_args
ld_args = IF_MACOSX ld_args (IF_INT_64_OR_32 ["-no-pie":ld_args] ld_args)
ld_args = if gen_symbol_table ld_args ["-s":ld_args]
# ld = "/usr/bin/gcc"
# (argv,args_memory) = make_argv [ld:ld_args]
# (argv,args_memory) = make_argv [gcc_file_name:ld_args]
# ld_pid = fork
| ld_pid<0
= abort "fork failed\n"
| ld_pid==0
| execv (ld+++"\0") argv<0
| execv (gcc_file_name+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
| free args_memory<0
......
......@@ -669,6 +669,9 @@ Link linker` winfun path
applicationOptions=:{ss,hs,initial_heap_size,profiling,heap_size_multiple,o,memoryProfilingMinimumHeapSize=minheap}
optionspathname library_file_names object_file_names static_libraries static gen_relocs gen_symbol_table gen_linkmap
link_resources resource_path gen_dll dll_syms startupdir dynlstr _ use_64_bit_processor ps
# (calling_convention,linker`) = get_optional_calling_convention linker`
| size calling_convention<>0 && calling_convention<>"linker"
= (winfun ["Linker error: Unknown calling convention : "+++calling_convention] ps,False)
# (ok,linker,linkerdir) = mangleLinker linker` startupdir
| not ok
# ps = winfun [linker] ps
......@@ -736,43 +739,31 @@ mangleLinker linkstr` startupdir
# linkdir = RemoveFilename (linkstr % (0, size linkstr - 2))
= (True,linkcom,linkdir)
get_optional_calling_convention :: !{#Char} -> (!{#Char},!{#Char})
get_optional_calling_convention s
# s_size = size s;
| s_size>0 && s.[0]==':'
# next_c = FindColonChar 1 s s_size
| next_c<s_size
= (s % (1,next_c-1),s % (next_c+1,s_size));
= ("",s);
= ("",s);
splitOptions :: !{#Char} -> (!{#Char},!{#Char})
splitOptions str
| first_q >= len_str = (str,"")
= (first_str,last_str)
where
first_str = str%(0,dec first_q)
last_str = str % (inc first_q, len_str)
len_str = size str
first_q = FindQuoteChar str len_str 0
FindQuoteChar str len pos = FindChar ':' str len pos;
FindChar :: !Char !.String !.Int !Int -> Int;
FindChar c line linelen pos
| pos >= linelen = pos;
| c == line.[pos] = pos;
= FindChar c line linelen (inc pos);
/*
splitOptions str
| first_q >= len_str = (str,"")
| last_q >= len_str = (first_str,"")
= (first_str,last_str)
where
first_str = str%(0,dec first_q)
last_str = str % (inc first_q, dec last_q)
len_str = size str
first_q = FindQuoteChar str len_str 0
last_q = FindQuoteChar str len_str (inc first_q)
// FindQuoteChar :: !String !Int !Int -> Int;
FindQuoteChar str len pos = FindChar '\"' str len pos;
FindChar :: !Char !.String !.Int !Int -> Int;
FindChar c line linelen pos
| pos >= linelen = pos;
| c == line.[pos] = pos;
= FindChar c line linelen (inc pos);
*/
# len_str = size str
first_c = FindColonChar 0 str len_str
| first_c >= len_str
= (str,"")
# first_str = str % (0,dec first_c)
last_str = str % (first_c+1, len_str)
= (first_str,last_str)
FindColonChar :: !Int !String !Int -> Int;
FindColonChar pos line linelen
| pos<linelen && line.[pos]<>':'
= FindColonChar (pos+1) line linelen;
= pos;
//--- EXECUTE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment