LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 17513 - porting included libunwind to powerpc-darwin8
Summary: porting included libunwind to powerpc-darwin8
Status: NEW
Alias: None
Product: libc++abi
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: Macintosh MacOS X
: P normal
Assignee: David Fang
URL:
Keywords:
Depends on: 22202 22198 22200 22203 22270
Blocks:
  Show dependency tree
 
Reported: 2013-10-08 15:29 PDT by David Fang
Modified: 2016-11-02 13:57 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
gcc-4.0.1 asm (8.37 KB, text/plain)
2013-11-15 22:02 PST, David Fang
Details
clang asm of PR17505.cpp (5.94 KB, text/plain)
2013-11-15 22:03 PST, David Fang
Details
patch to use __builtin_trap instead (657 bytes, patch)
2015-01-11 15:19 PST, Jeremy Huddleston Sequoia
Details
Fix _dyld_find_unwind_sections fallback implementation (553 bytes, patch)
2015-01-11 15:28 PST, Jeremy Huddleston Sequoia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Fang 2013-10-08 15:29:56 PDT
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
Comment 1 David Fang 2013-10-08 15:36:57 PDT
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()
Comment 2 David Fang 2013-10-08 17:30:31 PDT
or find an alternative way to implement on darwin8 (Unwind/AddressSpace.hpp):
bool LocalAddressSpace::findUnwindSections(pint_t, UnwindInfoSections&);
Comment 3 David Fang 2013-11-15 22:02:27 PST
Created attachment 11548 [details]
gcc-4.0.1 asm
Comment 4 David Fang 2013-11-15 22:03:09 PST
Created attachment 11549 [details]
clang asm of PR17505.cpp
Comment 5 David Fang 2013-11-15 22:05:14 PST
Comment on attachment 11548 [details]
gcc-4.0.1 asm

wrong bug, sorry
Comment 6 David Fang 2013-11-15 22:05:33 PST
Comment on attachment 11549 [details]
clang asm of PR17505.cpp

wrong bug, sorry.
Comment 7 David Fang 2013-12-18 00:38:37 PST
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.
Comment 8 Jeremy Huddleston Sequoia 2015-01-11 15:19:16 PST
Created attachment 13668 [details]
patch to use __builtin_trap instead

This is the patch I'm using to address the issue on MacPorts.
Comment 9 Jeremy Huddleston Sequoia 2015-01-11 15:20:31 PST
Comment on attachment 13668 [details]
patch to use __builtin_trap instead

Sorry, should have been an attachment to #22198.
Comment 10 Jeremy Huddleston Sequoia 2015-01-11 15:28:05 PST
Created attachment 13670 [details]
Fix _dyld_find_unwind_sections fallback implementation

It looks like Nick pushed a patch to address the bulk of the specificly reported problem (_dyld_find_unwind_sections being unavailable) in December 2013:

commit 034e79a395bf7815fd94ad81d40609aa52f2f34c
Author: Nick Kledzik <kledzik@apple.com>
Date:   Thu Dec 5 00:12:03 2013 +0000

    [unwind] remove darwin build dependency on <mach-o/dyld_priv.h>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@196436 91177308-0d34-0410-b5e6-96231b3b80d8

---

This patch is a followup to fix a bug in that fallback implementation for x86_64.
Comment 11 Jeremy Huddleston Sequoia 2015-01-11 15:56:13 PST
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.