summaryrefslogtreecommitdiffhomepage
path: root/sofort
diff options
context:
space:
mode:
Diffstat (limited to 'sofort')
-rw-r--r--sofort/ccenv/ccenv.in7
-rw-r--r--sofort/ccenv/ccenv.sh72
-rw-r--r--sofort/ccenv/ccenv.vars6
-rw-r--r--sofort/ccenv/ccswitch.strs1
-rw-r--r--sofort/cfgtest/cfgtest.sh77
-rw-r--r--sofort/config/config.vars1
6 files changed, 148 insertions, 16 deletions
diff --git a/sofort/ccenv/ccenv.in b/sofort/ccenv/ccenv.in
index 441f8ab..0daff84 100644
--- a/sofort/ccenv/ccenv.in
+++ b/sofort/ccenv/ccenv.in
@@ -84,8 +84,13 @@ PKGCONF = @ccenv_pkgconf@
AS = @ccenv_as@
LD = @ccenv_ld@
+# @ccenv_cfgtype@ visibility attributes
+CFLAGS_ATTR_VISIBILITY_DEFAULT = -D_ATTR_VISIBILITY_DEFAULT=@ccenv_attr_visibility_default@
+CFLAGS_ATTR_VISIBILITY_HIDDEN = -D_ATTR_VISIBILITY_HIDDEN=@ccenv_attr_visibility_hidden@
+CFLAGS_ATTR_VISIBILITY_INTERNAL = -D_ATTR_VISIBILITY_INTERNAL=@ccenv_attr_visibility_internal@
+CFLAGS_ATTR_VISIBILITY_PROTECTED = -D_ATTR_VISIBILITY_PROTECTED=@ccenv_attr_visibility_protected@
+
# @ccenv_cfgtype@ cflags
CFLAGS_OS += -DOS_LIB_SUFFIX=\"@ccenv_os_lib_suffix@\"
CFLAGS_OS += @ccenv_cflags_os@
CFLAGS_PIC += @ccenv_cflags_pic@
-
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index a13aa07..d975c6b 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -1118,14 +1118,20 @@ ccenv_set_os()
fi
case "$ccenv_cchost" in
- *-*-*-* )
- ccenv_tip=${ccenv_cchost%-*}
- ccenv_os=${ccenv_tip#*-*-}
- ;;
*-*-musl | *-*-gnu )
ccenv_tip=${ccenv_cchost%-*}
ccenv_os=${ccenv_tip#*-}
;;
+ *-*-solaris* )
+ ccenv_os='solaris'
+ ;;
+ *-*-*bsd* | *-*-dragonfly* )
+ ccenv_os='bsd'
+ ;;
+ *-*-*-* )
+ ccenv_tip=${ccenv_cchost%-*}
+ ccenv_os=${ccenv_tip#*-*-}
+ ;;
*-*-* )
ccenv_os=${ccenv_cchost#*-*-}
;;
@@ -1412,6 +1418,42 @@ ccenv_set_os_pe_switches()
;;
esac
fi
+
+ if [ "$ccenv_cc_binfmt" = 'PE' ]; then
+ if ! cfgtest_macro_definition '__PE__'; then
+ ccenv_cflags_os="${ccenv_cflags_os} -D__PE__"
+ fi
+
+ if ! cfgtest_macro_definition '__dllexport'; then
+ ccenv_cflags_os="${ccenv_cflags_os} -D__dllexport=__attribute__\(\(__dllexport__\)\)"
+ fi
+
+ if ! cfgtest_macro_definition '__dllimport'; then
+ ccenv_cflags_os="${ccenv_cflags_os} -D__dllimport=__attribute__\(\(__dllimport__\)\)"
+ fi
+ fi
+}
+
+ccenv_set_os_gate_switches()
+{
+ if [ "$ccenv_os" = 'solaris' ]; then
+ if ! cfgtest_macro_definition 'AT_FDCWD'; then
+ ccenv_cflags_os="${ccenv_cflags_os} -D__EXTENSIONS__"
+ fi
+ fi
+}
+
+ccenv_set_os_bsd_switches()
+{
+ if [ "$ccenv_os" = 'bsd' ]; then
+ mb_cfgtest_headers='sys/mman.h'
+
+ if ! cfgtest_macro_definition 'MAP_ANON'; then
+ ccenv_cflags_os="${ccenv_cflags_os} -D__BSD_VISIBLE"
+ fi
+
+ mb_cfgtest_headers=
+ fi
}
ccenv_output_defs()
@@ -1654,6 +1696,25 @@ ccenv_set_cc_linker_switch_vars()
done
}
+ccenv_set_cc_attr_visibility_vars()
+{
+ if cfgtest_attr_visibility 'default'; then
+ ccenv_attr_visibility_default="$mb_cfgtest_attr"
+ fi
+
+ if cfgtest_attr_visibility 'hidden'; then
+ ccenv_attr_visibility_hidden="$mb_cfgtest_attr"
+ fi
+
+ if cfgtest_attr_visibility 'internal'; then
+ ccenv_attr_visibility_internal="$mb_cfgtest_attr"
+ fi
+
+ if cfgtest_attr_visibility 'protected'; then
+ ccenv_attr_visibility_protected="$mb_cfgtest_attr"
+ fi
+}
+
ccenv_dso_verify()
{
ccenv_str='int foo(int x){return ++x;}'
@@ -1760,6 +1821,9 @@ ccenv_set_toolchain_variables()
ccenv_set_os_dso_linkage
ccenv_set_os_dso_patterns
ccenv_set_os_pe_switches
+ ccenv_set_os_gate_switches
+ ccenv_set_os_bsd_switches
+ ccenv_set_cc_attr_visibility_vars
ccenv_output_defs
ccenv_clean_up
diff --git a/sofort/ccenv/ccenv.vars b/sofort/ccenv/ccenv.vars
index 41eb327..054b638 100644
--- a/sofort/ccenv/ccenv.vars
+++ b/sofort/ccenv/ccenv.vars
@@ -82,6 +82,12 @@ ccenv_windrc=
ccenv_pkgconf=
+# visibility attributes
+ccenv_attr_visibility_default=
+ccenv_attr_visibility_hidden=
+ccenv_attr_visibility_internal=
+ccenv_attr_visibility_protected=
+
# cflags
ccenv_cflags_os=
ccenv_cflags_pic=
diff --git a/sofort/ccenv/ccswitch.strs b/sofort/ccenv/ccswitch.strs
index 0a76f03..277e02e 100644
--- a/sofort/ccenv/ccswitch.strs
+++ b/sofort/ccenv/ccswitch.strs
@@ -34,6 +34,7 @@
-Werror
-Wextra
-Wundef
+-Wpedantic
# debugging
-g
diff --git a/sofort/cfgtest/cfgtest.sh b/sofort/cfgtest/cfgtest.sh
index debdb8c..8e1db07 100644
--- a/sofort/cfgtest/cfgtest.sh
+++ b/sofort/cfgtest/cfgtest.sh
@@ -15,6 +15,7 @@
# mb_cfgtest_cfgtype: the type of the current test (host/native)
# mb_cfgtest_makevar: the make variable affected by the current test
# mb_cfgtest_headers: headers for ad-hoc inclusion with the current test
+# mb_cfgtest_attr: if supported, the compiler-specific attribute definition
cfgtest_newline()
@@ -131,6 +132,15 @@ cfgtest_epilog()
return 1
fi
+ if [ "${1}" = 'attr' ] && [ "${2}" = '(error)' ]; then
+ printf '\n\ncfgtest: the %s compiler %s %s_ attribute.\n' \
+ "$mb_cfgtest_cfgtype" \
+ 'does not appear to support the _' \
+ "${3}" >&3
+ printf '%s\n' '------------------------' >&3
+ return 1
+ fi
+
if [ "${2}" = '-----' ] || [ "${2}" = '(missing)' ]; then
printf '\n\ncfgtest: %s %s is missing or cannot be found.\n' "${1}" "${3}" >&3
printf '%s\n' '------------------------' >&3
@@ -246,6 +256,8 @@ cfgtest_common_init()
fi
elif [ "$cfgtest_type" = 'asm' ]; then
cfgtest_fmt='%s -c -xc - -o a.out'
+ elif [ "$cfgtest_type" = 'attr' ]; then
+ cfgtest_fmt='%s -c -xc - -o a.out -Werror'
elif [ "$cfgtest_type" = 'lib' ]; then
cfgtest_fmt='%s -xc - -o a.out'
elif [ "$cfgtest_type" = 'ldflag' ]; then
@@ -330,11 +342,16 @@ cfgtest_header_presence()
cfgtest_prolog 'header' "${1}"
cfgtest_code_snippet=$(printf '#include <%s>\n' "${1}")
+ cfgtest_code_onedecl='int fn(void){return 0;}'
+
+ cfgtest_code_snippet=$(printf '%s\n%s\n' \
+ "$cfgtest_code_snippet" \
+ "$cfgtest_code_onedecl")
cfgtest_common_init
# execute
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'header' '-----' "<${1}>" \
@@ -365,11 +382,16 @@ cfgtest_header_absence()
cfgtest_prolog 'header absence' "${1}"
cfgtest_code_snippet=$(printf '#include <%s>\n' "${1}")
+ cfgtest_code_onedecl='int fn(void){return 0;}'
+
+ cfgtest_code_snippet=$(printf '%s\n%s\n' \
+ "$cfgtest_code_snippet" \
+ "$cfgtest_code_onedecl")
cfgtest_common_init
# execute
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
&& printf 'cfgtest: %s header <%s>: no error.' \
@@ -406,7 +428,7 @@ cfgtest_interface_presence()
cfgtest_common_init
# execute
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'interface' '(error)' "${1}" \
@@ -443,7 +465,7 @@ cfgtest_decl_presence()
cfgtest_common_init
# execute
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'decl' '(error)' "${1}" \
@@ -496,7 +518,7 @@ cfgtest_type_size()
cfgtest_common_init
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
&& mb_internal_size=$mb_internal_guess
@@ -534,6 +556,39 @@ cfgtest_type_size()
}
+cfgtest_attr_visibility()
+{
+ # init
+ cfgtest_prolog 'compiler visibility attr' "${1}"
+
+ cfgtest_attr_syntax='__attribute__((__visibility__("'"${1}"'")))'
+ cfgtest_code_snippet="$cfgtest_attr_syntax"' int f_'"${1}"'(void);'
+
+ cfgtest_common_init 'attr'
+
+ # execute
+ cfgtest_ret=1
+
+ printf '%s\n' "$cfgtest_src" \
+ | eval $(printf '%s' "$cfgtest_cmd") \
+ > /dev/null 2>&3 \
+ || cfgtest_epilog 'attr' '(error)' "${1}" \
+ || return
+
+ # result
+ mb_cfgtest_attr=$(printf '__attribute__\\(\\(__visibility__\\(\\"%s\\"\\)\\)\\)' "${1}")
+
+ cfgtest_ret=0
+
+ printf 'cfgtest: %s compiler: above attribute is supported; see also ccenv/%s.mk.\n\n' \
+ "$mb_cfgtest_cfgtype" "$mb_cfgtest_cfgtype" >&3
+
+ cfgtest_epilog 'attr' '(ok)'
+
+ return 0
+}
+
+
cfgtest_code_snippet_asm()
{
# init
@@ -546,7 +601,7 @@ cfgtest_code_snippet_asm()
# execute
cfgtest_ret=1
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'snippet' '(error)' \
@@ -579,7 +634,7 @@ cfgtest_macro_definition()
# execute
cfgtest_ret=1
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'macro' '(error)' "${1}" \
@@ -627,7 +682,7 @@ cfgtest_library_presence()
cfgtest_common_init 'lib'
# execute
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'library' '-----' "$@" \
@@ -805,20 +860,20 @@ cfgtest_compiler_switch()
;;
*)
- cfgtest_code_snippet=
+ cfgtest_code_snippet='int fn(void){return 0;}'
cfgtest_common_init 'switch'
;;
esac
# execute
- printf '%s' "$cfgtest_src" \
+ printf '%s\n' "$cfgtest_src" \
| eval $(printf '%s' "$cfgtest_cmd") \
> /dev/null 2>&3 \
|| cfgtest_epilog 'switch' '(error)' "$@" \
|| return 1
# result
- printf 'cfgtest: the switch `%s was accepted by the compier.\n' \
+ printf 'cfgtest: the switch `%s was accepted by the compiler.\n' \
"$cfgtest_switches'" >&3
printf '%s\n' '------------------------' >&3
diff --git a/sofort/config/config.vars b/sofort/config/config.vars
index 0c01a29..38d5616 100644
--- a/sofort/config/config.vars
+++ b/sofort/config/config.vars
@@ -54,6 +54,7 @@ zealous
sysroot
freestanding
cross_compile
+config_shell
shell
pkgconf