Make globals with private linkage unnamed. Fixes #50862.
This commit is contained in:
parent
e94df4acb4
commit
02190f397e
12 changed files with 42 additions and 51 deletions
|
|
@ -21,11 +21,11 @@
|
|||
// CHECK: @STATIC = {{.*}}, align 4
|
||||
|
||||
// This checks the constants from inline_enum_const
|
||||
// CHECK: @byte_str.{{[0-9]+}} = {{.*}}, align 2
|
||||
// CHECK: @{{[0-9]+}} = {{.*}}, align 2
|
||||
|
||||
// This checks the constants from {low,high}_align_const, they share the same
|
||||
// constant, but the alignment differs, so the higher one should be used
|
||||
// CHECK: [[LOW_HIGH:@byte_str.[0-9]+]] = {{.*}}, align 4
|
||||
// CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}}, align 4
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ mod aux_mod;
|
|||
include!("aux_mod.rs");
|
||||
|
||||
// Here we check that the expansion of the file!() macro is mapped.
|
||||
// CHECK: @byte_str.1 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
|
||||
// CHECK: @0 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
|
||||
pub static FILE_PATH: &'static str = file!();
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
-include ../tools.mk
|
||||
|
||||
# check that the compile generated symbols for strings, binaries,
|
||||
# vtables, etc. have semisane names (e.g. `str.1234`); it's relatively
|
||||
# easy to accidentally modify the compiler internals to make them
|
||||
# become things like `str"str"(1234)`.
|
||||
|
||||
OUT=$(TMPDIR)/lib.s
|
||||
|
||||
all:
|
||||
$(RUSTC) lib.rs --emit=asm --crate-type=staticlib
|
||||
# just check for symbol declarations with the names we're expecting.
|
||||
$(CGREP) -e 'str\.[0-9]+:' 'byte_str\.[0-9]+:' 'vtable\.[0-9]+' < $(OUT)
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
pub static X: &'static str = "foobarbaz";
|
||||
pub static Y: &'static [u8] = include_bytes!("lib.rs");
|
||||
|
||||
trait Foo { fn dummy(&self) { } }
|
||||
impl Foo for usize {}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn dummy() {
|
||||
// force the vtable to be created
|
||||
let _x = &1usize as &Foo;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue