Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 2019 22:08:20 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   llvm submittal 41050 created for powerpc64 C++ exception code generation: ld r2,40(r1) missing or skipped before bl __cxa_begin_catch code
Message-ID:  <0AD5D131-C5E3-424E-A276-D960ABDBDFCD@yahoo.com>

next in thread | raw e-mail | index | archive | help
I have submitted:

https://bugs.llvm.org//show_bug.cgi?id=3D41050

for the clang 8 code generation problem of
no code for setting r2 appropriately before
the:

bl . . . <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3>

in unoptimized code ( no -O ). For the -O2 code:

ld r2,40(r1)

is present but is being skipped by the libunwind return
to the code: it returns to the just-following bl
instruction (like above) instead.

In both cases:

(gdb) x/32i  0x100007c0
  0x100007c0 <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3>:	std     =
r2,40(r1)
  0x100007c4 <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+4>:	=
ld      r12,-32608(r2)
  0x100007c8 <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+8>:	=
mtctr   r12
  0x100007cc <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+12>:	=
ld      r11,-32592(r2)
  0x100007d0 <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+16>:	=
ld      r2,-32600(r2)
  0x100007d4 <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+20>:	=
bctr
  0x100007d8 <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+24>:	=
.long 0x0
  0x100007dc <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3+28>:	=
.long 0x0
. . .

with an inappropriate r2 value leads to jumping to
inappropriate places.

The example source code was:

#include <exception>

int main(void)
{
   try { throw std::exception(); }
   catch (std::exception& e) {}
   return 0;
}



Note:

This is from investigations of head -r345044 using
WITH_LLVM_LIBUNWIND=3D on powerpc64.


=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0AD5D131-C5E3-424E-A276-D960ABDBDFCD>