Skip to content

Commit e96c674

Browse files
committed
otp: Add -fzero-call-used-regs=used to default compiler options
1 parent a541094 commit e96c674

8 files changed

Lines changed: 623 additions & 0 deletions

File tree

erts/configure

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6594,6 +6594,74 @@ printf "%s\n" "no" >&6; }
65946594
esac
65956595
fi
65966596

6597+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6598+
/* end confdefs.h. */
6599+
6600+
int
6601+
main (void)
6602+
{
6603+
6604+
#if defined(__clang_major__) && __clang_major__ >= 17
6605+
/* clang 17.x or later is fine, clang 16 has a bug win this feature */
6606+
#elif defined(__llvm__)
6607+
#error "this version of llvm does not have or has a bug in the fzero-call-used-regs implementation"
6608+
#endif
6609+
6610+
;
6611+
return 0;
6612+
}
6613+
_ACEOF
6614+
if ac_fn_c_try_compile "$LINENO"
6615+
then :
6616+
6617+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to CFLAGS (via CFLAGS)" >&5
6618+
printf %s "checking if we can add -fzero-call-used-regs=used to CFLAGS (via CFLAGS)... " >&6; }
6619+
saved_CFLAGS=$CFLAGS;
6620+
CFLAGS="-Werror -fzero-call-used-regs=used $CFLAGS";
6621+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6622+
/* end confdefs.h. */
6623+
6624+
int
6625+
main (void)
6626+
{
6627+
return 0;
6628+
;
6629+
return 0;
6630+
}
6631+
_ACEOF
6632+
if ac_fn_c_try_compile "$LINENO"
6633+
then :
6634+
can_enable_flag=true
6635+
else case e in #(
6636+
e) can_enable_flag=false ;;
6637+
esac
6638+
fi
6639+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
6640+
CFLAGS=$saved_CFLAGS;
6641+
if test "X$can_enable_flag" = "Xtrue"
6642+
then :
6643+
6644+
CFLAGS="-fzero-call-used-regs=used $CFLAGS"
6645+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6646+
printf "%s\n" "yes" >&6; }
6647+
6648+
else case e in #(
6649+
e)
6650+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
6651+
printf "%s\n" "no" >&6; }
6652+
;;
6653+
esac
6654+
fi
6655+
6656+
else case e in #(
6657+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to CFLAGS" >&5
6658+
printf %s "checking if we can add -fzero-call-used-regs=used to CFLAGS... " >&6; }
6659+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, too old clang" >&5
6660+
printf "%s\n" "no, too old clang" >&6; }
6661+
;;
6662+
esac
6663+
fi
6664+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
65976665

65986666
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)" >&5
65996667
printf %s "checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)... " >&6; }
@@ -29442,6 +29510,74 @@ printf "%s\n" "no" >&6; }
2944229510
esac
2944329511
fi
2944429512

29513+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29514+
/* end confdefs.h. */
29515+
29516+
int
29517+
main (void)
29518+
{
29519+
29520+
#if defined(__clang_major__) && __clang_major__ >= 17
29521+
/* clang 17.x or later is fine, clang 16 has a bug win this feature */
29522+
#elif defined(__llvm__)
29523+
#error "this version of llvm does not have or has a bug in the fzero-call-used-regs implementation"
29524+
#endif
29525+
29526+
;
29527+
return 0;
29528+
}
29529+
_ACEOF
29530+
if ac_fn_c_try_compile "$LINENO"
29531+
then :
29532+
29533+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to DED_CFLAGS (via CFLAGS)" >&5
29534+
printf %s "checking if we can add -fzero-call-used-regs=used to DED_CFLAGS (via CFLAGS)... " >&6; }
29535+
saved_CFLAGS=$CFLAGS;
29536+
CFLAGS="-Werror -fzero-call-used-regs=used $DED_CFLAGS";
29537+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29538+
/* end confdefs.h. */
29539+
29540+
int
29541+
main (void)
29542+
{
29543+
return 0;
29544+
;
29545+
return 0;
29546+
}
29547+
_ACEOF
29548+
if ac_fn_c_try_compile "$LINENO"
29549+
then :
29550+
can_enable_flag=true
29551+
else case e in #(
29552+
e) can_enable_flag=false ;;
29553+
esac
29554+
fi
29555+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
29556+
CFLAGS=$saved_CFLAGS;
29557+
if test "X$can_enable_flag" = "Xtrue"
29558+
then :
29559+
29560+
DED_CFLAGS="-fzero-call-used-regs=used $DED_CFLAGS"
29561+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
29562+
printf "%s\n" "yes" >&6; }
29563+
29564+
else case e in #(
29565+
e)
29566+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
29567+
printf "%s\n" "no" >&6; }
29568+
;;
29569+
esac
29570+
fi
29571+
29572+
else case e in #(
29573+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to DED_CFLAGS" >&5
29574+
printf %s "checking if we can add -fzero-call-used-regs=used to DED_CFLAGS... " >&6; }
29575+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, too old clang" >&5
29576+
printf "%s\n" "no, too old clang" >&6; }
29577+
;;
29578+
esac
29579+
fi
29580+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
2944529581

