Skip to content

Commit

Permalink
Merge #63
Browse files Browse the repository at this point in the history
63: search linker scripts in cwd first r=japaric a=spookyvision

harmonize linker script directory search order with non-`flip-link` linkers to reduce surprises.
Specifically, other crates might introduce spurious and potentially wrong `memory.x` scripts, this PR attempts to do some damage control by searching the current working directory first

Co-authored-by: Anatol Ulrich <[email protected]>
  • Loading branch information
bors[bot] and Anatol Ulrich authored Jan 10, 2022
2 parents c1b08f5 + 1cfc492 commit d55e7c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const EXIT_CODE_FAILURE: i32 = 1;
const SP_ALIGN: u64 = 8;

fn main() -> Result<()> {
// clippy complains about redundant closure, but in fact
// the function signature isn't 100% compatible so we must wrap it
#[allow(clippy::redundant_closure)]
notmain().map(|code| process::exit(code))
}

Expand Down Expand Up @@ -208,8 +211,8 @@ impl LinkerScript {
}

fn get_linker_scripts(args: &[String], current_dir: &Path) -> Result<Vec<LinkerScript>> {
let mut search_paths = argument_parser::get_search_paths(args);
search_paths.push(current_dir.into());
let mut search_paths = vec![current_dir.into()];
search_paths.extend(argument_parser::get_search_paths(args));

let mut search_targets = argument_parser::get_search_targets(args);

Expand Down

0 comments on commit d55e7c8

Please sign in to comment.