@@ -202,10 +202,11 @@ fn build_target_config() -> @session::config {
202
202
ret target_cfg;
203
203
}
204
204
205
- fn build_session_options( str binary , getopts:: match match) ->
205
+ fn build_session_options( str binary , getopts:: match match, str binary_dir ) ->
206
206
@session:: options {
207
207
auto shared = opt_present ( match , "shared" ) ;
208
- auto library_search_paths = getopts:: opt_strs ( match , "L" ) ;
208
+ auto library_search_paths = [ binary_dir] ;
209
+ library_search_paths += getopts:: opt_strs ( match , "L" ) ;
209
210
auto output_type =
210
211
if ( opt_present ( match , "parse-only" ) ) {
211
212
link:: output_type_none
@@ -297,6 +298,7 @@ fn main(vec[str] args) {
297
298
optflag ( "time-llvm-passes" ) , optflag ( "no-typestate" ) ,
298
299
optflag ( "noverify" ) ] ;
299
300
auto binary = vec:: shift[ str] ( args) ;
301
+ auto binary_dir = fs:: dirname ( binary) ;
300
302
auto match =
301
303
alt ( getopts:: getopts ( args, opts) ) {
302
304
case ( getopts:: success ( ?m) ) { m }
@@ -313,7 +315,7 @@ fn main(vec[str] args) {
313
315
version( binary) ;
314
316
ret;
315
317
}
316
- auto sopts = build_session_options( binary, match) ;
318
+ auto sopts = build_session_options( binary, match, binary_dir ) ;
317
319
auto sess = build_session( sopts) ;
318
320
auto n_inputs = vec:: len[ str] ( match. free) ;
319
321
auto output_file = getopts:: opt_maybe_str( match, "o" ) ;
@@ -391,7 +393,6 @@ fn main(vec[str] args) {
391
393
//
392
394
// TODO: Factor this out of main.
393
395
if ( sopts. output_type == link:: output_type_exe) {
394
- auto binary_dir = fs:: dirname ( binary) ;
395
396
let str glu = binary_dir + "/glue.o" ;
396
397
let str main = "rt/main.o" ;
397
398
let str stage = "-L" + binary_dir;
0 commit comments