Commit 84631e02 authored by Mart Lubbers's avatar Mart Lubbers

Merge commit '215682d0' into support-only-using-gcc

parents abf0de80 215682d0
Pipeline #17653 passed with stage
in 55 seconds
......@@ -150,7 +150,7 @@ CompilePersistent cocl write_module_times errwin typewin compileOrCheckSyntax md
= abort ("read failed "+++toString r +++ "\n")
# exitcode = parse_result_number 0 result_string
# dummy_slot = 0
# (path,mess,env) = CompileHandleExitCode exitcode cocl startupdir dummy_slot errwin typewin mdn listTypes env
= (compiling_info,(env,path,mess))
......@@ -162,7 +162,7 @@ parse_result_number i result_string
| c=='-'
= 0 - parse_result_number (i+1) result_string
= abort "parse_result_number failed\n"
where
where
parse_result_number2 i n result_string
| i<size result_string
# c=result_string.[i]
......@@ -240,7 +240,7 @@ QuitCleanCompiler async compiler_process_ids world
| async
= exit_compilers compiler_process_ids world
= world
where
where
exit_compilers [compiler:compilers] world
= exit_compilers compilers (exit_clean_compiler compiler world)
exit_compilers [] world
......@@ -291,7 +291,7 @@ CodeGen cgen used_compiler_process_ids wf genAsmOrCode abc_path obj_path timepro
# ((_, errors_not_empty, error_text),ps) = accFiles (readErrorsAndWarnings errors_file_name) ps
ps = if errors_not_empty
(wf (StrictListToList error_text) ps)
(wf (StrictListToList error_text) ps)
(if (exit_code <> 0)
(wf ["Error: Code generator failed for '"+++abc_path+++"' with exit code: "+++toString exit_code,(quoted_string path_without_suffix)] ps)
ps
......@@ -347,7 +347,7 @@ wait_for_finished_code_generator process_ids ps
| wtermsig<>0
= abort "code generator exited abnormally\n"
= (process_n,result,ps)
where
where
find_process_id_index i w_pid pids
| i<size pids
| pids.[i]==w_pid
......@@ -361,7 +361,7 @@ finish_code_generator process_handle {scg_abc_path,scg_path_without_suffix,scg_s
= abort "close failed\n"
# ((_, errors_not_empty, error_text),ps) = accFiles (readErrorsAndWarnings scg_errors_file_name) ps
ps = if errors_not_empty
(wf (StrictListToList error_text) ps)
(wf (StrictListToList error_text) ps)
(if (exit_code <> 0)
(wf ["Error: Code generator failed for '" +++ scg_abc_path +++ "' with exit code: "+++toString exit_code,(quoted_string scg_path_without_suffix)] ps)
ps)
......@@ -400,114 +400,114 @@ Link linker winfun path
where
//First call the optimizing linker to generate an intermediate optimized object file which is then passed to gcc
linkOptimizingGCC linker object_paths options1 options2 ps
# temp_file_name = "/tmp/linkerXXXXXX" +++ "\0" // +++ because modified by mkstemp
# fd = mkstemp temp_file_name
| fd== -1
= abort "mkstemp failed\n"
# r = close fd
| r== -1
= abort "close failed\n"
//Call optimized linker
# linker_args = add_options_string_to_args 0 options1 [temp_file_name:object_paths]
# (argv,args_memory) = make_argv [linker:linker_args]
# linker_pid = fork
| linker_pid<0
= abort "fork failed\n"
| linker_pid==0
| execv (linker+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
# (w_pid,status) = wait_pid linker_pid 0
| w_pid <> -1 && w_pid<>linker_pid
= abort "waitpid failed\n"
# exit_code = (status >> 8) bitand 0xff
# wtermsig = status bitand 0x7f
| wtermsig<>0
= abort "linker exited abnormally\n"
| free args_memory<0
= abort "free failed\n"
# link_ok = exit_code==0
| not link_ok
| unlink (temp_file_name+++"\0")<>0
= (ps,link_ok)
= (ps,link_ok)
//Call gcc
= linkGCC [temp_file_name] options2 ps
# temp_file_name = "/tmp/linkerXXXXXX" +++ "\0" // +++ because modified by mkstemp
# fd = mkstemp temp_file_name
| fd== -1
= abort "mkstemp failed\n"
# r = close fd
| r== -1
= abort "close failed\n"
//Call optimized linker
# linker_args = add_options_string_to_args 0 options1 [temp_file_name:object_paths]
# (argv,args_memory) = make_argv [linker:linker_args]
# linker_pid = fork
| linker_pid<0
= abort "fork failed\n"
| linker_pid==0
| execv (linker+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
# (w_pid,status) = wait_pid linker_pid 0
| w_pid <> -1 && w_pid<>linker_pid
= abort "waitpid failed\n"
# exit_code = (status >> 8) bitand 0xff
# wtermsig = status bitand 0x7f
| wtermsig<>0
= abort "linker exited abnormally\n"
| free args_memory<0
= abort "free failed\n"
# link_ok = exit_code==0
| not link_ok
| unlink (temp_file_name+++"\0")<>0
= (ps,link_ok)
= (ps,link_ok)
//Call gcc
= linkGCC [temp_file_name] options2 ps
//Just link with gcc
linkGCC object_paths gccOptions ps
# gcc_options = add_options_string_to_args 0 gccOptions (StrictListToList (Append library_file_names "-lm"))
# ld_args = ["-o", path : object_paths ] ++ gcc_options
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]
# ld_pid = fork
| ld_pid<0
= abort "fork failed\n"
| ld_pid==0
| execv (ld+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
| free args_memory<0
= abort "free failed\n"
# (w_pid,status) = wait_pid ld_pid 0
| w_pid <> -1 && w_pid<>ld_pid
= abort "waitpid failed\n"
# wtermsig = status bitand 0x7f
# exit_code = (status >> 8) bitand 0xff;
| wtermsig<>0
= abort "ld exited abnormally\n"
# link_ok = exit_code==0
= (ps,link_ok)
# gcc_options = add_options_string_to_args 0 gccOptions (StrictListToList (Append library_file_names "-lm"))
# ld_args = ["-o", path : object_paths ] ++ gcc_options
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]
# ld_pid = fork
| ld_pid<0
= abort "fork failed\n"
| ld_pid==0
| execv (ld+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
| free args_memory<0
= abort "free failed\n"
# (w_pid,status) = wait_pid ld_pid 0
| w_pid <> -1 && w_pid<>ld_pid
= abort "waitpid failed\n"
# wtermsig = status bitand 0x7f
# exit_code = (status >> 8) bitand 0xff;
| wtermsig<>0
= abort "ld exited abnormally\n"
# link_ok = exit_code==0
= (ps,link_ok)
//Call other/additional linker
linkOther linker object_paths ps
# linkopts =
{ exe_path = path
, res_path = resource_path
, open_console = o <> NoConsole
, static_link = static
, gen_relocs = gen_relocs
, gen_symbol_table = gen_symbol_table
, gen_linkmap = gen_linkmap
, link_resources = link_resources
, object_paths = ListToStrictList object_paths
, dynamic_libs = RemoveDup library_file_names
, static_libs = RemoveDup static_libraries
, stack_size = ss
, gen_dll = gen_dll
, dll_names = dll_syms
, dynamics_path = startupdir +++. DirSeparatorString +++. dynlstr
, lib_name_obj_path = MakeFullPathname tooltempdir "lib_name.o"
}
# linkoptspath = MakeFullPathname tooltempdir "linkopts"
# linkerrspath = MakeFullPathname tooltempdir "linkerrs"
# (err,ps) = accFiles (WriteLinkOpts linkoptspath linkopts) ps
| isJust err
= (winfun (fromJust err) ps,False)
# linker_args = ["-I",linkoptspath,"-O",linkerrspath]
# (argv,args_memory) = make_argv [linker:linker_args]
# linker_pid = fork
| linker_pid<0
= abort "fork failed\n"
| linker_pid==0
| execv (linker+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
# (w_pid,status) = wait_pid linker_pid 0
| w_pid <> -1 && w_pid<>linker_pid
= abort "waitpid failed\n"
# exit_code = (status >> 8) bitand 0xff
# wtermsig = status bitand 0x7f
| wtermsig<>0
= abort "linker exited abnormally\n"
| free args_memory<0
= abort "free failed\n"
# link_ok = exit_code==0
= (ps,link_ok)
# linkopts =
{ exe_path = path
, res_path = resource_path
, open_console = o <> NoConsole
, static_link = static
, gen_relocs = gen_relocs
, gen_symbol_table = gen_symbol_table
, gen_linkmap = gen_linkmap
, link_resources = link_resources
, object_paths = ListToStrictList object_paths
, dynamic_libs = RemoveDup library_file_names
, static_libs = RemoveDup static_libraries
, stack_size = ss
, gen_dll = gen_dll
, dll_names = dll_syms
, dynamics_path = startupdir +++. DirSeparatorString +++. dynlstr
, lib_name_obj_path = MakeFullPathname tooltempdir "lib_name.o"
}
# linkoptspath = MakeFullPathname tooltempdir "linkopts"
# linkerrspath = MakeFullPathname tooltempdir "linkerrs"
# (err,ps) = accFiles (WriteLinkOpts linkoptspath linkopts) ps
| isJust err
= (winfun (fromJust err) ps,False)
# linker_args = ["-I",linkoptspath,"-O",linkerrspath]
# (argv,args_memory) = make_argv [linker:linker_args]
# linker_pid = fork
| linker_pid<0
= abort "fork failed\n"
| linker_pid==0
| execv (linker+++"\0") argv<0
= abort "execv failed\n"
= abort "execution continued after execv\n"
# (w_pid,status) = wait_pid linker_pid 0
| w_pid <> -1 && w_pid<>linker_pid
= abort "waitpid failed\n"
# exit_code = (status >> 8) bitand 0xff
# wtermsig = status bitand 0x7f
| wtermsig<>0
= abort "linker exited abnormally\n"
| free args_memory<0
= abort "free failed\n"
# link_ok = exit_code==0
= (ps,link_ok)
DelayEventLoop :: !.ps -> .ps
DelayEventLoop ps
......@@ -527,13 +527,13 @@ CompilePollCompleted compiler_process_ids ps
= (NoFinishedCompiler,ps)
# compiler_id = find_fd_index 0 fda
# results_fd = (compiler_process_ids !! compiler_id).results_fd
# result_string = createArray 6 '\0'
# r = read results_fd result_string 6;
| r<=1
= abort ("read failed "+++toString r+++ "\n")
# exit_code = parse_result_number 0 result_string
= (FinishedCompiler compiler_id exit_code,ps)
where
fill_fda :: !CompilerProcessIds !Int !*{#Int} -> *{#Int}
......@@ -756,7 +756,7 @@ add_options_string_to_args i s args
= args
# end_i = skip_to_space_or_tab (i+1) s
= [s % (first_i,end_i-1) : add_options_string_to_args end_i s args]
where
where
skip_spaces_and_tabs i s
| i<size s
# c=s.[i]
......@@ -856,7 +856,7 @@ where
sSize Nil = 0
sSize (string :! Nil) = size string
sSize (string :! rest) = size string + 1 + sSize rest
sUpdate i s Nil = s
sUpdate i s (string :! Nil)
# (_,s) = sU (size string) i 0 s string
......@@ -865,7 +865,7 @@ where
# (i,s) = sU (size string) i 0 s string
# i = inc i
= sUpdate i s rest
sU l i j s h
| j >= l = (i,s)
# s = update s i h.[j]
......@@ -889,26 +889,26 @@ where
create_args_string args_size argv_list
# s = createArray args_size '\0'
= copy_args argv_list 0 s
where
copy_args [a:as] i s
# s = copy_chars 0 a i s
= copy_args as (i+((size a+4) bitand -4)) s
where
copy_args [a:as] i s
# s = copy_chars 0 a i s
= copy_args as (i+((size a+4) bitand -4)) s
copy_args [] i s
= s
copy_chars :: !Int !{#Char} !Int !*{#Char} -> *{#Char}
copy_chars ai a si s
| ai<size a
# s = {s & [si]=a.[ai]}
= copy_chars (ai+1) a (si+1) s
= s
create_argv argv_list args_memory
# n_args = length argv_list
# argv = createArray (n_args+1) 0;
= fill_argv 0 argv_list argv args_memory
where
fill_argv :: !Int ![{#Char}] !*{#Int} !Int -> *{#Int}
= fill_argv 0 argv_list argv args_memory
where
fill_argv :: !Int ![{#Char}] !*{#Int} !Int -> *{#Int}
fill_argv arg_n [a:as] argv args_memory
# argv = {argv & [arg_n]=args_memory}
args_memory = args_memory + ((size a+4) bitand -4)
......@@ -920,23 +920,23 @@ ApplicationOptionsToFlags :: !ApplicationOptions -> Int
ApplicationOptionsToFlags {sgc,pss,marking_collection,set,o,memoryProfiling,write_stderr_to_file,disable_rts_flags}
= showgc+printstacksize+showexectime+cons+marking_collection_mask+memory_profiling_mask+write_stderr_to_file_mask+disable_rts_flags_mask
where
showgc
showgc
| sgc = 2
= 0
printstacksize
printstacksize
| pss = 4
= 0
showexectime
| set = 8
showexectime
| set = 8
= 0
write_stderr_to_file_mask
| write_stderr_to_file = 128
| write_stderr_to_file = 128
= 0
marking_collection_mask
| marking_collection = 64
= 0
marking_collection_mask
| marking_collection = 64
= 0
memory_profiling_mask
| memoryProfiling = 32
| memoryProfiling = 32
= 0
cons
= case o of
......@@ -954,7 +954,7 @@ where
write_options_file :: !{#.Char} !.Int !.Int !.Int !.Int !.Int !.Int !Bool !*Files -> *(!Bool,!*Files)
write_options_file options_file_name flags heap_size stack_size initial_heap_size heap_size_multiple min_write_heap_size use_64_bit_processor files
# (opened,file,files)
# (opened,file,files)
= fopen options_file_name FWriteData files
| not opened
= (False,files)
......@@ -991,7 +991,7 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000068 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI 0x00000004 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000000 FWI
0x00000011 FWI 0x00000003 FWI 0x00000000 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000068 FWI
0x00000000 FWI 0x0000002c FWI 0x00000000 FWI 0x00000000 FWI
......@@ -1006,25 +1006,25 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x0000032c FWI
0x00000000 FWI 0x00000044 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI 0x00000001 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000000 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00010003 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000000 FWI
0x00000000 FWI 0x00020003 FWI 0x00000000 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000000 FWI
0x00030003 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000001 FWI 0x00020011 FWI 0x00000000 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x0000000b FWI
0x00020011 FWI 0x00000008 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000000 FWI
0x00000019 FWI 0x00020011 FWI 0x00000010 FWI
0x00000000 FWI 0x00000000 FWI 0x00000000 FWI
0x0000001f FWI
0x0000001f FWI
0x00020011 FWI 0x00000018 FWI 0x00000000 FWI 0x00000000 FWI
0x00000000 FWI
0x00000032 FWI 0x00020011 FWI 0x00000020 FWI
......@@ -1074,7 +1074,7 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz
0x657a6973 FWI 0x616c6600 FWI 0x68007367 FWI 0x5f706165 FWI
0x657a6973 FWI 0x6c756d5f FWI 0x6c706974 FWI 0x6e690065 FWI
0x61697469 FWI 0x65685f6c FWI 0x735f7061 FWI 0x00657a69)
# (close_ok,files)
# (close_ok,files)
= fclose file files
= (close_ok,files)
......
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