File tree 4 files changed +45
-0
lines changed
src/test/run-make/link-path-order
4 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ -include ../tools.mk
2
+
3
+ # Verifies that the -L arguments given to the linker is in the same order
4
+ # as the -L arguments on the rustc command line.
5
+
6
+ CORRECT_DIR =$(TMPDIR ) /correct
7
+ WRONG_DIR =$(TMPDIR ) /wrong
8
+
9
+ all : $(TMPDIR ) /libcorrect.a $(TMPDIR ) /libwrong.a
10
+ mkdir -p $(CORRECT_DIR ) $(WRONG_DIR )
11
+ mv $(TMPDIR ) /libcorrect.a $(CORRECT_DIR ) /libfoo.a
12
+ mv $(TMPDIR ) /libwrong.a $(WRONG_DIR ) /libfoo.a
13
+ $(RUSTC ) main.rs -o $(TMPDIR ) /should_succeed -L $(CORRECT_DIR ) -L $(WRONG_DIR )
14
+ $(call RUN,should_succeed)
15
+ $(RUSTC ) main.rs -o $(TMPDIR ) /should_fail -L $(WRONG_DIR ) -L $(CORRECT_DIR )
16
+ $(call FAIL,should_fail)
17
+
Original file line number Diff line number Diff line change
1
+ int should_return_one () { return 1 ; }
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 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
+ extern crate libc;
12
+
13
+ #[ link( name="foo" ) ]
14
+ extern {
15
+ fn should_return_one ( ) -> libc:: c_int ;
16
+ }
17
+
18
+ fn main ( ) {
19
+ let result = unsafe {
20
+ should_return_one ( )
21
+ } ;
22
+
23
+ if result != 1 {
24
+ std:: os:: set_exit_status ( 255 ) ;
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ int should_return_one () { return 0 ; }
You can’t perform that action at this time.
0 commit comments