Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions libwild/src/input_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,26 @@ pub(crate) struct AuxiliaryFiles<'data> {

impl<'data> AuxiliaryFiles<'data> {
pub(crate) fn new(args: &'data Args, inputs_arena: &'data Arena<InputFile>) -> Result<Self> {
let resolve_script_path = |path: &Path| -> PathBuf {
if path.exists() {
path.to_owned()
} else if let Some(found) = search_for_file(&args.lib_search_path, None, path) {
found
} else {
path.to_owned()
}
};

Ok(Self {
version_script_data: args
.version_script_path
.as_ref()
.map(|path| read_script_data(path, inputs_arena))
.map(|path| read_script_data(&resolve_script_path(path), inputs_arena))
.transpose()?,
export_list_data: args
.export_list_path
.as_ref()
.map(|path| read_script_data(path, inputs_arena))
.map(|path| read_script_data(&resolve_script_path(path), inputs_arena))

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.

At first, I thought there was no need to apply the same change to export_list, based on how mold implements the corresponding part. However, I found that GNU ld searches paths specified via -L when options such as --dynamic-list are provided. Therefore, to match GNU ld’s behavior, this change also applies to export_list.

(▰╹◡╹)❯  tree .
.
├── searchdir
│   └── test.list
└── test.c

2 directories, 2 files

(▰╹◡╹)❯  gcc -shared -o test.so test.c -fPIC -Wl,-Lsearchdir -Wl,--dynamic-list,test.list -fuse-ld=mold
mold: fatal: cannot open test.list: No such file or directory
collect2: error: ld returned 1 exit status

(▰╹^╹)❯  gcc -shared -o test.so test.c -fPIC -Wl,-Lsearchdir -Wl,--dynamic-list,test.list -fuse-ld=bfd

(▰╹◡╹)❯  ls test.so
test.so

.transpose()?,
})
}
Expand Down
6 changes: 1 addition & 5 deletions wild/tests/external_tests/mold_skip_tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ tests = [

[skipped_groups.version_script]
reason = "Version script support"
tests = [
"version-script-search-paths.sh",
"version-script15.sh",
"version-script17.sh",
]
tests = ["version-script15.sh", "version-script17.sh"]

[skipped_groups.z_options]
reason = "Related to -z"
Expand Down
Loading