Open
Conversation
woodruffw
reviewed
Jul 6, 2023
src/blight/actions/embed_commands.py
Outdated
Comment on lines
+105
to
+108
| variable = """ | ||
| #ifndef __linux__ | ||
| __attribute__((section(\"__DATA,.trailofbits_cc\"))) | ||
| #else | ||
| __attribute__((section(\".trailofbits_cc, \\"S\\", @note;\\n#\"))) | ||
| #endif | ||
| __attribute__((used)) | ||
| static const char cc_{}[] = \"{}\"; | ||
| """.format( |
Contributor
There was a problem hiding this comment.
Suggestion: Turn this into a module-level template string, and then do something like:
_VARIABLE_TEMPLATE.format(cmd_hash, cc_string)
Author
There was a problem hiding this comment.
@kumarak can you address this, and also make it:
#ifndef __linux__
__attribute__((section(\"__DATA,.trailofbits_cc\")))
#elifdef __clang__
__attribute__((section(\".trailofbits_cc\")))
#else
__attribute__((section(\".trailofbits_cc, \\"S\\", @note;\\n#\")))
#endif
src/blight/actions/embed_commands.py
Outdated
|
|
||
|
|
||
| class EmbedCommands(CompilerAction): | ||
| def __init__(self, config): |
Contributor
There was a problem hiding this comment.
Suggested change
| def __init__(self, config): | |
| def __init__(self, config: dict[str, str]) -> None: |
src/blight/actions/embed_commands.py
Outdated
| def __init__(self, config): | ||
| super().__init__(config) | ||
|
|
||
| def _get_header_file(self, cmd_hash: str): |
Contributor
There was a problem hiding this comment.
Suggested change
| def _get_header_file(self, cmd_hash: str): | |
| def _get_header_file(self, cmd_hash: str) -> str: |
src/blight/actions/embed_commands.py
Outdated
| os.remove(header_file) | ||
| return header_file | ||
|
|
||
| def before_run(self, tool: Tool) -> None: |
Contributor
There was a problem hiding this comment.
Suggested change
| def before_run(self, tool: Tool) -> None: | |
| def before_run(self, tool: CompilerTool) -> None: |
update weak symbol attribute Update record compiler action fix comments and compiler path
Bug fix Bug fix Use dictionary syntax Use the Tool properties directly instead of going through the dictionary. Remove leading single quotes. Not sure how those got there. There is still some kind of issue, though. More entropy to include file names Tool.env is not a thing. Go back to old way of checking for .S files.
Signed-off-by: William Woodruff <william@trailofbits.com> fix review comments
1b11bc9 to
40daf19
Compare
Don't convert double quotes to single quotes.
|
Peter Goodman seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.