[gcc r17-2686] gcn: mkoffload - pass -L<dir> on to the amdgcn-amdhsa linker
Tobias Burnus via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:5fbbf2d12c6eac56d83930336ea7093de7c56bb5 commit r17-2686-g5fbbf2d12c6eac56d83930336ea7093de7c56bb5 Author: Tobias Burnus <[email protected]> Date: Fri Jul 24 14:27:03 2026 +0200 gcn: mkoffload - pass -L<dir> on to the amdgcn-amdhsa linker Add a way to specify a linker-search path to the amdgcn-amdhsa/collect2 linker call, which is in particular useful as '.' (current directory) is not in the search path. Note that the -L specified to the host compiler are not passed to mkoffload, i.e. only using a flag like --offload-options="-L." will affect the linker search path. gcc/ChangeLog: * config/gcn/mkoffload.cc (main): Pass -L<dir> on to the device compiler. Diff: --- gcc/config/gcn/mkoffload.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 71e11f0f307b..65bd81b9ba42 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -1333,9 +1333,15 @@ main (int argc, char **argv) obstack_ptr_grow (&ld_argv_obstack, "-save-temps"); for (int i = 1; i < argc; i++) - if (startswith (argv[i], "-l") - || startswith (argv[i], "-Wl") - || startswith (argv[i], "-march")) + if (strcmp (argv[i], "-L") == 0 && i + 1 < argc) + { + obstack_ptr_grow (&ld_argv_obstack, argv[i]); + obstack_ptr_grow (&ld_argv_obstack, argv[++i]); + } + else if (startswith (argv[i], "-l") + || startswith (argv[i], "-L") + || startswith (argv[i], "-Wl") + || startswith (argv[i], "-march")) obstack_ptr_grow (&ld_argv_obstack, argv[i]); obstack_ptr_grow (&cc_argv_obstack, "-dumpdir");