2944629582
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5
2944729583
printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; }

lib/crypto/configure

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6308,6 +6308,74 @@ printf "%s\n" "no" >&6; }
63086308
esac
63096309
fi
63106310

6311+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6312+
/* end confdefs.h. */
6313+
6314+
int
6315+
main (void)
6316+
{
6317+
6318+
#if defined(__clang_major__) && __clang_major__ >= 17
6319+
/* clang 17.x or later is fine, clang 16 has a bug win this feature */
6320+
#elif defined(__llvm__)
6321+
#error "this version of llvm does not have or has a bug in the fzero-call-used-regs implementation"
6322+
#endif
6323+
6324+
;
6325+
return 0;
6326+
}
6327+
_ACEOF
6328+
if ac_fn_c_try_compile "$LINENO"
6329+
then :
6330+
6331+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to DED_CFLAGS (via CFLAGS)" >&5
6332+
printf %s "checking if we can add -fzero-call-used-regs=used to DED_CFLAGS (via CFLAGS)... " >&6; }
6333+
saved_CFLAGS=$CFLAGS;
6334+
CFLAGS="-Werror -fzero-call-used-regs=used $DED_CFLAGS";
6335+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6336+
/* end confdefs.h. */
6337+
6338+
int
6339+
main (void)
6340+
{
6341+
return 0;
6342+
;
6343+
return 0;
6344+
}
6345+
_ACEOF
6346+
if ac_fn_c_try_compile "$LINENO"
6347+
then :
6348+
can_enable_flag=true
6349+
else case e in #(
6350+
e) can_enable_flag=false ;;
6351+
esac
6352+
fi
6353+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
6354+
CFLAGS=$saved_CFLAGS;
6355+
if test "X$can_enable_flag" = "Xtrue"
6356+
then :
6357+
6358+
DED_CFLAGS="-fzero-call-used-regs=used $DED_CFLAGS"
6359+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6360+
printf "%s\n" "yes" >&6; }
6361+
6362+
else case e in #(
6363+
e)
6364+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
6365+
printf "%s\n" "no" >&6; }
6366+
;;
6367+
esac
6368+
fi
6369+
6370+
else case e in #(
6371+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to DED_CFLAGS" >&5
6372+
printf %s "checking if we can add -fzero-call-used-regs=used to DED_CFLAGS... " >&6; }
6373+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, too old clang" >&5
6374+
printf "%s\n" "no, too old clang" >&6; }
6375+
;;
6376+
esac
6377+
fi
6378+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
63116379

63126380
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5
63136381
printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; }

lib/erl_interface/configure

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5894,6 +5894,74 @@ printf "%s\n" "no" >&6; }
58945894
esac
58955895
fi
58965896

