Hello,
We were trying to build 4.14 kernel with GCC 8, but perf failed to compile. The upstream tree seems to have necessary commits to support GCC 8, but they were not ported to 4.14 branch. With backporting the following commits we were able to restore perf compilation and compile a working 4.14 kernel with GCC 8.2:
6810158d526e483868e519befff407b91e76b3db: perf annotate: Use asprintf when formatting objdump command b7a313d84e853049062011d78cb04b6decd12f5c: perf tools: Fix python extension build for gcc 8 77f18153c080855e1c3fb520ca31a4e61530121d: perf tools: Fix snprint warnings for gcc 8 06c3f2aa9fc68e7f3fe3d83e7569d2a2801d9f99: perf utils: Move is_directory() to path.h
Propose to apply the above commits to 4.14 to be able to compile it with GCC 8 (mostly to properly support CONFIG_RETPOLINE)
Commit 6810158d526e483868e519befff407b91e76b3db might need adjustment to cleanly apply on 4.14 branch.
Regards, Ignat
On Tue, Oct 09, 2018 at 02:07:15PM +0100, Ignat Korchagin wrote:
Hello,
We were trying to build 4.14 kernel with GCC 8, but perf failed to compile. The upstream tree seems to have necessary commits to support GCC 8, but they were not ported to 4.14 branch. With backporting the following commits we were able to restore perf compilation and compile a working 4.14 kernel with GCC 8.2:
6810158d526e483868e519befff407b91e76b3db: perf annotate: Use asprintf when formatting objdump command b7a313d84e853049062011d78cb04b6decd12f5c: perf tools: Fix python extension build for gcc 8 77f18153c080855e1c3fb520ca31a4e61530121d: perf tools: Fix snprint warnings for gcc 8 06c3f2aa9fc68e7f3fe3d83e7569d2a2801d9f99: perf utils: Move is_directory() to path.h
Why is this last commit needed?
I've applied the other 3 now.
thanks,
greg k-h
On Thu, Oct 11, 2018 at 8:29 AM Greg KH greg@kroah.com wrote:
Why is this last commit needed?
Without it I get the following compile error (Debian 9 with self-compiled GCC 8):
builtin-script.c: In function 'get_script_path': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c: In function 'find_scripts': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
Regards, Ignat
On Thu, Oct 11, 2018 at 11:12:38AM +0100, Ignat Korchagin wrote:
On Thu, Oct 11, 2018 at 8:29 AM Greg KH greg@kroah.com wrote:
Why is this last commit needed?
Without it I get the following compile error (Debian 9 with self-compiled GCC 8):
builtin-script.c: In function 'get_script_path': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c: In function 'find_scripts': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
That's odd, given that the moved code is the same...
Oh well, I'll go queue it up, thanks,
greg k-h
That's odd, given that the moved code is the same...
Yes, I agree. But I didn't debug why exactly it happens, because there is an upstream patch already, which "fixes" it somehow.
Thanks, Ignat On Thu, Oct 11, 2018 at 11:17 AM Greg KH greg@kroah.com wrote:
On Thu, Oct 11, 2018 at 11:12:38AM +0100, Ignat Korchagin wrote:
On Thu, Oct 11, 2018 at 8:29 AM Greg KH greg@kroah.com wrote:
Why is this last commit needed?
Without it I get the following compile error (Debian 9 with self-compiled GCC 8):
builtin-script.c: In function 'get_script_path': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c: In function 'find_scripts': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
That's odd, given that the moved code is the same...
Oh well, I'll go queue it up, thanks,
greg k-h
Hi Greg,
It seems 4.14.76 perf compile is still broken for GCC 8 and we can't find "77f18153c080855e1c3fb520ca31a4e61530121d: perf tools: Fix snprint warnings for gcc 8" in the changelog.
Was it missed by any chance?
Thanks, Ignat On Thu, Oct 11, 2018 at 11:26 AM Ignat Korchagin ignat@cloudflare.com wrote:
That's odd, given that the moved code is the same...
Yes, I agree. But I didn't debug why exactly it happens, because there is an upstream patch already, which "fixes" it somehow.
Thanks, Ignat On Thu, Oct 11, 2018 at 11:17 AM Greg KH greg@kroah.com wrote:
On Thu, Oct 11, 2018 at 11:12:38AM +0100, Ignat Korchagin wrote:
On Thu, Oct 11, 2018 at 8:29 AM Greg KH greg@kroah.com wrote:
Why is this last commit needed?
Without it I get the following compile error (Debian 9 with self-compiled GCC 8):
builtin-script.c: In function 'get_script_path': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c: In function 'find_scripts': builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-script.c:2139:20: error: '%s' directive writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-overflow=] sprintf(path, "%s/%s", base_path, dent->d_name); ^~ In file included from /usr/include/stdio.h:938, from util/event.h:6, from util/debug.h:9, from builtin-script.c:6: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 4352 bytes into a destination of size 4096 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
That's odd, given that the moved code is the same...
Oh well, I'll go queue it up, thanks,
greg k-h
On Tue, Oct 16, 2018 at 05:28:39PM +0100, Ignat Korchagin wrote:
Hi Greg,
It seems 4.14.76 perf compile is still broken for GCC 8 and we can't find "77f18153c080855e1c3fb520ca31a4e61530121d: perf tools: Fix snprint warnings for gcc 8" in the changelog.
Was it missed by any chance?
I think it was totally missed, sorry about that. Now queued up.
greg k-h
linux-stable-mirror@lists.linaro.org