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

[SYCLomatc][Intercept-build] Refine intercept-build to work as normal compilation if the toolchain is available #2386

Open
wants to merge 5 commits into
base: SYCLomatic
Choose a base branch
from

Conversation

tomflinda
Copy link
Contributor

Signed-off-by: chenwei.sun chenwei.sun@intel.com

@tomflinda tomflinda changed the title [SYCLomatc][Intercept-build] Refine intercept-build to work as normal compilation if all the toolchains are available [SYCLomatc][Intercept-build] Refine intercept-build to work as normal compilation if all the toolchain is available Oct 8, 2024
@tomflinda tomflinda changed the title [SYCLomatc][Intercept-build] Refine intercept-build to work as normal compilation if all the toolchain is available [SYCLomatc][Intercept-build] Refine intercept-build to work as normal compilation if the toolchain is available Oct 8, 2024
int is_ar_staticlib_cmd = 0;
int is_tool_existence = 0;
if (file_exists(argv[0])) {
is_tool_existence = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

is_tool_available

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay

int has_parenthesis = 0;
if (is_tool_existence) {
for (size_t it = 0; it < argc; ++it) {
fprintf(fd, "%s%c", argv[it], US);
Copy link
Contributor

Choose a reason for hiding this comment

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

debug purpose printf?

Copy link
Contributor Author

@tomflinda tomflinda Oct 9, 2024

Choose a reason for hiding this comment

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

No, it is used to collect options for current command.

ret = 0; // intercept-stub should continue to run.

// intercept-stub is used to handle the compiler command like
// "/bin/sh -c clang++ -c `echo ./`hello.c", it changes the compiler
Copy link
Contributor

Choose a reason for hiding this comment

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

please keep footprint as small as possible for a PR.

Copy link
Contributor Author

@tomflinda tomflinda Oct 9, 2024

Choose a reason for hiding this comment

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

Those codes are in the else branch in the code below, logic keeps same as old code

  if (is_tool_existence) {
    for (size_t it = 0; it < argc; ++it) {
      fprintf(fd, "%s%c", argv[it], US);
    }
  } else {
    ...
}

if (ret == 1 && it_cp == 0 && !is_ar_staticlib_cmd) {
exit(0);
if(is_tool_existence) {
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

it's void function, so why " return 0"?

Copy link
Contributor Author

@tomflinda tomflinda Oct 9, 2024

Choose a reason for hiding this comment

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

It is not void function, shown as follows:

static int bear_report_call(char const *fun, char const *argv[]) {
#else
static void bear_report_call(char const *fun, char const *const argv[]) {
#endif // SYCLomatic_CUSTOMIZATION

}
return call_eaccess(pathname, mode);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we keep it, just do a little refinement.

… compilation if all the toolchains are available

Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
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.

3 participants