File tree 4 files changed +76
-0
lines changed
src/test/run-make-fulldeps/issue-69368
4 files changed +76
-0
lines changed Original file line number Diff line number Diff line change
1
+ -include ../tools.mk
2
+
3
+ # Test that previously triggered a linker failure with root cause
4
+ # similar to one found in the issue #69368.
5
+ #
6
+ # The crate that provides oom lang item is missing some other lang
7
+ # items. Necessary to prevent the use of start-group / end-group.
8
+ #
9
+ # The weak lang items are defined in a separate compilation units,
10
+ # so that linker could omit them if not used.
11
+ #
12
+ # The crates that need those weak lang items are dependencies of
13
+ # crates that provide them.
14
+
15
+ all :
16
+ $(RUSTC ) a.rs
17
+ $(RUSTC ) b.rs
18
+ $(RUSTC ) c.rs
Original file line number Diff line number Diff line change
1
+ #![ crate_type = "rlib" ]
2
+ #![ feature( lang_items) ]
3
+ #![ feature( panic_unwind) ]
4
+ #![ no_std]
5
+
6
+ extern crate panic_unwind;
7
+
8
+ #[ panic_handler]
9
+ pub fn panic_handler ( _: & core:: panic:: PanicInfo ) -> ! {
10
+ loop { }
11
+ }
12
+
13
+ #[ no_mangle]
14
+ extern "C" fn __rust_drop_panic ( ) -> ! {
15
+ loop { }
16
+ }
Original file line number Diff line number Diff line change
1
+ #![ crate_type = "rlib" ]
2
+ #![ feature( alloc_error_handler) ]
3
+ #![ no_std]
4
+
5
+ #[ alloc_error_handler]
6
+ pub fn error_handler ( _: core:: alloc:: Layout ) -> ! {
7
+ panic ! ( ) ;
8
+ }
Original file line number Diff line number Diff line change
1
+ #![ crate_type = "bin" ]
2
+ #![ feature( start) ]
3
+ #![ no_std]
4
+
5
+ extern crate alloc;
6
+ extern crate a;
7
+ extern crate b;
8
+
9
+ use alloc:: vec:: Vec ;
10
+ use core:: alloc:: * ;
11
+
12
+ struct Allocator ;
13
+
14
+ unsafe impl GlobalAlloc for Allocator {
15
+ unsafe fn alloc ( & self , _: Layout ) -> * mut u8 {
16
+ loop { }
17
+ }
18
+
19
+ unsafe fn dealloc ( & self , _: * mut u8 , _: Layout ) {
20
+ loop { }
21
+ }
22
+ }
23
+
24
+ #[ global_allocator]
25
+ static ALLOCATOR : Allocator = Allocator ;
26
+
27
+ #[ start]
28
+ fn main ( argc : isize , _argv : * const * const u8 ) -> isize {
29
+ let mut v = Vec :: new ( ) ;
30
+ for i in 0 ..argc {
31
+ v. push ( i) ;
32
+ }
33
+ v. iter ( ) . sum ( )
34
+ }
You can’t perform that action at this time.
0 commit comments