diff mbox

[v3,3/4] powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS

Message ID 87tvr9o5iy.fsf@concordia.ellerman.id.au (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Ellerman May 15, 2018, 5:24 a.m. UTC
Steven Rostedt <rostedt@goodmis.org> writes:
> On Mon, 14 May 2018 13:52:27 +1000
> Nicholas Piggin <npiggin@gmail.com> wrote:
>> The powerpc toolchain can compile combinations of 32/64 bit and
>> big/little endian, so it's convenient to consider, e.g.,
>> 
>>   `CC -m64 -mbig-endian`
>> 
>> To be the C compiler for the purpose of invoking it to build target
>> artifacts. So overriding the the CC variable to include thse flags
...
>> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
>> index 191eb949d52c..3c67304a7425 100755
>> --- a/scripts/recordmcount.pl
>> +++ b/scripts/recordmcount.pl
>> @@ -274,6 +274,13 @@ if ($arch eq "x86_64") {
>>      if ($bits == 64) {
>>  	$type = ".quad";
>>      }
>> +    if ($endian eq "big") {
>> +	    $cc .= " -mbig-endian ";
>> +	    $ld .= " -EB ";
>> +    } else {
>> +	    $cc .= " -mlittle-endian ";
>> +	    $ld .= " -EL ";
>> +    }
>
> Have you tried building all current archs with function tracing enabled
> to make sure this doesn't break any of them? I can do it if you want.

We shouldn't need to should we? This is only touching powerpc specific
code (if I understand perl that is).

eg:

$ git diff -U9 scripts/recordmcount.pl


cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Nicholas Piggin May 15, 2018, 6:16 a.m. UTC | #1
On Tue, 15 May 2018 15:24:21 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Steven Rostedt <rostedt@goodmis.org> writes:
> > On Mon, 14 May 2018 13:52:27 +1000
> > Nicholas Piggin <npiggin@gmail.com> wrote:  
> >> The powerpc toolchain can compile combinations of 32/64 bit and
> >> big/little endian, so it's convenient to consider, e.g.,
> >> 
> >>   `CC -m64 -mbig-endian`
> >> 
> >> To be the C compiler for the purpose of invoking it to build target
> >> artifacts. So overriding the the CC variable to include thse
> >> flags  
> ...
> >> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> >> index 191eb949d52c..3c67304a7425 100755
> >> --- a/scripts/recordmcount.pl
> >> +++ b/scripts/recordmcount.pl
> >> @@ -274,6 +274,13 @@ if ($arch eq "x86_64") {
> >>      if ($bits == 64) {
> >>  	$type = ".quad";
> >>      }
> >> +    if ($endian eq "big") {
> >> +	    $cc .= " -mbig-endian ";
> >> +	    $ld .= " -EB ";
> >> +    } else {
> >> +	    $cc .= " -mlittle-endian ";
> >> +	    $ld .= " -EL ";
> >> +    }  
> >
> > Have you tried building all current archs with function tracing
> > enabled to make sure this doesn't break any of them? I can do it if
> > you want.  
> 
> We shouldn't need to should we? This is only touching powerpc specific
> code (if I understand perl that is).

Yeah that wasn't clear from the diff context, it should only have an
affect on powerpc so you shouldn't need to go through other archs.

Thanks,
Nick

> 
> eg:
> 
> $ git diff -U9 scripts/recordmcount.pl
> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 191eb949d52c..3c67304a7425 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -268,18 +268,25 @@ if ($arch eq "x86_64") {
>  } elsif ($arch eq "powerpc") {
>      $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
>      # See comment in the sparc64 section for why we use '\w'.
>      $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:";
>      $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
>  
>      if ($bits == 64) {
>         $type = ".quad";
>      }
> +    if ($endian eq "big") {
> +           $cc .= " -mbig-endian ";
> +           $ld .= " -EB ";
> +    } else {
> +           $cc .= " -mlittle-endian ";
> +           $ld .= " -EL ";
> +    }
>  
>  } elsif ($arch eq "arm") {
>      $alignment = 2;
>      $section_type = '%progbits';
>      $mcount_regex =
> "^\\s*([0-9a-fA-F]+):\\s*R_ARM_(CALL|PC24|THM_CALL)" .
> "\\s+(__gnu_mcount_nc|mcount)\$"; 
>  } elsif ($arch eq "arm64") {
>      $alignment = 3;
> 
> 
> cheers

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt May 15, 2018, 2:43 p.m. UTC | #2
On Tue, 15 May 2018 15:24:21 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:

> > Have you tried building all current archs with function tracing enabled
> > to make sure this doesn't break any of them? I can do it if you want.  
> 
> We shouldn't need to should we? This is only touching powerpc specific
> code (if I understand perl that is).
> 
> eg:
> 
> $ git diff -U9 scripts/recordmcount.pl

Thanks for the added context!

Yeah, I don't look at that code much anymore since I mainly deal with
recordmcount.c now-a-days. I wonder if someone should port ppc to that.
It is also no my todo list to merge that with objtool.

Anyway,

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve


> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 191eb949d52c..3c67304a7425 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -268,18 +268,25 @@ if ($arch eq "x86_64") {
>  } elsif ($arch eq "powerpc") {
>      $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
>      # See comment in the sparc64 section for why we use '\w'.
>      $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:";
>      $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
>  
>      if ($bits == 64) {
>         $type = ".quad";
>      }
> +    if ($endian eq "big") {
> +           $cc .= " -mbig-endian ";
> +           $ld .= " -EB ";
> +    } else {
> +           $cc .= " -mlittle-endian ";
> +           $ld .= " -EL ";
> +    }
>  
>  } elsif ($arch eq "arm") {
>      $alignment = 2;
>      $section_type = '%progbits';
>      $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_ARM_(CALL|PC24|THM_CALL)" .
>                         "\\s+(__gnu_mcount_nc|mcount)\$";
>  
>  } elsif ($arch eq "arm64") {
>      $alignment = 3;
> 
> 
> cheers

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman May 16, 2018, 2:37 a.m. UTC | #3
Steven Rostedt <rostedt@goodmis.org> writes:
> On Tue, 15 May 2018 15:24:21 +1000
> Michael Ellerman <mpe@ellerman.id.au> wrote:
>
>> > Have you tried building all current archs with function tracing enabled
>> > to make sure this doesn't break any of them? I can do it if you want.  
>> 
>> We shouldn't need to should we? This is only touching powerpc specific
>> code (if I understand perl that is).
>> 
>> eg:
>> 
>> $ git diff -U9 scripts/recordmcount.pl
>
> Thanks for the added context!
>
> Yeah, I don't look at that code much anymore since I mainly deal with
> recordmcount.c now-a-days. I wonder if someone should port ppc to that.

Ah right. I didn't realise they were mutually exclusive. I'll add a TODO
for us to port over to the C version.

> It is also no my todo list to merge that with objtool.
>
> Anyway,
>
> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Thanks.

cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 191eb949d52c..3c67304a7425 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -268,18 +268,25 @@  if ($arch eq "x86_64") {
 } elsif ($arch eq "powerpc") {
     $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
     # See comment in the sparc64 section for why we use '\w'.
     $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:";
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
 
     if ($bits == 64) {
        $type = ".quad";
     }
+    if ($endian eq "big") {
+           $cc .= " -mbig-endian ";
+           $ld .= " -EB ";
+    } else {
+           $cc .= " -mlittle-endian ";
+           $ld .= " -EL ";
+    }
 
 } elsif ($arch eq "arm") {
     $alignment = 2;
     $section_type = '%progbits';
     $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_ARM_(CALL|PC24|THM_CALL)" .
                        "\\s+(__gnu_mcount_nc|mcount)\$";
 
 } elsif ($arch eq "arm64") {
     $alignment = 3;