5897+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5898+
/* end confdefs.h. */
5899+
5900+
int
5901+
main (void)
5902+
{
5903+
5904+
#if defined(__clang_major__) && __clang_major__ >= 17
5905+
/* clang 17.x or later is fine, clang 16 has a bug win this feature */
5906+
#elif defined(__llvm__)
5907+
#error "this version of llvm does not have or has a bug in the fzero-call-used-regs implementation"
5908+
#endif
5909+
5910+
;
5911+
return 0;
5912+
}
5913+
_ACEOF
5914+
if ac_fn_c_try_compile "$LINENO"
5915+
then :
5916+
5917+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to DED_CFLAGS (via CFLAGS)" >&5
5918+
printf %s "checking if we can add -fzero-call-used-regs=used to DED_CFLAGS (via CFLAGS)... " >&6; }
5919+
saved_CFLAGS=$CFLAGS;
5920+
CFLAGS="-Werror -fzero-call-used-regs=used $DED_CFLAGS";
5921+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5922+
/* end confdefs.h. */
5923+
5924+
int
5925+
main (void)
5926+
{
5927+
return 0;
5928+
;
5929+
return 0;
5930+
}
5931+
_ACEOF
5932+
if ac_fn_c_try_compile "$LINENO"
5933+
then :
5934+
can_enable_flag=true
5935+
else case e in #(
5936+
e) can_enable_flag=false ;;
5937+
esac
5938+
fi
5939+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
5940+
CFLAGS=$saved_CFLAGS;
5941+
if test "X$can_enable_flag" = "Xtrue"
5942+
then :
5943+
5944+
DED_CFLAGS="-fzero-call-used-regs=used $DED_CFLAGS"
5945+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
5946+
printf "%s\n" "yes" >&6; }
5947+
5948+
else case e in #(
5949+
e)
5950+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5951+
printf "%s\n" "no" >&6; }
5952+
;;
5953+
esac
5954+
fi
5955+
5956+
else case e in #(
5957+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to DED_CFLAGS" >&5
5958+
printf %s "checking if we can add -fzero-call-used-regs=used to DED_CFLAGS... " >&6; }
5959+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, too old clang" >&5
5960+
printf "%s\n" "no, too old clang" >&6; }
5961+
;;
5962+
esac
5963+
fi
5964+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
58975965

58985966
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5
58995967
printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; }
@@ -11125,6 +11193,74 @@ printf "%s\n" "no" >&6; }
1112511193
esac
1112611194
fi
1112711195

11196+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11197+
/* end confdefs.h. */
11198+
11199+
int
11200+
main (void)
11201+
{
11202+
11203+
#if defined(__clang_major__) && __clang_major__ >= 17
11204+
/* clang 17.x or later is fine, clang 16 has a bug win this feature */
11205+
#elif defined(__llvm__)
11206+
#error "this version of llvm does not have or has a bug in the fzero-call-used-regs implementation"
11207+
#endif
11208+
11209+
;
11210+
return 0;
11211+
}
11212+
_ACEOF
11213+
if ac_fn_c_try_compile "$LINENO"
11214+
then :
11215+
11216+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to CFLAGS (via CFLAGS)" >&5
11217+
printf %s "checking if we can add -fzero-call-used-regs=used to CFLAGS (via CFLAGS)... " >&6; }
11218+
saved_CFLAGS=$CFLAGS;
11219+
CFLAGS="-Werror -fzero-call-used-regs=used $CFLAGS";
11220+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11221+
/* end confdefs.h. */
11222+
11223+
int
11224+
main (void)
11225+
{
11226+
return 0;
11227+
;
11228+
return 0;
11229+
}
11230+
_ACEOF
11231+
if ac_fn_c_try_compile "$LINENO"
11232+
then :
11233+
can_enable_flag=true
11234+
else case e in #(
11235+
e) can_enable_flag=false ;;
11236+
esac
11237+
fi
11238+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
11239+
CFLAGS=$saved_CFLAGS;
11240+
if test "X$can_enable_flag" = "Xtrue"
11241+
then :
11242+
11243+
CFLAGS="-fzero-call-used-regs=used $CFLAGS"
11244+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
11245+
printf "%s\n" "yes" >&6; }
11246+
11247+
else case e in #(
11248+
e)
11249+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
11250+
printf "%s\n" "no" >&6; }
11251+
;;
11252+
esac
11253+
fi
11254+
11255+
else case e in #(
11256+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fzero-call-used-regs=used to CFLAGS" >&5
11257+
printf %s "checking if we can add -fzero-call-used-regs=used to CFLAGS... " >&6; }
11258+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, too old clang" >&5
11259+
printf "%s\n" "no, too old clang" >&6; }
11260+
;;
11261+
esac
11262+
fi
11263+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
1112811264

1112911265
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)" >&5
1113011266
printf %s "checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)... " >&6; }

0 commit comments

Comments
 (0)