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

Linux Kernel Assembly Macros #312

Closed
lsgunth opened this issue Nov 7, 2018 · 6 comments · Fixed by #313
Closed

Linux Kernel Assembly Macros #312

lsgunth opened this issue Nov 7, 2018 · 6 comments · Fixed by #313

Comments

@lsgunth
Copy link

lsgunth commented Nov 7, 2018

Hi,

As of v4.20-rc1 distcc (and icecc for that matter) can no longer be used to distribute a compile of the linux kernel for x86. See this thread.

The problem is the kernel is now adding "-Wa,macros.s" argument to every compile option so that specific assembly macros can be used in inline assembly code across the kernel. When distcc sees this, any remote builds will fail seeing it won't be able to find macros.s and it will fallback to a local build.

Is there any way this could be supported by distcc as there does not appear to be a good solution in the kernel?

Thanks,

Logan

@TafThorne
Copy link
Collaborator

Could you not add them to every compile option but selectively when needed? Then distcc would only fail the ones with it.
Thank you for including the link tot he discussion thread, it helps to flesh out the problem space.

@lsgunth
Copy link
Author

lsgunth commented Nov 8, 2018

It would be too difficult to determine which sources use the macros. The assembly macros will be used in common kernel defines (like WARN()) which are called throughout the kernel. So even if one could determine which files need them there'd probably be a significant fraction of compiles that could not be distributed.

There's more background on the motivation for this here

And the discussion on the best way to apply the global assembly file is here.

@afbjorklund
Copy link
Contributor

The include_server is able to handle both -include and -imacros today. One could implement -Wa,macros.s as a special case of this, perhaps ? Then it will also be sent to the distccd server...

https://github.com/distcc/distcc/blob/master/include_server/parse_command.py#L105

@afbjorklund
Copy link
Contributor

Yeah, this patch seems to work for my simple hello world program:

diff --git a/include_server/parse_command.py b/include_server/parse_command.py
index cd02d01..bacf250 100755
--- a/include_server/parse_command.py
+++ b/include_server/parse_command.py
@@ -158,6 +158,7 @@ CPP_OPTIONS_ONE_WORD = {
   '-undef':         lambda ps, arg: None,
   '-nostdinc':      lambda ps: ps.set_nostdinc(),
   # TODO(csilvers): deal with -nostdinc++ as well?
+  '-Wa,macros.s':   lambda ps: ps.include_files.append('macros.s'),
 }
 
 # These are the cpp options that are one letter long, and take an

Not sure if that single filename is enough, or if there were more too ?

@afbjorklund
Copy link
Contributor

The real code looks more like:

ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,-
export ASM_MACRO_FLAGS
KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)

So I guess it needs to be slightly less hacky, and accept anything looking like -Wa,**/*.s ?

Maybe accept a .S as well.

@afbjorklund
Copy link
Contributor

Now also needs to support: -Wa,[filename.s]

Maybe parse_command needs to grow regexp...

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 a pull request may close this issue.

3 participants