-
Notifications
You must be signed in to change notification settings - Fork 644
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
Conversation
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
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks.
this allows users to specify llvm command line options similarly to clang's -mllvm option.
my motivations: