;;
riscv*-*-*)
- supported_defaults="abi arch tune riscv_attribute isa_spec tls"
+ supported_defaults="abi arch tune riscv_attribute isa_spec tls cmodel"
case "${target}" in
riscv-* | riscv32*) xlen=32 ;;
exit 1
esac
fi
+
+ # Handle --with-cmodel.
+ # Make sure --with-cmodel is valid. If it was not specified,
+ # use medlow as the default value.
+ case "${with_cmodel}" in
+ "" | medlow)
+ tm_defines="${tm_defines} TARGET_DEFAULT_CMODEL=CM_MEDLOW"
+ ;;
+ medany)
+ tm_defines="${tm_defines} TARGET_DEFAULT_CMODEL=CM_MEDANY"
+ ;;
+ large)
+ tm_defines="${tm_defines} TARGET_DEFAULT_CMODEL=CM_LARGE"
+ ;;
+ *)
+ echo "invalid option for --with-cmodel: '${with_cmodel}', available values are 'medlow' 'medany' 'large'" 1>&2
+ exit 1
+ ;;
+ esac
;;
mips*-*-*)
esac
t=
-all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu nan fp_32 odd_spreg_32 divide llsc mips-plt synci tls lxc1-sxc1 madd4 isa_spec compact-branches msa"
+all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu nan fp_32 odd_spreg_32 divide llsc mips-plt synci tls lxc1-sxc1 madd4 isa_spec compact-branches msa cmodel"
for option in $all_defaults
do
eval "val=\$with_"`echo $option | sed s/-/_/g`
"%{march=*:%:riscv_expand_arch(%*)} " \
"%{!march=*:%{mcpu=*:%:riscv_expand_arch_from_cpu(%*)}} "
-#define TARGET_DEFAULT_CMODEL CM_MEDLOW
-
#define LOCAL_LABEL_PREFIX "."
#define USER_LABEL_PREFIX ""
Use little endian by default. Provide a multilib for big endian.
@end table
+@item --with-cmodel=@var{cmodel}
+Specify what code model to use by default.
+Currently only implemented for riscv*-*-*.
+
@item --enable-threads
Specify that the target
supports threads. This affects the Objective-C compiler and runtime
@item -mcmodel=medlow
Generate code for the medium-low code model. The program and its statically
defined symbols must lie within a single 2 GiB address range and must lie
-between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
-statically or dynamically linked. This is the default code model.
+between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be statically
+or dynamically linked. This is the default code model unless GCC has been
+configured with @option{--with-cmodel=} specifying a different default code
+model.
@opindex mcmodel=medany
@item -mcmodel=medany