Thomas recently improved the offload experience by avoiding to use, e.g.

  gfortran -O3 -fopenmp qcd.f90 -lblas -foffload-options="-lgfortran -lm"

as libm and libgfortran now automatically get linked as 'gfortran' links
-lgfortran and -lm on the host (only those libraries, not others). Thus,
the commandline now looks much more natural:

  gfortran -O3 -fopenmp qcd.f90 -lblas

→ https.//gcc.gnu.org/r14-1807-g4bcb46b3ade179 for the code change.

Attached patch documents it in the release notes.
I loved to hear comments, suggestions, improvements (or even appraisals).

If not, I just will commit it eventually as is - and it has to be improved
later on ...

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955
gcc-14/changes.htm - Offloading: -lm/-lgfortran is autolinked

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index c403c94f..96653f05 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -51,6 +51,15 @@ a work-in-progress.</p>
       was extended.
     </li>
   </ul>
+  </li>
+  <li>For offload-device code generated via OpenMP and OpenACC, the math
+      library and the Fortran runtime library will now automatically be linked,
+      when the user or compiler links them on the host side. Thus, it is no
+      longer required to explicitly pass <code>-lm</code> and/or
+      <code>-lgfortran</code> to the offload-device linker using the <a
+      href="https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-foffload-options";
+      ><code>-foffload-options=</code></a> flag.
+  </li>
 </ul>
 <!-- .................................................................. -->
 <h2 id="languages">New Languages and Language specific improvements</h2>

Reply via email to