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 8703 - Clang doesn't support attr(__mode__(__unwind_word__))
Summary: Clang doesn't support attr(__mode__(__unwind_word__))
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-29 03:05 PST by İsmail Dönmez
Modified: 2013-01-07 14:23 PST (History)
8 users (show)

See Also:
Fixed By Commit(s):


Attachments
proposed fix (1.75 KB, patch)
2011-06-04 03:30 PDT, Nick Lewycky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description İsmail Dönmez 2010-11-29 03:05:07 PST
[~]> clang -v
clang version 2.9 (trunk 120281)
Target: x86_64-unknown-linux-gnu
Thread model: posix

[~]> cat test.c
#include <unwind.h>

int main ()
{
    struct _Unwind_Exception exc;
    struct _Unwind_Context *context;
    _Unwind_GetCFA (context);

    return 0;
}

[~]> clang test.c   
In file included from test.c:1:
/usr/lib64/gcc/x86_64-suse-linux/4.5/include/unwind.h:43:46: error: unknown machine mode '__unwind_word__'
typedef unsigned _Unwind_Word __attribute__((__mode__(__unwind_word__)));
                                             ^
/usr/lib64/gcc/x86_64-suse-linux/4.5/include/unwind.h:44:45: error: unknown machine mode '__unwind_word__'                        
typedef signed _Unwind_Sword __attribute__((__mode__(__unwind_word__)));
                                            ^
2 errors generated.
Comment 1 Chris Lattner 2010-11-29 13:06:58 PST
This should be pretty easy to implement if anyone was interested.
Comment 2 İsmail Dönmez 2010-11-29 13:16:21 PST
This is a check from glibc configure, so I am interested, any pointers?
Comment 3 İsmail Dönmez 2010-12-01 09:13:05 PST
#define __unwind_word__ word

fixes the compilation and I verified gcc produces the same code with this.
Comment 4 Nick Lewycky 2011-06-04 03:30:12 PDT
Created attachment 6691 [details]
proposed fix

I've attached one possible implementation of this. I decided to add UnwindWord to the TargetInfo class, but then make it return getPointerWidth(0) with a "// FIXME". As far as I know, unwind_word == word on all platforms.

Okay to commit?
Comment 5 Paweł Sikora 2012-02-09 03:43:40 PST
(In reply to comment #4)
> Created attachment 6691 [details]
> proposed fix
> 
> I've attached one possible implementation of this. I decided to add UnwindWord
> to the TargetInfo class, but then make it return getPointerWidth(0) with a "//
> FIXME". As far as I know, unwind_word == word on all platforms.

iirc, on the spu and s/390 there's a difference.

http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00969.html
Comment 6 Justin Lebar (:jlebar) 2013-01-04 23:00:28 PST
FYI, we're going to have to work around this bug in Firefox, otherwise our stack-walking code won't work.

Let me know if there's something we can do to help here.

https://bugzilla.mozilla.org/show_bug.cgi?id=826962
Comment 7 Rafael Ávila de Espíndola 2013-01-05 19:29:33 PST
(In reply to comment #6)
> FYI, we're going to have to work around this bug in Firefox, otherwise our
> stack-walking code won't work.
> 
> Let me know if there's something we can do to help here.
> 
> https://bugzilla.mozilla.org/show_bug.cgi?id=826962

Does the patch attached to this bug fix the issue for you? We don't support spu and s/390, so I guess it is fine.
Comment 8 Justin Lebar (:jlebar) 2013-01-06 12:48:08 PST
> Does the patch attached to this bug fix the issue for you? We don't support spu
> and s/390, so I guess it is fine.

I don't have access to my Linux box for the next week, but supposing the patch works, then what?  If I'm going to ask people to patch and compile clang to build DMD, I might as well tell them to use GCC to build DMD...

I'd sooner stick an "#ifdef CLANG then #define __unwind_word__" above the #include <unwind.h>, I think.
Comment 9 Rafael Ávila de Espíndola 2013-01-06 16:53:58 PST
(In reply to comment #8)
> > Does the patch attached to this bug fix the issue for you? We don't support spu
> > and s/390, so I guess it is fine.
> 
> I don't have access to my Linux box for the next week, but supposing the patch
> works, then what? 

My idea was to commit Nick's patch if it works. The only objection was about two architectures we don't support anymore.
Comment 10 Justin Lebar (:jlebar) 2013-01-06 17:24:46 PST
> My idea was to commit Nick's patch if it works. The only objection was about
> two architectures we don't support anymore.

Ah, "we" was LLVM, not Firefox!  Got it.  :)

I can get back to you in a week, although I'd be pretty surprised if this fix worked for him and not for me...
Comment 11 Rafael Ávila de Espíndola 2013-01-07 14:23:17 PST
Fixed in 171781, 171782.