Skip to content

Do not lookup files from args in search paths#1058

Merged
mati865 merged 2 commits into
wild-linker:mainfrom
mati865:push-xunsnlrztwwr
Aug 22, 2025
Merged

Do not lookup files from args in search paths#1058
mati865 merged 2 commits into
wild-linker:mainfrom
mati865:push-xunsnlrztwwr

Conversation

@mati865

@mati865 mati865 commented Aug 20, 2025

Copy link
Copy Markdown
Member

Fixes a regression from #610 that manifests in cups source code.
Minimised reproducer:

$ mkdir bad_foo
$ touch bad_foo/foo.o
$ echo 'int main() { return 0; }' > main.c
$ gcc -c main.c -o foo.o
❯ gcc -B ~/Projects/wild/fakes-debug/ -pie foo.o -Lbad_foo/
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

The problem was due to bad_foo/foo.o being preferred over ./foo.o.

Created on top of #1057

Comment thread wild/tests/integration_tests.rs
Comment thread libwild/src/args.rs Outdated
File(Box<Path>),
Lib(Box<str>),
/// Name of the library and whether it already has suffix and prefix.
Lib(Box<str>, bool),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder how it might look if instead of adding a bool to this variant, we had a separate variant. e.g. Search(Box<str>) which indicates to search for a file with the indicated name.

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.

Sure, I'll prepare it.

Fixes a regression from wild-linker#610 that manifests in cups source code.
Minimised reproducer:
```sh
$ mkdir bad_foo
$ touch bad_foo/foo.o
$ echo 'int main() { return 0; }' > main.c
$ gcc -c main.c -o foo.o
❯ gcc -B ~/Projects/wild/fakes-debug/ -pie foo.o -Lbad_foo/
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
```
The problem was due to `bad_foo/foo.o` being preferred over `./foo.o`.
@mati865 mati865 force-pushed the push-xunsnlrztwwr branch from bfdf0db to 9a5c120 Compare August 21, 2025 17:06
@mati865 mati865 merged commit 5c03280 into wild-linker:main Aug 22, 2025
23 checks passed
@mati865 mati865 deleted the push-xunsnlrztwwr branch August 22, 2025 06:31
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