Use switches (one already existing, one newly added here) to indicate to the binder that CUDA support code is to be generated for either the host side or for the device side. Add an invocation of Adainit on the device side from Adainit on the host side; similarly for Adafinal. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * bindgen.adb: When the binder is invoked for the host, it declares imported subprograms corresponding to the Adainit and Adafinal routines on the device. Declare string constants and expression functions for the Ada source names and the link names of these routines. Generate these subprogram declarations (and accompanying Import pragmas) in Gen_CUDA_Defs. Generate CUDA_Execute pragmas to call these subprograms from the host in Gen_Adafinal and Gen_CUDA_Init. When the binder is invoked for the device, include a CUDA_Global aspect declaration in the declarations of Adainit and Adafinal and use the aforementioned link names in the Export pragmas generated for those two routines. * debug.adb: Update comments about "d_c" and "d_d" switches. * opt.ads: Declare new Boolean variable, Enable_CUDA_Device_Expansion. This complements the existing Enable_CUDA_Expansion variable, which is used to enable host-side CUDA expansion. The new variable enables device-side CUDA expansion. It is currently never set during compilation; it is only set via a binder switch. * switch-b.adb (scan_debug_switches): Add new use of the "-d_d" binder switch. The new switch and the variable Opt.Enabled_CUDA_Device_Expansion follow the existing pattern of the "-d_c" switch and the variable Opt.Enabled_CUDA_Expansion. Flag error if both "-d_c" and "-d_d" are specified.