Skip to content

Avoid adding input files twice#1057

Merged
mati865 merged 1 commit intowild-linker:mainfrom
mati865:push-tqvrlovnovvw
Aug 21, 2025
Merged

Avoid adding input files twice#1057
mati865 merged 1 commit intowild-linker:mainfrom
mati865:push-tqvrlovnovvw

Conversation

@mati865
Copy link
Copy Markdown
Member

@mati865 mati865 commented Aug 20, 2025

Noticed that while working on cups build error:

❯ gcc -B ~/Projects/wild/fakes-debug/ -pie foo.o -Lbad_foo/
WARNING: wild: --plugin /usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/liblto_plugin.so is not yet supported
[libwild/src/input_data.rs:633:31] InputPath
{ absolute: std::path::absolute(path)?, original: p.as_ref().to_owned(), } = InputPath {
    absolute: "/tmp/cups-minimised/bad_foo/foo.o",
    original: "foo.o",
}
[libwild/src/input_data.rs:633:31] InputPath
{ absolute: std::path::absolute(path)?, original: p.as_ref().to_owned(), } = InputPath {
    absolute: "/tmp/cups-minimised/bad_foo/foo.o",
    original: "foo.o",
}
[libwild/src/input_data.rs:633:31] InputPath
{ absolute: std::path::absolute(path)?, original: p.as_ref().to_owned(), } = InputPath {
    absolute: "/usr/lib/libgcc_s.so.1",
    original: "libgcc_s.so.1",
}
[libwild/src/input_data.rs:633:31] InputPath
{ absolute: std::path::absolute(path)?, original: p.as_ref().to_owned(), } = InputPath {
    absolute: "/usr/lib/libc.so.6",
    original: "/usr/lib/libc.so.6",
}
[libwild/src/input_data.rs:633:31] InputPath
{ absolute: std::path::absolute(path)?, original: p.as_ref().to_owned(), } = InputPath {
    absolute: "/usr/lib/libc_nonshared.a",
    original: "/usr/lib/libc_nonshared.a",
}
[libwild/src/input_data.rs:633:31] InputPath
{ absolute: std::path::absolute(path)?, original: p.as_ref().to_owned(), } = InputPath {
    absolute: "/usr/lib/ld-linux-x86-64.so.2",
    original: "/usr/lib/ld-linux-x86-64.so.2",
}
wild: error: Undefined symbol main, referenced by
    /usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../lib/Scrt1.o
collect2: error: ld returned 255 exit status

Comment thread libwild/src/args.rs
Comment on lines -411 to -413
if !arg_parser.handle_argument(&mut args, &mut modifier_stack, arg, &mut input)? {
ArgumentParser::handle_positional_argument(&mut args, &modifier_stack, arg);
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can keep it and instead remove this block from line 931:

        args.inputs.push(Input {
            spec: InputSpec::File(Box::from(Path::new(arg))),
            search_first: None,
            modifiers: *modifier_stack.last().unwrap(),
        });

@mati865
Copy link
Copy Markdown
Member Author

mati865 commented Aug 20, 2025

cc @lapla-cogito

@mati865 mati865 merged commit d64d09b into wild-linker:main Aug 21, 2025
23 checks passed
@mati865 mati865 deleted the push-tqvrlovnovvw branch August 21, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants