Improve test for function sections

master
Greta Yorsh 2019-06-26 11:28:58 +01:00
parent 3d624e83ec
commit 63f62123df
7 changed files with 28 additions and 1 deletions

View File

@ -257,6 +257,7 @@ ocamltest_config.ml: ocamltest_config.ml.in Makefile ../Makefile.config
-e 's|@@CFLAGS@@|$(OC_CFLAGS)|' \
-e 's|@@CCOMPTYPE@@|$(CCOMPTYPE)|' \
-e 's|@@WINDOWS_UNICODE@@|$(WINDOWS_UNICODE)|' \
-e 's|@@FUNCTION_SECTIONS@@|$(FUNCTION_SECTIONS)|' \
$< > $@
.PHONY: clean

View File

@ -151,6 +151,12 @@ let arch_power = make
"Target is POWER architecture"
"Target is not POWER architecture")
let function_sections = make
"function_sections"
(Actions_helpers.pass_or_skip (Ocamltest_config.function_sections)
"Target supports function sections"
"Target does not support function sections")
let has_symlink = make
"has_symlink"
(Actions_helpers.pass_or_skip (Sys.has_symlink () )
@ -215,4 +221,5 @@ let _ =
script;
check_program_output;
arch_power;
function_sections;
]

View File

@ -76,3 +76,5 @@ let bytecc_libs = "@@BYTECCLIBS@@"
let nativecc_libs = "@@NATIVECCLIBS@@"
let windows_unicode = @@WINDOWS_UNICODE@@ != 0
let function_sections = @@FUNCTION_SECTIONS@@

View File

@ -105,3 +105,7 @@ val bytecc_libs : string
val nativecc_libs : string
val windows_unicode : bool
val function_sections : bool
(** Whether the compiler was configured to generate
each function in a separate section *)

View File

@ -1,5 +1,7 @@
(* TEST
* native
* function_sections
** native
flags = "-S -function-sections"
*)
(* Test for anonymous functions which result in a mangled symbol *)

View File

@ -0,0 +1 @@
17

View File

@ -0,0 +1,10 @@
#!/bin/sh
exec > "${output}" 2>&1
# first, run the program to make sure it doesn't crash
${program}
# now check the assembly file produced during compilation
asm=${test_build_directory}/func_sections.s
grep ".section .text.camlFunc_sections__" "$asm" | wc -l | tr -d ' ' | sed '/^$/d'