Skip to contentSkip to conversation

kbuild: dummy-tools: adjust to scripts/cc-version.sh

PATCH In review Masahiro Yamada 4 participants 5 messages Mar 9, 2021 – Mar 10, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: dummy-tools: adjust to scripts/cc-version.sh

Commit aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig") changed how the script detects the compiler version.

Get 'make CROSS_COMPILE=scripts/dummy-tools/' back working again.

Fixes aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig")

---

Perhaps, Jiri may have already noticed this issue, and have a similar patch. I just checked ML, but I did not find a patch to fix this.

 scripts/dummy-tools/gcc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/dummy-tools/gcc +2 -2
index 7b10332b23ba..39e65fee59bd 100755
@@ -57,9 +57,9 @@ if arg_contain --version "$@"; then
 fi
 
 if arg_contain -E "$@"; then
-	# For scripts/gcc-version.sh; This emulates GCC 20.0.0
+	# For scripts/cc-version.sh; This emulates GCC 20.0.0
 	if arg_contain - "$@"; then
-		sed 's/^__GNUC__$/20/; s/^__GNUC_MINOR__$/0/; s/^__GNUC_PATCHLEVEL__$/0/'
+		sed -n '/^GCC/{s/__GNUC__/20/; s/__GNUC_MINOR__/0/; s/__GNUC_PATCHLEVEL__/0/; p;}'
 		exit 0
 	else
 		echo "no input files" >&2
Signature · 1 line
2.27.0
maintainer Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Masahiro Yamada

Commit aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig") changed how the script detects the compiler version.

Get 'make CROSS_COMPILE=scripts/dummy-tools/' back working again.

Fixes aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig")
Quoted 28 lines

---

Perhaps, Jiri may have already noticed this issue, and have a similar patch. I just checked ML, but I did not find a patch to fix this.

 scripts/dummy-tools/gcc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/dummy-tools/gcc +2 -2
index 7b10332b23ba..39e65fee59bd 100755
@@ -57,9 +57,9 @@ if arg_contain --version "$@"; then
 fi
 
 if arg_contain -E "$@"; then
-	# For scripts/gcc-version.sh; This emulates GCC 20.0.0
+	# For scripts/cc-version.sh; This emulates GCC 20.0.0
 	if arg_contain - "$@"; then
-		sed 's/^__GNUC__$/20/; s/^__GNUC_MINOR__$/0/; s/^__GNUC_PATCHLEVEL__$/0/'
+		sed -n '/^GCC/{s/__GNUC__/20/; s/__GNUC_MINOR__/0/; s/__GNUC_PATCHLEVEL__/0/; p;}'
 		exit 0
 	else
 		echo "no input files" >&2
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#2 lore raw
In reply to Masahiro Yamada
Quoted 8 lines · Masahiro Yamada

Commit aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig") changed how the script detects the compiler version.

Get 'make CROSS_COMPILE=scripts/dummy-tools/' back working again.

Fixes aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig")

Cheers,
Miguel

#3 lore raw
In reply to Masahiro Yamada
Quoted 11 lines · Masahiro Yamada

Commit aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig") changed how the script detects the compiler version.

Get 'make CROSS_COMPILE=scripts/dummy-tools/' back working again.

Fixes aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig")

---

Perhaps, Jiri may have already noticed this issue, and have a similar patch. I just checked ML, but I did not find a patch to fix this.

No, as I was making it work on 5.11 :).

BTW there is one remaining issue I came across:
config PAHOLE_HAS_SPLIT_BTF

        def_bool $(success, test `$(PAHOLE) --version | sed -E 

's/v([0-9]+)\.([0-9]+)/\1\2/'` -ge "119")

and in Makefile we see:
PAHOLE = pahole

and not something like:
PAHOLE = $(CROSS_COMPILE)pahole

Any idea how to fix this?

Quoted 20 lines
  scripts/dummy-tools/gcc | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
scripts/dummy-tools/gcc +2 -2
index 7b10332b23ba..39e65fee59bd 100755
@@ -57,9 +57,9 @@ if arg_contain --version "$@"; then
  fi
 
  if arg_contain -E "$@"; then
-	# For scripts/gcc-version.sh; This emulates GCC 20.0.0
+	# For scripts/cc-version.sh; This emulates GCC 20.0.0
  	if arg_contain - "$@"; then
-		sed 's/^__GNUC__$/20/; s/^__GNUC_MINOR__$/0/; s/^__GNUC_PATCHLEVEL__$/0/'
+		sed -n '/^GCC/{s/__GNUC__/20/; s/__GNUC_MINOR__/0/; s/__GNUC_PATCHLEVEL__/0/; p;}'
  		exit 0
  	else
  		echo "no input files" >&2
Signature · 2 lines
js
suse labs
#4 lore raw
Quoted 14 lines · Jiri Slaby
Quoted 11 lines · Masahiro Yamada

Commit aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig") changed how the script detects the compiler version.

Get 'make CROSS_COMPILE=scripts/dummy-tools/' back working again.

Fixes aec6c60a01d3 ("kbuild: check the minimum compiler version in Kconfig")

---

Perhaps, Jiri may have already noticed this issue, and have a similar patch. I just checked ML, but I did not find a patch to fix this.

Quoted 6 lines

No, as I was making it work on 5.11 :).

BTW there is one remaining issue I came across:
config PAHOLE_HAS_SPLIT_BTF

         def_bool $(success, test `$(PAHOLE) --version | sed -E

's/v([0-9]+)\.([0-9]+)/\1\2/'` -ge "119")

I think I said this somewhere, but PAHOLE_HAS_SPLIT_BTF should be deleted.
Checking the pahole version in Kconfig is wrong, I believe.

Quoted 6 lines

and in Makefile we see:
PAHOLE = pahole

and not something like:
PAHOLE = $(CROSS_COMPILE)pahole

I do not think $(CROSS_COMPILE)pahole makes sense.

As far as I test, pahole works for fereing architecture objects too. The DWARF format is identical across architectures.

For example, for the following code:

$ cat test.c
struct sample {
     char a[2];
     long l;
     int i;
     void *p;
     short s;
} sample;
$ gcc -g -c -o test.o test.c; pahole test.o
$ arm-linux-gnueabihf-gcc -g -c -o test.o test.c; pahole test.o
$ aarch64-linux-gnu-gcc -g -c -o test.o test.c; pahole test.o

All worked for me.

Quoted 12 lines

Any idea how to fix this?

Quoted 10 lines
  scripts/dummy-tools/gcc | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
scripts/dummy-tools/gcc +0 -0
index 7b10332b23ba..39e65fee59bd 100755
@@ -57,9 +57,9 @@ if arg_contain --version "$@"; then
  fi
 
Quoted 15 lines

scripts/dummy-tools/gcc if arg_contain --version "$@"; then · line 65

Quoted 10 lines
scripts/dummy-tools/gcc +2 -2
  if arg_contain -E "$@"; then
-     # For scripts/gcc-version.sh; This emulates GCC 20.0.0
+     # For scripts/cc-version.sh; This emulates GCC 20.0.0
      if arg_contain - "$@"; then
-             sed 's/^__GNUC__$/20/; s/^__GNUC_MINOR__$/0/; s/^__GNUC_PATCHLEVEL__$/0/'
+             sed -n '/^GCC/{s/__GNUC__/20/; s/__GNUC_MINOR__/0/; s/__GNUC_PATCHLEVEL__/0/; p;}'
              exit 0
      else
              echo "no input files" >&2

--
js
suse labs

--
Best Regards
Masahiro Yamada