Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix build when using clang and libunwind is installed #5646

Closed
wants to merge 2 commits into from

5 participants

James Miller Brian Anderson Daniel Micay Graydon Hoare bors
James Miller
Collaborator

This fixes issue #5641

Brian Anderson
Owner

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

Brian Anderson
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.

Daniel Micay

@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 Hoare

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?

Daniel Micay

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 Hoare

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

Brian Anderson
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.

James Miller
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
Brian Anderson
Owner

r+

Owner

r+

Brian Anderson
Owner

@Aatch thanks!

James Miller
Collaborator

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

Brian Anderson
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
Jay Anderson 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
40 src/rt/rust_unwind.h
View
@@ -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
-
8 src/rt/rust_upcall.cpp
View
@@ -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.