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

wamrc: Add --mllvm= option #3658

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Conversation

yamt
Copy link
Collaborator

@yamt yamt commented Jul 23, 2024

this allows users to specify llvm command line options similarly to clang's -mllvm option.

my motivations:

  • -debug and friends
  • -mtext-section-literals for xtensa

this allows users to specify llvm command line options
similarly to clang's -mllvm option.

my motivations:
* -debug and friends
* -mtext-section-literals for xtensa
Copy link
Contributor

@wenyongh wenyongh left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -738,6 +765,7 @@ main(int argc, char *argv[])
if (option.custom_sections) {
free(option.custom_sections);
}
free(llvm_options);
Copy link
Contributor

@wenyongh wenyongh Jul 24, 2024

Choose a reason for hiding this comment

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

Is it better to check llvm_options and free it only when it is not NULL? like L765

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

why?

Copy link
Contributor

Choose a reason for hiding this comment

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

When --mllvm=xxx isn't specified, llvm_options is NULL, no need to free it in fact. Though the linux manual of free says no operation is performed if ptr is NULL, I am not sure whether it is a good coding style, we usually free a buffer only when it is NULL. It is good if the same behavior is ensured in other platforms.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

free(NULL) is guaranteed to be a no-op by C language.
i'm not aware of any problematic platforms wrt that.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks.

@wenyongh wenyongh merged commit b300797 into bytecodealliance:main Jul 24, 2024
379 checks passed
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