Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

From: Nadav Amit
Date: Thu Nov 08 2018 - 01:18:40 EST


From: hpa@xxxxxxxxx
Sent: November 7, 2018 at 9:50:28 PM GMT
> To: Logan Gunthorpe <logang@xxxxxxxxxxxx>, Nadav Amit <namit@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, X86 ML <x86@xxxxxxxxxx>, Sam Ravnborg <sam@xxxxxxxxxxxx>, Michal Marek <michal.lkml@xxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Linux Kbuild mailing list <linux-kbuild@xxxxxxxxxxxxxxx>, Stephen Bates <sbates@xxxxxxxxxxxx>
> Subject: Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm
>
>
> On November 7, 2018 1:43:39 PM PST, Logan Gunthorpe <logang@xxxxxxxxxxxx> wrote:
>> On 2018-11-07 11:56 a.m., Nadav Amit wrote:
>>> HPA indicated more than once that this is wrong (and that was indeed
>> my
>>> initial solution), since it is not guaranteed that the compiler would
>> put
>>> the macro assembly before its use.
>>
>> Hmm, that's very unfortunate. I don't really understand why the
>> compiler
>> would not put the macro assembly in the same order as it appears in the
>> code and it would be in the correct order there.
>>
>> In any case, I've submitted a couple of issues to icecc[1] and
>> distcc[2]
>> to see if they have any ideas about supporting this on their sides.
>>
>> Thanks,
>>
>> Logan
>>
>> [1] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ficecc%2Ficecream%2Fissues%2F428&amp;data=02%7C01%7Cnamit%40vmware.com%7C30ab3751343b49f869ab08d644fb1d8c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636772242666772528&amp;sdata=dXKTR79LkFDQ9IXxYw9XYt0VPFa4MXrMUcc86w5uy%2Fk%3D&amp;reserved=0
>> [2] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdistcc%2Fdistcc%2Fissues%2F312&amp;data=02%7C01%7Cnamit%40vmware.com%7C30ab3751343b49f869ab08d644fb1d8c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636772242666772528&amp;sdata=XynZ1bFbKAb8V2eoPQbXudEJ%2B%2Bu8QA3mM4Sr4E%2FTzWs%3D&amp;reserved=0
>
> Apparently gcc will treat them like basic blocks and possibly move them around.

Maybe it is possible to break the compilation of each object into two
stages: first, compile the source without assembly, and then take the
generated .s file and assemble it with the .s file of the macros.

Does it sounds as something that may work? I guess it should only be done
when distcc is used.