Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

porting included libunwind to powerpc-darwin8 #17512

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR17513
Status NEW
Importance P normal
Reported by David Fang (fang@csl.cornell.edu)
Reported on 2013-10-08 15:29:56 -0700
Last modified on 2016-11-02 13:57:57 -0700
Version unspecified
Hardware Macintosh MacOS X
CC jeremyhu@apple.com, jsweval@arxan.com, kledzik@apple.com, vq@larryv.me
Fixed by commit(s)
Attachments PR17505.s (8569 bytes, text/plain)
PR17505.gcc-s (6082 bytes, text/plain)
no-builtin_unreachable.patch (657 bytes, text/plain)
libunwind-fallback-x86_64.patch (553 bytes, text/plain)
Blocks
Blocked by PR22202, PR22198, PR22200, PR22203, PR22270
See also PR17505
This 'bug' serves as a placeholder to track progress on porting libunwind (now
included with libcxxabi) to darwin8.  I've already taken care of some trivial
compilations issues in my local branch, such as including
>AvailabilityMacros.h>, and preproecssing the UnwindRegister{Save,Restore} asm
files.

The next hurdle to clear is that _dyld_find_unwind_sections() is unimplemented
and unavailable (not even privately) on darwin8.  On 10.6+, it is found in mach-
o/dyld_priv.h.  We need a replacement implementation.

Remaining compile error:
% make
ccache /Volumes/Isolde/builds/LLVM/gcc40-cmake-build/bin/clang++ -O2  -
std=c++0x -stdlib=libc++ -Wmismatched-tags -fstrict-aliasing -Wstrict-
aliasing=2 -Wsign-conversion -Wshadow -Wconversion -Wunused-variable -Wmissing-
field-initializers -Wchar-subscripts -Wmissing-braces -Wshorten-64-to-32 -Wsign-
compare -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wnewline-
eof -fPIC -fno-common -no-integrated-as -I../include  -cxx-isystem
/Users/fang/local/src/LLVM-svn/libcxx.git/include -c
../src/Unwind/Unwind_AppleExtras.cpp -o Unwind/Unwind_AppleExtras.o
In file included from ../src/Unwind/Unwind_AppleExtras.cpp:12:
In file included from ../src/Unwind/DwarfParser.hpp:25:
../src/Unwind/AddressSpace.hpp:227:3: error: unknown type name
'dyld_unwind_sections'
  dyld_unwind_sections dyldInfo;
  ^
../src/Unwind/Unwind_AppleExtras.cpp:188:10: fatal error:
'System/pthread_machdep.h' file not found
#include <System/pthread_machdep.h>
         ^
2 errors generated.
make: *** [Unwind/Unwind_AppleExtras.o] Error 1
Quuxplusone commented 10 years ago
For reference, I've found:
http://www.opensource.apple.com/source/dyld/dyld-132.13/include/mach-o/dyld_priv.h
-- declares struct dyld_unwind_sections
http://www.opensource.apple.com/source/dyld/dyld-132.13/src/dyldExceptions.c
-- implements _dyld_find_unwind_sections()
Quuxplusone commented 10 years ago
or find an alternative way to implement on darwin8 (Unwind/AddressSpace.hpp):
bool LocalAddressSpace::findUnwindSections(pint_t, UnwindInfoSections&);
Quuxplusone commented 10 years ago
Comment on attachment 11548
gcc-4.0.1 asm

wrong bug, sorry
Quuxplusone commented 10 years ago

Attached PR17505.s (8569 bytes, text/plain): gcc-4.0.1 asm

Quuxplusone commented 10 years ago
Comment on attachment 11549
clang asm of PR17505.cpp

wrong bug, sorry.
Quuxplusone commented 10 years ago

Attached PR17505.gcc-s (6082 bytes, text/plain): clang asm of PR17505.cpp

Quuxplusone commented 10 years ago

Just noting here: until one wishes to build a toolchain from the ground-up (not using system libraries) it's probably not worth pursuing this route. Either have libc++abi link against system's libunwind or use libsupc++ on darwin8.

Right now, libc++ linked against libsupc++ on powerpc-darwin8 (with Iain's FDE/EH patches) is showing very promising test results.

Quuxplusone commented 9 years ago
Comment on attachment 13668
patch to use __builtin_trap instead

Sorry, should have been an attachment to #22198.
Quuxplusone commented 9 years ago

Attached no-builtin_unreachable.patch (657 bytes, text/plain): patch to use __builtin_trap instead

Quuxplusone commented 9 years ago

FWIW, with 22198 and 22200, libunwind is building for Leopard/ppc, so that's a good step forward for anyone trying to get Tiger/ppc working. I doubt I'll make such a step, but some other MacPorts devs have a soft spot for Tiger/ppc and might make additional changes.

Quuxplusone commented 9 years ago

Attached libunwind-fallback-x86_64.patch (553 bytes, text/plain): Fix _dyld_find_unwind_sections fallback implementation