This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: i386/asm-4 test: use amd64's natural addressing mode on all OSs

On Thu, Aug 15, 2019 at 1:39 PM Alexandre Oliva <> wrote:
> uses amd64's natural PC-relative addressing
> mode on a single platform, using the 32-bit absolute addressing mode
> elsewhere.  There's no point in giving up amd64's natural addressing
> mode and insisting on the 32-bit one when we're targeting amd64, and
> having to make explicit exceptions for systems where that's found not
> to work for whatever reason.  If we just use the best-suited way to
> take the address of a function behind the compiler's back on each
> target variant, we're less likely to hit unexpected failures.
> Tested on x86_64-linux-gnu with unix{,-m32}.  Ok to install?

Perhaps we should use true absolute address:

--cut here--
Index: asm-4.c
--- asm-4.c     (revision 274504)
+++ asm-4.c     (working copy)
@@ -27,12 +27,10 @@
 baz (void)
-  /* Darwin loads 64-bit regions above the 4GB boundary so
-     we need to use this instead.  */
-#if defined (__LP64__) && defined (__MACH__)
-  __asm ("leaq foo(%%rip), %0" : "=r" (fn));
+#if defined (__LP64__)
+  __asm ("movabsq $foo, %0" : "=r" (fn));
-  __asm ("movl $foo, %k0" : "=r" (fn));
+  __asm ("movl $foo, %0" : "=r" (fn));
   if (fn (2, 3, 4, 5) != 14)
     abort ();
--cut here--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]