linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgcc: handle -x assembler
@ 2022-04-10 14:00 Tom Rix
  2022-05-22  9:38 ` Luc Van Oostenryck
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2022-04-10 14:00 UTC (permalink / raw)
  To: linux-sparse, dan.carpenter; +Cc: Tom Rix

On linux-next, using
make CC=cgcc

fails with
cgcc: unknown assembler invoked
scripts/Kconfig.include:50: Sorry, this assembler is not supported.

cgcc is being invoked with
cgcc -Wa,--version -c -x assembler /dev/null -o /dev/null
And dieing when the '-x c' is not matched.

Add a check for -x assember.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 cgcc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cgcc b/cgcc
index 9c78ee63..dc5cb624 100755
--- a/cgcc
+++ b/cgcc
@@ -42,10 +42,10 @@ while (@ARGV) {
 	$nargs = 1;
     }
 
-    # Ignore the extension if '-x c' is given.
+    # Ignore the extension if '-x c' or '-x assembler' is given.
     if ($_ eq '-x') {
 	die ("$0: missing argument for $_") if !@ARGV;
-	die ("$0: invalid argument for $_") if $ARGV[0] ne 'c';
+	die ("$0: invalid argument for $_") if $ARGV[0] ne 'c' and $ARGV[0] ne 'assembler';
 	$do_check = 1;
 	$nargs = 1;
     }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cgcc: handle -x assembler
  2022-04-10 14:00 [PATCH] cgcc: handle -x assembler Tom Rix
@ 2022-05-22  9:38 ` Luc Van Oostenryck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2022-05-22  9:38 UTC (permalink / raw)
  To: Tom Rix; +Cc: linux-sparse, dan.carpenter

Hi,

Sorry for this late reply.
 
On Sun, Apr 10, 2022 at 10:00:26AM -0400, Tom Rix wrote:
> On linux-next, using
> make CC=cgcc
> 
> fails with
> cgcc: unknown assembler invoked
> scripts/Kconfig.include:50: Sorry, this assembler is not supported.
> 
> cgcc is being invoked with
> cgcc -Wa,--version -c -x assembler /dev/null -o /dev/null
> And dieing when the '-x c' is not matched.
>
> Add a check for -x assember.


As you most probably know, cgcc is a wrapper around GCC to transparently
also call sparse on the source code.
This was designed when using sparse on non-kernel code. The kernel doesn't
need it since its build system can do the same directly using the commands:
	make C=1 <...>
or
	make C=2 <...>
insuring it's called with the correct arguments (like the --arch option)
and taking in account a few idiosyncrasies.

Your patch is OK regarding cgcc itself but I don't know what good it will
do after, when calling sparse, since sparse can only process C code an will
surely choke on assembly files.

So, are you sure you must cgcc here and can't use the existing make C=[12]
mechanism? Otherwise, a more correct patch would be to change the check
for '-x c', set $do_check = 0 when the argument is 'assembler' (or
better, when anything other than 'c') and preferably stop to parse the
remaining arguments/directly call the $REAL_CC.

Best regards,
-- Luc

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-22  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-10 14:00 [PATCH] cgcc: handle -x assembler Tom Rix
2022-05-22  9:38 ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).