Closed Bug 826962 Opened 12 years ago Closed 11 years ago

Linux clang builds don't have HAVE__UNWIND_BACKTRACE, so have nop NS_StackWalk implementations

Categories

(Core :: XPCOM, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: justin.lebar+bug, Unassigned)

Details

Due to this clang bug [1], Mozilla's configure will detect that a source file which #includes <unwind.h> fails to compile.  We then don't define HAVE__UNWIND_BACKTRACE, which causes NS_StackWalk to be a nop.

I think we can probably work around this in Mozilla code.  This would be helpful for people who try to use SPS to profile their own release builds locally.  It's also useful for DMD.

[1] http://llvm.org/bugs/show_bug.cgi?id=8703
So why is it working for me?  It works for me with clang on both Linux64 and Mac...
I have no idea why it works for you.  Perhaps you're not actually building with clang?  (You have to clobber...)

Does the clang bug from comment 0 reproduce for you?
> Perhaps you're not actually building with clang?  (You have to clobber...)

SRSLY

> Does the clang bug from comment 0 reproduce for you?

test.c doesn't compile, but for a different reason than the one in the bug.  I get this on Linux64:

  test.c:5:30: error: variable has incomplete type 'struct _Unwind_Exception'
    struct _Unwind_Exception exc;
                             ^
  test.c:5:12: note: forward declaration of 'struct _Unwind_Exception'
    struct _Unwind_Exception exc;
           ^
  test.c:7:5: warning: implicit declaration of function '_Unwind_GetCFA' is
      invalid in C99 [-Wimplicit-function-declaration]
    _Unwind_GetCFA (context);

Just #including unwind.h works on my clang, which is "version 3.2 (trunk 166902)".  The unwind.h file is found at /usr/local/bin/../lib/clang/3.2/include/unwind.h.
> SRSLY

I'm not sure what you mean, but I guess if the test.c doesn't compile for you, once you clobbered you no longer had HAVE__UNWIND_BACKTRACE defined?

Our code doesn't use Unwind_Exception, so perhaps that bit doesn't make a difference.

If you can test with the clang patch from the LLVM bug and let us know if that makes this work, Rafael and I would certainly appreciate that.  I can't test myself until I'm back in the US in a week.
I've been using clang for months.  I've done quite a few clobber builds in that time.   I just did another one to be sure.  HAVE__UNWIND_BACKTRACE is defined.


> If you can test with the clang patch from the LLVM bug and let us know if
> that makes this work, Rafael and I would certainly appreciate that.

My clang already works, so I don't understand how me testing that patch will help.
I have no idea why your clang worked when mine didn't, but my clang is fixed by clang rev 171782 [1], so we can close this.

[1] http://llvm.org/bugs/show_bug.cgi?id=8703
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
I should say: Thanks a lot for fixing this in clang, Rafael!
(In reply to Justin Lebar [:jlebar] from comment #7)
> I should say: Thanks a lot for fixing this in clang, Rafael!

NP. Nick had a patch in the bug, but it was missing cell and s390 support. Fortunately we have dropped support for those architectures :-)
You need to log in before you can comment on or make changes to this bug.