Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower Arm64Call relocations in cranelift-object #2976

Merged
merged 2 commits into from
Jun 13, 2021

Conversation

bjorn3
Copy link
Contributor

@bjorn3 bjorn3 commented Jun 10, 2021

At least TLS support and better 128bit int support will also be necessary for cg_clif to work on AArch64.

Depends on gimli-rs/object#322

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jun 10, 2021

The mini_core_hello_world example runs with this PR in combination with the following patch:

diff --git a/example/mini_core.rs b/example/mini_core.rs
index c4834c80..aeec532d 100644
--- a/example/mini_core.rs
+++ b/example/mini_core.rs
@@ -285,9 +285,11 @@ fn ne(&self, other: &u64) -> bool {
 }
 
 impl PartialEq for u128 {
+    #[inline]
     fn eq(&self, other: &u128) -> bool {
         (*self) == (*other)
     }
+    #[inline]
     fn ne(&self, other: &u128) -> bool {
         (*self) != (*other)
     }
@@ -620,11 +622,3 @@ struct PanicLocation {
     column: u32,
 }
 
-#[no_mangle]
-#[cfg(not(windows))]
-pub fn get_tls() -> u8 {
-    #[thread_local]
-    static A: u8 = 42;
-
-    A
-}
diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs
index 6570f2bf..895f6a2e 100644
--- a/example/mini_core_hello_world.rs
+++ b/example/mini_core_hello_world.rs
@@ -287,37 +287,12 @@ struct ExternTypeWrapper {
     assert_eq!(repeat[0], Some(42));
     assert_eq!(repeat[1], Some(42));
 
-    from_decimal_string();
-
-    #[cfg(not(any(jit, windows)))]
-    test_tls();
-
-    #[cfg(all(not(jit), target_os = "linux"))]
-    unsafe {
-        global_asm_test();
-    }
-
     // Both statics have a reference that points to the same anonymous allocation.
     static REF1: &u8 = &42;
     static REF2: &u8 = REF1;
     assert_eq!(*REF1, *REF2);
 }
 
-#[cfg(all(not(jit), target_os = "linux"))]
-extern "C" {
-    fn global_asm_test();
-}
-
-#[cfg(all(not(jit), target_os = "linux"))]
-global_asm! {
-    "
-    .global global_asm_test
-    global_asm_test:
-    // comment that would normally be removed by LLVM
-    ret
-    "
-}
-
 #[repr(C)]
 enum c_void {
     _1,
diff --git a/src/lib.rs b/src/lib.rs
index cfc5902c..c154fde3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -288,7 +288,7 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Box<dyn isa::Tar
                 cranelift_codegen::isa::lookup_variant(target_triple, variant).unwrap();
             // Don't use "haswell" as the default, as it implies `has_lzcnt`.
             // macOS CI is still at Ivy Bridge EP, so `lzcnt` is interpreted as `bsr`.
-            builder.enable("nehalem").unwrap();
+            //builder.enable("nehalem").unwrap();
             builder
         }
     };

@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:module labels Jun 10, 2021
Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cfallin
Copy link
Member

cfallin commented Jun 10, 2021

CI failures are curious -- the particular relocation enum value seems to be missing in some builds. Old pinned version, or Cargo feature dependency maybe?

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jun 10, 2021

The CI failure is because gimli-rs/object#322 needs to be merged first.

@cfallin
Copy link
Member

cfallin commented Jun 10, 2021

Ah, sorry, missed that it was still pending. Thanks!

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jun 12, 2021

Object released a new version with the change. CI passed.

@pchickey pchickey merged commit 5737558 into bytecodealliance:main Jun 13, 2021
@bjorn3 bjorn3 deleted the aarch64-object branch June 13, 2021 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:module cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants