Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macOS section handling that already have a comma in ther name #398

Merged
merged 1 commit into from
Feb 11, 2023

Conversation

ptitSeb
Copy link
Contributor

@ptitSeb ptitSeb commented Feb 7, 2023

Description

Following the commit #3917e32 section have a , being added to their name on macOS. On some certain cases, that , should not be added because the name is already fully qualified, like __TEXT,wasmer_function.
This PR check if section name already contains a comma before adding it.

Related Issue

address issue #396

How This Has Been Tested

Tested with latest Wasmer on macOS , both x86_64 and aarch64 arch.

Checklist

@@ -195,7 +202,7 @@ impl<'ctx> Value<'ctx> {
/// Sets the section of the global value
fn set_section(self, section: Option<&str>) {
#[cfg(target_os = "macos")]
let section = section.map(|s| format!(",{}", s));
let section = section.map(|s| if s.contains(",") { format!("{}", s) } else { format!(",{}", s) });
Copy link
Owner

Choose a reason for hiding this comment

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

Should this be starts_with?

Copy link
Contributor Author

@ptitSeb ptitSeb Feb 8, 2023

Choose a reason for hiding this comment

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

No. the idea is if a section name is just "mystuff", it needs to be set as ",mystuff", but if it's "XXX,mystuff", then don't touch it.
Section are expected to be in the format <segment name>,<section name>, and it seems a no segment-name is acceptable, that why the previous commit added the ",".

@syrusakbary
Copy link
Contributor

@TheDan64 is there any blocker for merging the PR? We would love to use it

@TheDan64
Copy link
Owner

I can take a look at merging this and releasing a v0.1.1 this weekend

@TheDan64 TheDan64 merged commit a21e68b into TheDan64:master Feb 11, 2023
@BigBadE
Copy link
Contributor

BigBadE commented May 18, 2024

Does this PR even build? This shadows "section" to be an Option instead of an Option<&str>, which can't be passed to to_c_str.

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.

4 participants