]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pr107421.f90: Require PIE and pass -fPIE for non-x86 targets
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 8 Sep 2025 14:47:35 +0000 (07:47 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 11 Sep 2025 13:40:47 +0000 (06:40 -0700)
-mno-direct-extern-access is used to disable direct access to external
symbol from executable with and without PIE for x86.  Require PIE and
pass -fPIE to disable direct access to external symbol for other targets.

PR fortran/107421
PR testsuite/121848
* gfortran.dg/gomp/pr107421.f90: Require PIE and pass -fPIE for
non-x86 targets.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gcc/testsuite/gfortran.dg/gomp/pr107421.f90

index db98dced8cec42f575afa483170c708779a6b832..a524db5f2af8cbca116ac7adb477675f382765a1 100644 (file)
@@ -1,4 +1,8 @@
+! { dg-require-effective-target pie }
 ! { dg-additional-options "-fdump-ipa-whole-program" }
+! Add -fPIE or -mno-direct-extern-access to disable direct access to
+! external symbol from executable.
+! { dg-additional-options "-fPIE" { target { ! { i?86-*-* x86_64-*-* } } } }
 ! { dg-additional-options "-mno-direct-extern-access" { target { i?86-*-* x86_64-*-* } } }
 
 integer :: i