Skip to content

Kumarak/embed compile command#43489

Open
pgoodman wants to merge 13 commits intomasterfrom
kumarak/embed_compile_command
Open

Kumarak/embed compile command#43489
pgoodman wants to merge 13 commits intomasterfrom
kumarak/embed_compile_command

Conversation

@pgoodman
Copy link

No description provided.

@pgoodman pgoodman requested a review from woodruffw as a code owner June 28, 2023 23:30
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(
Copy link
Contributor

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)

Copy link
Author

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



class EmbedCommands(CompilerAction):
def __init__(self, config):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def __init__(self, config):
def __init__(self, config: dict[str, str]) -> None:

def __init__(self, config):
super().__init__(config)

def _get_header_file(self, cmd_hash: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _get_header_file(self, cmd_hash: str):
def _get_header_file(self, cmd_hash: str) -> str:

os.remove(header_file)
return header_file

def before_run(self, tool: Tool) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def before_run(self, tool: Tool) -> None:
def before_run(self, tool: CompilerTool) -> None:

kumarak and others added 4 commits November 16, 2023 12:07
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
@kumarak kumarak force-pushed the kumarak/embed_compile_command branch from 1b11bc9 to 40daf19 Compare November 16, 2023 17:53
@CLAassistant
Copy link

CLAassistant commented Jan 25, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ pgoodman
✅ woodruffw
❌ Peter Goodman


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.

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