Skip to content

Commit 3e0f018

Browse files
committed
Fix incorrect LLVM Linkage enum
The `Linkage` enum in librustc_llvm got out of sync with the version in LLVM and it caused two variants of the #[linkage=""] attribute to break. Fixes #33992
1 parent 298730e commit 3e0f018

File tree

2 files changed

+56
-7
lines changed

2 files changed

+56
-7
lines changed

src/librustc_llvm/lib.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ pub enum Linkage {
104104
AvailableExternallyLinkage = 1,
105105
LinkOnceAnyLinkage = 2,
106106
LinkOnceODRLinkage = 3,
107-
WeakAnyLinkage = 5,
108-
WeakODRLinkage = 6,
109-
AppendingLinkage = 7,
110-
InternalLinkage = 8,
111-
PrivateLinkage = 9,
112-
ExternalWeakLinkage = 12,
113-
CommonLinkage = 14,
107+
WeakAnyLinkage = 4,
108+
WeakODRLinkage = 5,
109+
AppendingLinkage = 6,
110+
InternalLinkage = 7,
111+
PrivateLinkage = 8,
112+
ExternalWeakLinkage = 9,
113+
CommonLinkage = 10,
114114
}
115115

116116
#[repr(C)]

src/test/run-pass/issue-33992.rs

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-windows
12+
// ignore-macos
13+
14+
#![feature(linkage)]
15+
16+
#[linkage = "appending"]
17+
pub static TEST1: bool = true;
18+
19+
#[linkage = "available_externally"]
20+
pub static TEST2: bool = true;
21+
22+
#[linkage = "common"]
23+
pub static TEST3: bool = true;
24+
25+
#[linkage = "extern_weak"]
26+
pub static TEST4: bool = true;
27+
28+
#[linkage = "external"]
29+
pub static TEST5: bool = true;
30+
31+
#[linkage = "internal"]
32+
pub static TEST6: bool = true;
33+
34+
#[linkage = "linkonce"]
35+
pub static TEST7: bool = true;
36+
37+
#[linkage = "linkonce_odr"]
38+
pub static TEST8: bool = true;
39+
40+
#[linkage = "private"]
41+
pub static TEST9: bool = true;
42+
43+
#[linkage = "weak"]
44+
pub static TEST10: bool = true;
45+
46+
#[linkage = "weak_odr"]
47+
pub static TEST11: bool = true;
48+
49+
fn main() {}

0 commit comments

Comments
 (0)