On Thu, 8 Aug 2024, Prathamesh Kulkarni wrote: > Hi Richard, > After differing NUM_POLY_INT_COEFFS fix for AArch64/nvptx offloading, the > following minimal test: > > int main() > { > int x; > #pragma omp target map(x) > x = 5; > return x; > } > > compiled with -fopenmp -foffload=nvptx-none now fails with: > gcc: error: unrecognized command-line option '-m64' > nvptx mkoffload: fatal error: ../install/bin/gcc returned 1 exit status > compilation terminated. > > As mentioned in RFC email, this happens because > nvptx/mkoffload.cc:compile_native passes -m64/-m32 to host compiler depending > on whether > offload_abi is OFFLOAD_ABI_LP64 or OFFLOAD_ABI_ILP32, and aarch64 backend > doesn't recognize these options. > > Based on your suggestion in: > https://gcc.gnu.org/pipermail/gcc/2024-July/244470.html, > The attached patch generates new macro HOST_MULTILIB derived from > $enable_as_accelerator_for, and in mkoffload.cc it gates passing -m32/-m64 > to host_compiler on HOST_MULTILIB. I verified that the macro is set to 0 for > aarch64 host (and thus avoids above unrecognized command line option error), > and is set to 1 for x86_64 host. > > Does the patch look OK ?
The patch looks reasonable to me. Thanks, Richard. > Signed-off-by: Prathamesh Kulkarni <prathame...@nvidia.com> > > Thanks, > Prathamesh > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)