-
Notifications
You must be signed in to change notification settings - Fork 7
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
Kumarak/embed compile command #43489
base: master
Are you sure you want to change the base?
Conversation
src/blight/actions/embed_commands.py
Outdated
variable = """ | ||
#ifndef __linux__ | ||
__attribute__((section(\"__DATA,.trailofbits_cc\"))) | ||
#else | ||
__attribute__((section(\".trailofbits_cc, \\"S\\", @note;\\n#\"))) | ||
#endif | ||
__attribute__((used)) | ||
static const char cc_{}[] = \"{}\"; | ||
""".format( |
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.
Suggestion: Turn this into a module-level template string, and then do something like:
_VARIABLE_TEMPLATE.format(cmd_hash, cc_string)
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.
@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): |
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.
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): |
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.
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: |
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.
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 <[email protected]> fix review comments
1b11bc9
to
40daf19
Compare
Don't convert double quotes to single quotes.
No description provided.