Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix build when using clang and libunwind is installed #5646

Closed
wants to merge 2 commits into from

5 participants

@Aatch
Collaborator

This fixes issue #5641

@brson
Owner

@graydon How do you feel about this change to configure? This is the first such test for a header file.

@brson
Owner

Regardless of whether configure detects that unwind.h exists our source code still contains #include <unwind.h>. So unwind.h has to exist or this isn't going to build. Maybe we should not be redefining the UnwindAction and UnwindException types at all.

@thestinger

@brson: gcc and clang both come with their own unwind.h, so that's what gets used if libunwind isn't installed. Rust seems to require gcc extensions that clang doesn't expose in the header - it ends up working because Rust links against libstdc++/libgcc_s but it might not work with libc++/libc++abi.

@graydon

I am not sure this is the right approach. If libunwind is a requirement on platforms where it works (and it is, right?) then surely we should be detecting and failing during configure, not detecting and compiling a broken binary, no?

@thestinger

Clang doesn't expose the full unwinding interface in the fallback unwind.h but it still seems to work thanks to linking against libstdc++. I don't think Rust ever links against libunwind.

@graydon

What do we need from unwind.h if we don't link against it? Maybe we can just remove the dependency?

@brson
Owner

Yeah, we only need a few declarations just to pass some values through _UnwindResume. Maybe we can forget about unwind.h completely and use our own typedefs.

@Aatch
Collaborator

Hey, so I just removed all the imports from rust_unwind.h, it compiles and links though I haven't run any tests yet.

I just copied the declarations of the types that upcall uses and it seems to work at the moment. Since this both solves the problem and removes the dependency on (lib)unwind.h I think it works.

I'll push the commit to the branch when everything has finished compiling.

James Miller added some commits
James Miller Remove rust_unwind.h
Adds the required definitions in the correct place.
286e571
James Miller Merge branch 'incoming' of git://github.com/mozilla/rust into unwind-fix
507c200
@brson
Owner

r+

Owner

r+

@brson
Owner

@Aatch thanks!

@Aatch
Collaborator

@bors still hasn't picked this up, is there a way that I can get the build bots to do it myself?

@brson
Owner

r+

Collaborator

saw approval from brson
at Aatch@507c200

Collaborator

merging Aatch/rust/unwind-fix = 507c200 into auto

Collaborator

Aatch/rust/unwind-fix = 507c200 merged ok, testing candidate = 9f03d45

Collaborator

fast-forwarding incoming to auto = 9f03d45

@bors bors referenced this pull request from a commit
@bors bors auto merge of #5646 : Aatch/rust/unwind-fix, r=brson
This fixes issue #5641
9f03d45
@bors bors closed this
@jayanderson jayanderson referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 24, 2013
  1. Remove rust_unwind.h

    James Miller authored
    Adds the required definitions in the correct place.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 41 deletions.
  1. +0 −40 src/rt/rust_unwind.h
  2. +7 −1 src/rt/rust_upcall.cpp
View
40 src/rt/rust_unwind.h
@@ -1,40 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Unwinding stuff missing on some architectures (Mac OS X).
-
-#ifndef RUST_UNWIND_H
-#define RUST_UNWIND_H
-
-#ifdef __APPLE__
-#include <libunwind.h>
-
-typedef void _Unwind_Context;
-typedef int _Unwind_Reason_Code;
-
-#else
-
-#include <unwind.h>
-
-#endif
-
-#if (defined __APPLE__) || (defined __clang__)
-
-#ifndef __FreeBSD__
-
-typedef int _Unwind_Action;
-typedef void _Unwind_Exception;
-
-#endif
-
-#endif
-
-#endif
-
View
8 src/rt/rust_upcall.cpp
@@ -19,10 +19,16 @@
#include "rust_globals.h"
#include "rust_task.h"
#include "rust_sched_loop.h"
-#include "rust_unwind.h"
#include "rust_upcall.h"
#include "rust_util.h"
+//Unwinding ABI declarations.
+typedef int _Unwind_Reason_Code;
+typedef int _Unwind_Action;
+
+struct _Unwind_Context;
+struct _Unwind_Exception;
+
#ifdef __GNUC__
#define LOG_UPCALL_ENTRY(task) \
LOG(task, upcall, \
Something went wrong with that request. Please try again.