# HG changeset patch
# Parent 02789d700fe014df8358c45b8dc09a6b104fbb6b
Clear hwcap_2 with Sun ld
new file mode 100644
@@ -0,0 +1,7 @@
+# clear all hardware capabilities emitted by Sun as: the tests here
+# guard against execution at runtime
+# uses mapfile v2 syntax which is the only way to clear AT_SUN_CAP_HW2 flags
+$mapfile_version 2
+CAPABILITY {
+ HW = ;
+};
@@ -256,12 +256,23 @@ proc check_effective_target_rtm { } {
# If the linker used understands -M <mapfile>, pass it to clear hardware
# capabilities set by the Sun assembler.
-set clearcap_ldflags "-Wl,-M,$srcdir/$subdir/clearcap.map"
+# Try mapfile syntax v2 first which is the only way to clear hwcap_2 flags.
+set clearcap_ldflags "-Wl,-M,$srcdir/$subdir/clearcapv2.map"
-if [check_no_compiler_messages mapfile executable {
+if ![check_no_compiler_messages mapfilev2 executable {
+ int main (void) { return 0; }
+} $clearcap_ldflags ] {
+ # If this doesn't work, fall back to the less capable v1 syntax.
+ set clearcap_ldflags "-Wl,-M,$srcdir/$subdir/clearcap.map"
+
+ if ![check_no_compiler_messages mapfile executable {
int main (void) { return 0; }
- } $clearcap_ldflags ] {
+ } $clearcap_ldflags ] {
+ unset clearcap_ldflags
+ }
+}
+if [info exists clearcap_ldflags] {
if { [info procs gcc_target_compile] != [list] \
&& [info procs saved_gcc_target_compile] == [list] } {
rename gcc_target_compile saved_gcc_target_compile