Back in February I reported (
http://www.open-mpi.org/community/lists/devel/2015/02/17073.php) that when
building master on Linux with the Solaris Studio compilers and -m32 I saw
the following:

/bin/sh ../../../libtool --tag=CC --mode=link cc -m32 -g -mt
 -export-dynamic -o opal_wrapper opal_wrapper.o ../../../opal/
libopen-pal.la -lrt -lm -lutil -lrt -lm -lutil
libtool: link: cc -m32 -g -mt -o .libs/opal_wrapper opal_wrapper.o
-Wl,--export-dynamic ../../../opal/.libs/libopen-pal.so -ldl -lrt -lm
-lutil -mt -Wl,-rpath
-Wl,/scratch/phargrov/OMPI/openmpi-master-linux-x86_64-ss12u4-m32/INST/lib
../../../opal/.libs/libopen-pal.so: undefined reference to `ebx'

Where obviously 'ebx' should be a register, not a symbol.

Nobody got back to me on that, but I figured it out this morning.
The 2-line patch below fixed this issue for me.

It looks like the gcc asm syntax for multiple assembler dialects (search
for "dialects" in https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html) is
not supported by the Studio compilers.
Since there doesn't appear to be any real effort to support Intel asm
syntax (vs the ATT syntax used by gas) elsewhere in Open MPI, it is kind of
pointless to do it just in this one header.
So, I believe that the "{l}" on the changed lines can/should also be
changed to bare "l".


On a related note:
As of gcc-5.1 (released in April), ebx is now scheduled as an other
register and not reserved to be the GOT pointer.
So, the
    xchgl %%ebx, %1
could (I think) now become
    xchgl  %%ebx,%%ebx
which is not going to have the desired effect of preserving %ebx across the
cpuid instruction.
However the problem only occurs if "b" is a member of the "r" class, which
I have not verified.
*IF* the problem can occur, then one fix would be to change "=r" to
something like "=SD".

-Paul


--- opal/include/opal/sys/ia32/timer.h.orig     2015-07-01
08:12:59.357980816 -0700
+++ opal/include/opal/sys/ia32/timer.h  2015-07-01 07:59:36.452918286 -0700
@@ -35,9 +35,9 @@
     int tmp;

     __asm__ __volatile__(
-                         "xchg{l} {%%}ebx, %1\n"
+                         "xchg{l} %%ebx, %1\n"
                          "cpuid\n"
-                         "xchg{l} {%%}ebx, %1\n"
+                         "xchg{l} %%ebx, %1\n"
                          "rdtsc\n"
                          : "=A"(ret), "=r"(tmp)
                          :: "ecx");


-- 
Paul H. Hargrove                          phhargr...@lbl.gov
Computer Languages & Systems Software (CLaSS) Group
Computer Science Department               Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900

Reply via email to