linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gcc-5: error: -gz is not supported in this configuration
@ 2020-06-09 13:11 kernel test robot
  2020-06-09 17:28 ` Nick Desaulniers
  0 siblings, 1 reply; 21+ messages in thread
From: kernel test robot @ 2020-06-09 13:11 UTC (permalink / raw)
  To: Nick Desaulniers; +Cc: kbuild-all, linux-kernel, Masahiro Yamada, Fangrui Song

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support compressed debug info
date:   12 days ago
config: x86_64-randconfig-r032-20200609 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce (this is a W=1 build):
        git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> gcc-5: error: -gz is not supported in this configuration
make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1169: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27478 bytes --]

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

* Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-09 13:11 gcc-5: error: -gz is not supported in this configuration kernel test robot
@ 2020-06-09 17:28 ` Nick Desaulniers
  2020-06-09 17:49   ` Fangrui Song
  0 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-06-09 17:28 UTC (permalink / raw)
  To: kernel test robot, Masahiro Yamada; +Cc: kbuild-all, LKML, Fangrui Song

On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
> commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support compressed debug info
> date:   12 days ago
> config: x86_64-randconfig-r032-20200609 (attached as .config)
> compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
> reproduce (this is a W=1 build):
>         git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
>         # save the attached .config to linux build tree
>         make W=1 ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>, old ones prefixed by <<):
>
> >> gcc-5: error: -gz is not supported in this configuration

Hmm...I wonder if the feature detection is incomplete?  I suspect it's
possible to not depend on zlib.

> make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] Error 1
> make[2]: Target '__build' not remade because of errors.
> make[1]: *** [Makefile:1169: prepare0] Error 2
> make[1]: Target 'prepare' not remade because of errors.
> make: *** [Makefile:185: __sub-make] Error 2
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



-- 
Thanks,
~Nick Desaulniers

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

* Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-09 17:28 ` Nick Desaulniers
@ 2020-06-09 17:49   ` Fangrui Song
  2020-06-10  0:30     ` [kbuild-all] " Rong Chen
  0 siblings, 1 reply; 21+ messages in thread
From: Fangrui Song @ 2020-06-09 17:49 UTC (permalink / raw)
  To: Nick Desaulniers; +Cc: kernel test robot, Masahiro Yamada, kbuild-all, LKML

On 2020-06-09, Nick Desaulniers wrote:
>On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> wrote:
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
>> commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support compressed debug info
>> date:   12 days ago
>> config: x86_64-randconfig-r032-20200609 (attached as .config)
>> compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>> reproduce (this is a W=1 build):
>>         git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
>>         # save the attached .config to linux build tree
>>         make W=1 ARCH=x86_64
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All errors (new ones prefixed by >>, old ones prefixed by <<):
>>
>> >> gcc-5: error: -gz is not supported in this configuration
>
>Hmm...I wonder if the feature detection is incomplete?  I suspect it's
>possible to not depend on zlib.
>
>> make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] Error 1
>> make[2]: Target '__build' not remade because of errors.
>> make[1]: *** [Makefile:1169: prepare0] Error 2
>> make[1]: Target 'prepare' not remade because of errors.
>> make: *** [Makefile:185: __sub-make] Error 2

The output of gcc-5 -v --version on that machine may help.  The
convoluted gcc_cv_ld_compress_de logic in gcc/configure.ac may be
related, but I can't find any mistake that our
CONFIG_DEBUG_INFO_COMPRESSED conditions may make.

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-09 17:49   ` Fangrui Song
@ 2020-06-10  0:30     ` Rong Chen
  2020-06-10  0:58       ` Fangrui Song
  0 siblings, 1 reply; 21+ messages in thread
From: Rong Chen @ 2020-06-10  0:30 UTC (permalink / raw)
  To: Fangrui Song, Nick Desaulniers
  Cc: kernel test robot, Masahiro Yamada, kbuild-all, LKML



On 6/10/20 1:49 AM, Fangrui Song wrote:
> On 2020-06-09, Nick Desaulniers wrote:
>> On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> wrote:
>>>
>>> tree: 
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>>> master
>>> head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
>>> commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support 
>>> compressed debug info
>>> date:   12 days ago
>>> config: x86_64-randconfig-r032-20200609 (attached as .config)
>>> compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>>> reproduce (this is a W=1 build):
>>>         git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
>>>         # save the attached .config to linux build tree
>>>         make W=1 ARCH=x86_64
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <lkp@intel.com>
>>>
>>> All errors (new ones prefixed by >>, old ones prefixed by <<):
>>>
>>> >> gcc-5: error: -gz is not supported in this configuration
>>
>> Hmm...I wonder if the feature detection is incomplete?  I suspect it's
>> possible to not depend on zlib.
>>
>>> make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] Error 1
>>> make[2]: Target '__build' not remade because of errors.
>>> make[1]: *** [Makefile:1169: prepare0] Error 2
>>> make[1]: Target 'prepare' not remade because of errors.
>>> make: *** [Makefile:185: __sub-make] Error 2
>
> The output of gcc-5 -v --version on that machine may help.  The
> convoluted gcc_cv_ld_compress_de logic in gcc/configure.ac may be
> related, but I can't find any mistake that our
> CONFIG_DEBUG_INFO_COMPRESSED conditions may make.

Hi Fangrui,

Here is the output:

$gcc-5 -v --version
Using built-in specs.
COLLECT_GCC=gcc-5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
5.5.0-12ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs 
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-5 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-vtable-verify --enable-libmpx --enable-plugin 
--enable-default-pie --with-system-zlib --enable-objc-gc 
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic 
--enable-checking=release --build=x86_64-linux-gnu 
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1)
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
  /usr/lib/gcc/x86_64-linux-gnu/5/cc1 -quiet -v -imultiarch 
x86_64-linux-gnu help-dummy -quiet -dumpbase help-dummy -mtune=generic 
-march=x86-64 -auxbase help-dummy -version --version 
-fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccqnZumV.s
GNU C11 (Ubuntu 5.5.0-12ubuntu1) version 5.5.0 20171010 (x86_64-linux-gnu)
         compiled by GNU C version 5.5.0 20171010, GMP version 6.1.2, 
MPFR version 4.0.1, MPC version 1.1.0
warning: MPFR header version 4.0.1 differs from library version 4.0.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
  as -v --64 --version -o /tmp/ccRPgs9J.o /tmp/ccqnZumV.s
GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU 
Binutils for Ubuntu) 2.34
GNU assembler (GNU Binutils for Ubuntu) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
  /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin 
/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so 
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper 
-plugin-opt=-fresolution=/tmp/ccJLhs3y.res 
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr 
-m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker 
/lib64/ld-linux-x86-64.so.2 -pie -z now -z relro --version 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/Scrt1.o 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o 
/usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o 
-L/usr/lib/gcc/x86_64-linux-gnu/5 
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu 
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib 
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. 
/tmp/ccRPgs9J.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc 
-lgcc --push-state --as-needed -lgcc_s --pop-state 
/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
collect2 version 5.5.0 20171010
/usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so 
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper 
-plugin-opt=-fresolution=/tmp/ccJLhs3y.res 
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr 
-m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker 
/lib64/ld-linux-x86-64.so.2 -pie -z now -z relro --version 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/Scrt1.o 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o 
/usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o 
-L/usr/lib/gcc/x86_64-linux-gnu/5 
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu 
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib 
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. 
/tmp/ccRPgs9J.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc 
-lgcc --push-state --as-needed -lgcc_s --pop-state 
/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
GNU ld (GNU Binutils for Ubuntu) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later 
version.
This program has absolutely no warranty.

Best Regards,
Rong Chen

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-10  0:30     ` [kbuild-all] " Rong Chen
@ 2020-06-10  0:58       ` Fangrui Song
  2020-06-10  1:49         ` Rong Chen
  0 siblings, 1 reply; 21+ messages in thread
From: Fangrui Song @ 2020-06-10  0:58 UTC (permalink / raw)
  To: Rong Chen
  Cc: Nick Desaulniers, kernel test robot, Masahiro Yamada, kbuild-all, LKML

On 2020-06-10, Rong Chen wrote:
>
>
>On 6/10/20 1:49 AM, Fangrui Song wrote:
>>On 2020-06-09, Nick Desaulniers wrote:
>>>On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> wrote:
>>>>
>>>>tree: 
>>>>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>>>>master
>>>>head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
>>>>commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: 
>>>>support compressed debug info
>>>>date:   12 days ago
>>>>config: x86_64-randconfig-r032-20200609 (attached as .config)
>>>>compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>>>>reproduce (this is a W=1 build):
>>>>        git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
>>>>        # save the attached .config to linux build tree
>>>>        make W=1 ARCH=x86_64
>>>>
>>>>If you fix the issue, kindly add following tag as appropriate
>>>>Reported-by: kernel test robot <lkp@intel.com>
>>>>
>>>>All errors (new ones prefixed by >>, old ones prefixed by <<):
>>>>
>>>>>> gcc-5: error: -gz is not supported in this configuration
>>>
>>>Hmm...I wonder if the feature detection is incomplete?  I suspect it's
>>>possible to not depend on zlib.
>>>
>>>>make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] Error 1
>>>>make[2]: Target '__build' not remade because of errors.
>>>>make[1]: *** [Makefile:1169: prepare0] Error 2
>>>>make[1]: Target 'prepare' not remade because of errors.
>>>>make: *** [Makefile:185: __sub-make] Error 2
>>
>>The output of gcc-5 -v --version on that machine may help.  The
>>convoluted gcc_cv_ld_compress_de logic in gcc/configure.ac may be
>>related, but I can't find any mistake that our
>>CONFIG_DEBUG_INFO_COMPRESSED conditions may make.
>
>Hi Fangrui,
>
>Here is the output:
>
>$gcc-5 -v --version
>Using built-in specs.
>COLLECT_GCC=gcc-5
>COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
>gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>Copyright (C) 2015 Free Software Foundation, Inc.
>This is free software; see the source for copying conditions.  There is NO
>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
>Target: x86_64-linux-gnu
>Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
>5.5.0-12ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs 
>--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr 
>--program-suffix=-5 --enable-shared --enable-linker-build-id 
>--libexecdir=/usr/lib --without-included-gettext 
>--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ 
>--enable-clocale=gnu --enable-libstdcxx-debug 
>--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new 
>--enable-gnu-unique-object --disable-vtable-verify --enable-libmpx 
>--enable-plugin --enable-default-pie --with-system-zlib 
>--enable-objc-gc --enable-multiarch --disable-werror 
>--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 
>--enable-multilib --with-tune=generic --enable-checking=release 
>--build=x86_64-linux-gnu --host=x86_64-linux-gnu 
>--target=x86_64-linux-gnu
>Thread model: posix
>gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1)
>COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
> /usr/lib/gcc/x86_64-linux-gnu/5/cc1 -quiet -v -imultiarch 
>x86_64-linux-gnu help-dummy -quiet -dumpbase help-dummy -mtune=generic 
>-march=x86-64 -auxbase help-dummy -version --version 
>-fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccqnZumV.s
>GNU C11 (Ubuntu 5.5.0-12ubuntu1) version 5.5.0 20171010 (x86_64-linux-gnu)
>        compiled by GNU C version 5.5.0 20171010, GMP version 6.1.2, 
>MPFR version 4.0.1, MPC version 1.1.0
>warning: MPFR header version 4.0.1 differs from library version 4.0.2.
>GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
> as -v --64 --version -o /tmp/ccRPgs9J.o /tmp/ccqnZumV.s
>GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU 
>Binutils for Ubuntu) 2.34
>GNU assembler (GNU Binutils for Ubuntu) 2.34
>Copyright (C) 2020 Free Software Foundation, Inc.
>This program is free software; you may redistribute it under the terms of
>the GNU General Public License version 3 or later.
>This program has absolutely no warranty.
>This assembler was configured for a target of `x86_64-linux-gnu'.
>COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
>LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
>COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
> /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin 
>/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so 
>-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper 
>-plugin-opt=-fresolution=/tmp/ccJLhs3y.res 
>-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
>-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
>-plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id 
>--eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed 
>-dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro 
>--version 
>/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/Scrt1.o 
>/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o 
>/usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o 
>-L/usr/lib/gcc/x86_64-linux-gnu/5 
>-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu 
>-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib 
>-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
>-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. 
>/tmp/ccRPgs9J.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc 
>-lgcc --push-state --as-needed -lgcc_s --pop-state 
>/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o 
>/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
>collect2 version 5.5.0 20171010
>/usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so 
>-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper 
>-plugin-opt=-fresolution=/tmp/ccJLhs3y.res 
>-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
>-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
>-plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id 
>--eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed 
>-dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro 
>--version 
>/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/Scrt1.o 
>/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o 
>/usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o 
>-L/usr/lib/gcc/x86_64-linux-gnu/5 
>-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu 
>-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib 
>-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
>-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. 
>/tmp/ccRPgs9J.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc 
>-lgcc --push-state --as-needed -lgcc_s --pop-state 
>/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o 
>/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
>GNU ld (GNU Binutils for Ubuntu) 2.34
>Copyright (C) 2020 Free Software Foundation, Inc.
>This program is free software; you may redistribute it under the terms of
>the GNU General Public License version 3 or (at your option) a later 
>version.
>This program has absolutely no warranty.
>
>Best Regards,
>Rong Chen

Hi Rong,

binutils (both GNU as and GNU ld) is new. It oughts to support
--compress-debug-sections=zlib . The failure looks strange to me.

Can you extract the gcc-5 command line building scripts/mod/empty.o
and run it manually? Also run gcc-5 -g -gz=zlib a.c -c on a trivial file and check whether `readelf -WS a.o`
has the section flag C ("compressed").


Regards,

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-10  0:58       ` Fangrui Song
@ 2020-06-10  1:49         ` Rong Chen
  2020-06-10  3:12           ` Arvind Sankar
  0 siblings, 1 reply; 21+ messages in thread
From: Rong Chen @ 2020-06-10  1:49 UTC (permalink / raw)
  To: Fangrui Song
  Cc: Nick Desaulniers, kernel test robot, Masahiro Yamada, kbuild-all, LKML



On 6/10/20 8:58 AM, Fangrui Song wrote:
> On 2020-06-10, Rong Chen wrote:
>>
>>
>> On 6/10/20 1:49 AM, Fangrui Song wrote:
>>> On 2020-06-09, Nick Desaulniers wrote:
>>>> On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> 
>>>> wrote:
>>>>>
>>>>> tree: 
>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>>>>> master
>>>>> head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
>>>>> commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support 
>>>>> compressed debug info
>>>>> date:   12 days ago
>>>>> config: x86_64-randconfig-r032-20200609 (attached as .config)
>>>>> compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>>>>> reproduce (this is a W=1 build):
>>>>>         git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
>>>>>         # save the attached .config to linux build tree
>>>>>         make W=1 ARCH=x86_64
>>>>>
>>>>> If you fix the issue, kindly add following tag as appropriate
>>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>>
>>>>> All errors (new ones prefixed by >>, old ones prefixed by <<):
>>>>>
>>>>>>> gcc-5: error: -gz is not supported in this configuration
>>>>
>>>> Hmm...I wonder if the feature detection is incomplete?  I suspect it's
>>>> possible to not depend on zlib.
>>>>
>>>>> make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] 
>>>>> Error 1
>>>>> make[2]: Target '__build' not remade because of errors.
>>>>> make[1]: *** [Makefile:1169: prepare0] Error 2
>>>>> make[1]: Target 'prepare' not remade because of errors.
>>>>> make: *** [Makefile:185: __sub-make] Error 2
>>>
>>> The output of gcc-5 -v --version on that machine may help. The
>>> convoluted gcc_cv_ld_compress_de logic in gcc/configure.ac may be
>>> related, but I can't find any mistake that our
>>> CONFIG_DEBUG_INFO_COMPRESSED conditions may make.
>>
>> Hi Fangrui,
>>
>> Here is the output:
>>
>> $gcc-5 -v --version
>> Using built-in specs.
>> COLLECT_GCC=gcc-5
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
>> gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>> Copyright (C) 2015 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions. There 
>> is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
>> PURPOSE.
>>
>>
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
>> 5.5.0-12ubuntu1' 
>> --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs 
>> --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr 
>> --program-suffix=-5 --enable-shared --enable-linker-build-id 
>> --libexecdir=/usr/lib --without-included-gettext 
>> --enable-threads=posix --libdir=/usr/lib --enable-nls 
>> --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug 
>> --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new 
>> --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx 
>> --enable-plugin --enable-default-pie --with-system-zlib 
>> --enable-objc-gc --enable-multiarch --disable-werror 
>> --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 
>> --enable-multilib --with-tune=generic --enable-checking=release 
>> --build=x86_64-linux-gnu --host=x86_64-linux-gnu 
>> --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1)
>> COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
>>  /usr/lib/gcc/x86_64-linux-gnu/5/cc1 -quiet -v -imultiarch 
>> x86_64-linux-gnu help-dummy -quiet -dumpbase help-dummy 
>> -mtune=generic -march=x86-64 -auxbase help-dummy -version --version 
>> -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccqnZumV.s
>> GNU C11 (Ubuntu 5.5.0-12ubuntu1) version 5.5.0 20171010 
>> (x86_64-linux-gnu)
>>         compiled by GNU C version 5.5.0 20171010, GMP version 6.1.2, 
>> MPFR version 4.0.1, MPC version 1.1.0
>> warning: MPFR header version 4.0.1 differs from library version 4.0.2.
>> GGC heuristics: --param ggc-min-expand=100 --param 
>> ggc-min-heapsize=131072
>> COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
>>  as -v --64 --version -o /tmp/ccRPgs9J.o /tmp/ccqnZumV.s
>> GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU 
>> Binutils for Ubuntu) 2.34
>> GNU assembler (GNU Binutils for Ubuntu) 2.34
>> Copyright (C) 2020 Free Software Foundation, Inc.
>> This program is free software; you may redistribute it under the 
>> terms of
>> the GNU General Public License version 3 or later.
>> This program has absolutely no warranty.
>> This assembler was configured for a target of `x86_64-linux-gnu'.
>> COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/ 
>>
>> LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/ 
>>
>> COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
>>  /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin 
>> /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so 
>> -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper 
>> -plugin-opt=-fresolution=/tmp/ccJLhs3y.res 
>> -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
>> -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
>> -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id 
>> --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed 
>> -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro 
>> --version 
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/Scrt1.o 
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o 
>> /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o 
>> -L/usr/lib/gcc/x86_64-linux-gnu/5 
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu 
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib 
>> -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
>> -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. 
>> /tmp/ccRPgs9J.o -lgcc --push-state --as-needed -lgcc_s --pop-state 
>> -lc -lgcc --push-state --as-needed -lgcc_s --pop-state 
>> /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o 
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
>> collect2 version 5.5.0 20171010
>> /usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so 
>> -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper 
>> -plugin-opt=-fresolution=/tmp/ccJLhs3y.res 
>> -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
>> -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
>> -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id 
>> --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed 
>> -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro 
>> --version 
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/Scrt1.o 
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o 
>> /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o 
>> -L/usr/lib/gcc/x86_64-linux-gnu/5 
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu 
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib 
>> -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
>> -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. 
>> /tmp/ccRPgs9J.o -lgcc --push-state --as-needed -lgcc_s --pop-state 
>> -lc -lgcc --push-state --as-needed -lgcc_s --pop-state 
>> /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o 
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
>> GNU ld (GNU Binutils for Ubuntu) 2.34
>> Copyright (C) 2020 Free Software Foundation, Inc.
>> This program is free software; you may redistribute it under the 
>> terms of
>> the GNU General Public License version 3 or (at your option) a later 
>> version.
>> This program has absolutely no warranty.
>>
>> Best Regards,
>> Rong Chen
>
> Hi Rong,
>
> binutils (both GNU as and GNU ld) is new. It oughts to support
> --compress-debug-sections=zlib . The failure looks strange to me.
>
> Can you extract the gcc-5 command line building scripts/mod/empty.o
> and run it manually? 

$ gcc-5 -Wp,-MMD,scripts/mod/.empty.o.d  -nostdinc -isystem 
/usr/lib/gcc/x86_64-linux-gnu/5/include -I./arch/x86/include 
-I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi 
-I./arch/x86/include/generated/uapi -I./include/uapi 
-I./include/generated/uapi -include ./include/linux/kconfig.h -include 
./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef 
-Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing 
-fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration 
-Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx 
-mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 
-mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 
-mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel 
-DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables 
-mindirect-branch=thunk-extern -mindirect-branch-register 
-fno-jump-tables -fno-delete-null-pointer-checks -Os 
--param=allow-store-data-races=0 -Wframe-larger-than=2048 
-fstack-protector-strong -Wno-unused-but-set-variable 
-fno-omit-frame-pointer -fno-optimize-sibling-calls 
-fno-var-tracking-assignments -g -gdwarf-4 -femit-struct-debug-baseonly 
-fno-var-tracking -gz=zlib -Wdeclaration-after-statement -Wvla 
-Wno-pointer-sign -DKBUILD_MODFILE='"scripts/mod/empty"' 
-DKBUILD_BASENAME='"empty"' -DKBUILD_MODNAME='"empty"' -c -o 
scripts/mod/empty.o scripts/mod/empty.c
gcc-5: error: -gz is not supported in this configuration

> Also run gcc-5 -g -gz=zlib a.c -c on a trivial file and check whether 
> `readelf -WS a.o`
> has the section flag C ("compressed").

$ gcc-5 -g -gz=zlib a.c -c
gcc-5: error: -gz is not supported in this configuration

and no a.o generated.

Best Regards,
Rong Chen

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-10  1:49         ` Rong Chen
@ 2020-06-10  3:12           ` Arvind Sankar
  2020-06-10  3:23             ` Arvind Sankar
  0 siblings, 1 reply; 21+ messages in thread
From: Arvind Sankar @ 2020-06-10  3:12 UTC (permalink / raw)
  To: Rong Chen
  Cc: Fangrui Song, Nick Desaulniers, kernel test robot,
	Masahiro Yamada, kbuild-all, LKML

On Wed, Jun 10, 2020 at 09:49:01AM +0800, Rong Chen wrote:
> 
> 
> On 6/10/20 8:58 AM, Fangrui Song wrote:
> > On 2020-06-10, Rong Chen wrote:
> >>
> >>
> >> On 6/10/20 1:49 AM, Fangrui Song wrote:
> >>> On 2020-06-09, Nick Desaulniers wrote:
> >>>> On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> 
> >>>> wrote:
> >>>>>
> >>>>> tree: 
> >>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> >>>>> master
> >>>>> head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
> >>>>> commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support 
> >>>>> compressed debug info
> >>>>> date:   12 days ago
> >>>>> config: x86_64-randconfig-r032-20200609 (attached as .config)
> >>>>> compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
> >>>>> reproduce (this is a W=1 build):
> >>>>>         git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
> >>>>>         # save the attached .config to linux build tree
> >>>>>         make W=1 ARCH=x86_64
> >>>>>
> >>>>> If you fix the issue, kindly add following tag as appropriate
> >>>>> Reported-by: kernel test robot <lkp@intel.com>
> >>>>>
> >>>>> All errors (new ones prefixed by >>, old ones prefixed by <<):
> >>>>>
> >>>>>>> gcc-5: error: -gz is not supported in this configuration
> >>>>
> >>>> Hmm...I wonder if the feature detection is incomplete?  I suspect it's
> >>>> possible to not depend on zlib.
> >>>>
> >>>>> make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] 
> >>>>> Error 1
> >>>>> make[2]: Target '__build' not remade because of errors.
> >>>>> make[1]: *** [Makefile:1169: prepare0] Error 2
> >>>>> make[1]: Target 'prepare' not remade because of errors.
> >>>>> make: *** [Makefile:185: __sub-make] Error 2
> >>>
> >>> The output of gcc-5 -v --version on that machine may help. The
> >>> convoluted gcc_cv_ld_compress_de logic in gcc/configure.ac may be
> >>> related, but I can't find any mistake that our
> >>> CONFIG_DEBUG_INFO_COMPRESSED conditions may make.
> >>

The output of gcc-5 -dumpspecs may also be useful.

The exact Kconfig check should have been
	gcc-5 -Werror -gz=zlib -S -x c /dev/null -o /dev/null

I can't see how that would succeed if the a.c test didn't but maybe just
in case?

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-10  3:12           ` Arvind Sankar
@ 2020-06-10  3:23             ` Arvind Sankar
  2020-06-10  4:26               ` Arvind Sankar
  0 siblings, 1 reply; 21+ messages in thread
From: Arvind Sankar @ 2020-06-10  3:23 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Rong Chen, Fangrui Song, Nick Desaulniers, kernel test robot,
	Masahiro Yamada, kbuild-all, LKML

On Tue, Jun 09, 2020 at 11:12:25PM -0400, Arvind Sankar wrote:
> On Wed, Jun 10, 2020 at 09:49:01AM +0800, Rong Chen wrote:
> > 
> > 
> > On 6/10/20 8:58 AM, Fangrui Song wrote:
> > > On 2020-06-10, Rong Chen wrote:
> > >>
> > >>
> > >> On 6/10/20 1:49 AM, Fangrui Song wrote:
> > >>> On 2020-06-09, Nick Desaulniers wrote:
> > >>>> On Tue, Jun 9, 2020 at 6:12 AM kernel test robot <lkp@intel.com> 
> > >>>> wrote:
> > >>>>>
> > >>>>> tree: 
> > >>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> > >>>>> master
> > >>>>> head:   abfbb29297c27e3f101f348dc9e467b0fe70f919
> > >>>>> commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support 
> > >>>>> compressed debug info
> > >>>>> date:   12 days ago
> > >>>>> config: x86_64-randconfig-r032-20200609 (attached as .config)
> > >>>>> compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
> > >>>>> reproduce (this is a W=1 build):
> > >>>>>         git checkout 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace
> > >>>>>         # save the attached .config to linux build tree
> > >>>>>         make W=1 ARCH=x86_64
> > >>>>>
> > >>>>> If you fix the issue, kindly add following tag as appropriate
> > >>>>> Reported-by: kernel test robot <lkp@intel.com>
> > >>>>>
> > >>>>> All errors (new ones prefixed by >>, old ones prefixed by <<):
> > >>>>>
> > >>>>>>> gcc-5: error: -gz is not supported in this configuration
> > >>>>
> > >>>> Hmm...I wonder if the feature detection is incomplete?  I suspect it's
> > >>>> possible to not depend on zlib.
> > >>>>
> > >>>>> make[2]: *** [scripts/Makefile.build:277: scripts/mod/empty.o] 
> > >>>>> Error 1
> > >>>>> make[2]: Target '__build' not remade because of errors.
> > >>>>> make[1]: *** [Makefile:1169: prepare0] Error 2
> > >>>>> make[1]: Target 'prepare' not remade because of errors.
> > >>>>> make: *** [Makefile:185: __sub-make] Error 2
> > >>>
> > >>> The output of gcc-5 -v --version on that machine may help. The
> > >>> convoluted gcc_cv_ld_compress_de logic in gcc/configure.ac may be
> > >>> related, but I can't find any mistake that our
> > >>> CONFIG_DEBUG_INFO_COMPRESSED conditions may make.
> > >>
> 
> The output of gcc-5 -dumpspecs may also be useful.
> 
> The exact Kconfig check should have been
> 	gcc-5 -Werror -gz=zlib -S -x c /dev/null -o /dev/null
> 
> I can't see how that would succeed if the a.c test didn't but maybe just
> in case?

Oh wait, -S instead of -c. Which means it runs neither the assembler nor
the linker, so gcc won't error out. But if that gcc was originally
_configured_ with a version of binutils that doesn't support -gz=zlib,
it will give an error on -c regardless of whether the runtime binutils
would actually support it or not.

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-10  3:23             ` Arvind Sankar
@ 2020-06-10  4:26               ` Arvind Sankar
  2020-06-10  6:37                 ` Fangrui Song
  0 siblings, 1 reply; 21+ messages in thread
From: Arvind Sankar @ 2020-06-10  4:26 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Rong Chen, Fangrui Song, Nick Desaulniers, kernel test robot,
	Masahiro Yamada, kbuild-all, LKML

On Tue, Jun 09, 2020 at 11:23:31PM -0400, Arvind Sankar wrote:
> On Tue, Jun 09, 2020 at 11:12:25PM -0400, Arvind Sankar wrote:
> > The output of gcc-5 -dumpspecs may also be useful.
> > 
> > The exact Kconfig check should have been
> > 	gcc-5 -Werror -gz=zlib -S -x c /dev/null -o /dev/null
> > 
> > I can't see how that would succeed if the a.c test didn't but maybe just
> > in case?
> 
> Oh wait, -S instead of -c. Which means it runs neither the assembler nor
> the linker, so gcc won't error out. But if that gcc was originally
> _configured_ with a version of binutils that doesn't support -gz=zlib,
> it will give an error on -c regardless of whether the runtime binutils
> would actually support it or not.

I think the below might be better than passing the option via -Wa, since
gcc will translate -gz=zlib into the right assembler option anyway, and
it will also generate an error if the compiler driver was misconfigured
and won't support the option even if the rest of the toolchain does,
fixing the config dependency.

Unless this doesn't work with Clang?

Alternatively (or even in addition), we should redefine cc-option to use
-c, it uses -S in the Kconfig version, apparently for speed, but -c in
the Kbuild version.

diff --git a/Makefile b/Makefile
index 839f9fee22cb..cb29e56f227a 100644
--- a/Makefile
+++ b/Makefile
@@ -842,7 +842,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO_COMPRESSED
 DEBUG_CFLAGS	+= -gz=zlib
-KBUILD_AFLAGS	+= -Wa,--compress-debug-sections=zlib
+KBUILD_AFLAGS	+= -gz=zlib
 KBUILD_LDFLAGS	+= --compress-debug-sections=zlib
 endif
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index cb98741601bd..94ce36be470c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
 	bool "Compressed debugging information"
 	depends on DEBUG_INFO
 	depends on $(cc-option,-gz=zlib)
-	depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
+	depends on $(as-option,-gz=zlib)
 	depends on $(ld-option,--compress-debug-sections=zlib)
 	help
 	  Compress the debug information using zlib.  Requires GCC 5.0+ or Clang

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

* Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration
  2020-06-10  4:26               ` Arvind Sankar
@ 2020-06-10  6:37                 ` Fangrui Song
  2020-06-10 19:11                   ` [PATCH] Makefile: Improve compressed debug info support detection Arvind Sankar
  0 siblings, 1 reply; 21+ messages in thread
From: Fangrui Song @ 2020-06-10  6:37 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Rong Chen, Nick Desaulniers, kernel test robot, Masahiro Yamada,
	kbuild-all, LKML

> But if that gcc was originally
> _configured_ with a version of binutils that doesn't support -gz=zlib,

I agree with this theory :)

On 2020-06-10, Arvind Sankar wrote:
>On Tue, Jun 09, 2020 at 11:23:31PM -0400, Arvind Sankar wrote:
>> On Tue, Jun 09, 2020 at 11:12:25PM -0400, Arvind Sankar wrote:
>> > The output of gcc-5 -dumpspecs may also be useful.
>> >
>> > The exact Kconfig check should have been
>> > 	gcc-5 -Werror -gz=zlib -S -x c /dev/null -o /dev/null
>> >
>> > I can't see how that would succeed if the a.c test didn't but maybe just
>> > in case?
>>
>> Oh wait, -S instead of -c. Which means it runs neither the assembler nor
>> the linker, so gcc won't error out. But if that gcc was originally
>> _configured_ with a version of binutils that doesn't support -gz=zlib,
>> it will give an error on -c regardless of whether the runtime binutils
>> would actually support it or not.
>
>I think the below might be better than passing the option via -Wa, since
>gcc will translate -gz=zlib into the right assembler option anyway, and
>it will also generate an error if the compiler driver was misconfigured
>and won't support the option even if the rest of the toolchain does,
>fixing the config dependency.
>
>Unless this doesn't work with Clang?

Clang>=6 supports -gz=zlib

>Alternatively (or even in addition), we should redefine cc-option to use
>-c, it uses -S in the Kconfig version, apparently for speed, but -c in
>the Kbuild version.

Unifying cc-option in scripts/Kbuild.include & scripts/Kconfig.include
sounds good.

>diff --git a/Makefile b/Makefile
>index 839f9fee22cb..cb29e56f227a 100644
>--- a/Makefile
>+++ b/Makefile
>@@ -842,7 +842,7 @@ endif
>
> ifdef CONFIG_DEBUG_INFO_COMPRESSED
> DEBUG_CFLAGS	+= -gz=zlib
>-KBUILD_AFLAGS	+= -Wa,--compress-debug-sections=zlib
>+KBUILD_AFLAGS	+= -gz=zlib
> KBUILD_LDFLAGS	+= --compress-debug-sections=zlib
> endif
>
>diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
>index cb98741601bd..94ce36be470c 100644
>--- a/lib/Kconfig.debug
>+++ b/lib/Kconfig.debug
>@@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
> 	bool "Compressed debugging information"
> 	depends on DEBUG_INFO
> 	depends on $(cc-option,-gz=zlib)
>-	depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
>+	depends on $(as-option,-gz=zlib)
> 	depends on $(ld-option,--compress-debug-sections=zlib)
> 	help
> 	  Compress the debug information using zlib.  Requires GCC 5.0+ or Clang

This patch looks good.

(clang cc1as only supports(hardcodes) a limited number of -Wa, options
(it parses the options by itself, rather than delegating to GNU as like
GCC). If there is a compiler driver option, that is usually preferable)

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

* [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-10  6:37                 ` Fangrui Song
@ 2020-06-10 19:11                   ` Arvind Sankar
  2020-06-10 21:27                     ` Nick Desaulniers
  0 siblings, 1 reply; 21+ messages in thread
From: Arvind Sankar @ 2020-06-10 19:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Fangrui Song, Rong Chen, Nick Desaulniers, kernel test robot,
	kbuild-all, LKML

Commit
  10e68b02c861 ("Makefile: support compressed debug info")
added support for compressed debug sections.

Support is detected by checking
- does the compiler support -gz=zlib
- does the assembler support --compressed-debug-sections=zlib
- does the linker support --compressed-debug-sections=zlib

However, the gcc driver's support for this option is somewhat
convoluted. The driver's builtin specs are set based on the version of
binutils that it was configured with, and it reports an error only if
the assembler (or linker) is actually invoked.

The cc-option check in scripts/Kconfig.include does not invoke the
assembler, so the gcc driver reports success even if it does not support
the option being passed to the assembler. Combined with an installed
version of binutils that is more recent than the one the compiler was
built with, it is possible for all three tests to succeed, yet an actual
compilation with -gz=zlib to fail.

Moreover, it is unnecessary to explicitly pass
--compressed-debug-sections=zlib to the assembler via -Wa, since the
driver will do that automatically.

Convert the as-option to just -gz=zlib, simplifying it as well as
performing a better test of the gcc driver's capabilities.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
 Makefile          | 2 +-
 lib/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 839f9fee22cb..cb29e56f227a 100644
--- a/Makefile
+++ b/Makefile
@@ -842,7 +842,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO_COMPRESSED
 DEBUG_CFLAGS	+= -gz=zlib
-KBUILD_AFLAGS	+= -Wa,--compress-debug-sections=zlib
+KBUILD_AFLAGS	+= -gz=zlib
 KBUILD_LDFLAGS	+= --compress-debug-sections=zlib
 endif
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index cb98741601bd..94ce36be470c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
 	bool "Compressed debugging information"
 	depends on DEBUG_INFO
 	depends on $(cc-option,-gz=zlib)
-	depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
+	depends on $(as-option,-gz=zlib)
 	depends on $(ld-option,--compress-debug-sections=zlib)
 	help
 	  Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
-- 
2.26.2


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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-10 19:11                   ` [PATCH] Makefile: Improve compressed debug info support detection Arvind Sankar
@ 2020-06-10 21:27                     ` Nick Desaulniers
  2020-06-10 23:30                       ` Arvind Sankar
  0 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-06-10 21:27 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Masahiro Yamada, Fangrui Song, Rong Chen, kernel test robot,
	kbuild-all, LKML

On Wed, Jun 10, 2020 at 12:11 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> Commit
>   10e68b02c861 ("Makefile: support compressed debug info")
> added support for compressed debug sections.
>
> Support is detected by checking
> - does the compiler support -gz=zlib
> - does the assembler support --compressed-debug-sections=zlib
> - does the linker support --compressed-debug-sections=zlib
>
> However, the gcc driver's support for this option is somewhat
> convoluted. The driver's builtin specs are set based on the version of
> binutils that it was configured with, and it reports an error only if
> the assembler (or linker) is actually invoked.
>
> The cc-option check in scripts/Kconfig.include does not invoke the
> assembler, so the gcc driver reports success even if it does not support
> the option being passed to the assembler.

Thanks for the patch! In that case, should we consider dropping the
cc-option check from the Kconfg then, too?

It seems it would help for clang-4 and older, since they do error
about the unknown option, but I'm not too worried about trying to
support that version of Clang with this config.

> Combined with an installed
> version of binutils that is more recent than the one the compiler was
> built with, it is possible for all three tests to succeed, yet an actual
> compilation with -gz=zlib to fail.

It kind of sounds like the assembler must be invoked to verify this
will work for the cflags then?

>
> Moreover, it is unnecessary to explicitly pass
> --compressed-debug-sections=zlib to the assembler via -Wa, since the
> driver will do that automatically.
>
> Convert the as-option to just -gz=zlib, simplifying it as well as
> performing a better test of the gcc driver's capabilities.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>

Does this imply all feature tests of as-option with -W(comma)... are
broken?  IIUC, then the assembler is still not invoked, much as in
this case?  (as in they all pass when maybe they should not?)  (or
based on below, maybe just the Kconfig from 74afda4016a74 in
arch/arm64/Kconfig, AS_HAS_PAC)

In the other thread, you discussed -c vs -s.  It looks like -c is used
for as-option, so I expect the assembler to be invoked.

Maybe we should look at the mismatch between Kbuild and Kconfig
regarding -c vs -s in scripts/Kbuild.include vs
scripts/Kconfig.include?  Otherwise it sounds like cc-option cannot be
used to check for `-Wa,` flags in Kconfig, since if the assembler is
never invoked, it may appear that GCC has support for
-Wa,--compress-debug-sections=zlib when it indeed does not.

> ---
>  Makefile          | 2 +-
>  lib/Kconfig.debug | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 839f9fee22cb..cb29e56f227a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -842,7 +842,7 @@ endif
>
>  ifdef CONFIG_DEBUG_INFO_COMPRESSED
>  DEBUG_CFLAGS   += -gz=zlib
> -KBUILD_AFLAGS  += -Wa,--compress-debug-sections=zlib
> +KBUILD_AFLAGS  += -gz=zlib
>  KBUILD_LDFLAGS += --compress-debug-sections=zlib
>  endif
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index cb98741601bd..94ce36be470c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
>         bool "Compressed debugging information"
>         depends on DEBUG_INFO
>         depends on $(cc-option,-gz=zlib)
> -       depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
> +       depends on $(as-option,-gz=zlib)
>         depends on $(ld-option,--compress-debug-sections=zlib)
>         help
>           Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
> --
> 2.26.2
>


--
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-10 21:27                     ` Nick Desaulniers
@ 2020-06-10 23:30                       ` Arvind Sankar
  2020-06-10 23:39                         ` Arvind Sankar
  2020-06-11 21:09                         ` Nick Desaulniers
  0 siblings, 2 replies; 21+ messages in thread
From: Arvind Sankar @ 2020-06-10 23:30 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Arvind Sankar, Masahiro Yamada, Fangrui Song, Rong Chen,
	kernel test robot, kbuild-all, LKML

On Wed, Jun 10, 2020 at 02:27:55PM -0700, Nick Desaulniers wrote:
> On Wed, Jun 10, 2020 at 12:11 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > Commit
> >   10e68b02c861 ("Makefile: support compressed debug info")
> > added support for compressed debug sections.
> >
> > Support is detected by checking
> > - does the compiler support -gz=zlib
> > - does the assembler support --compressed-debug-sections=zlib
> > - does the linker support --compressed-debug-sections=zlib
> >
> > However, the gcc driver's support for this option is somewhat
> > convoluted. The driver's builtin specs are set based on the version of
> > binutils that it was configured with, and it reports an error only if
> > the assembler (or linker) is actually invoked.
> >
> > The cc-option check in scripts/Kconfig.include does not invoke the
> > assembler, so the gcc driver reports success even if it does not support
> > the option being passed to the assembler.
> 
> Thanks for the patch! In that case, should we consider dropping the
> cc-option check from the Kconfg then, too?
> 
> It seems it would help for clang-4 and older, since they do error
> about the unknown option, but I'm not too worried about trying to
> support that version of Clang with this config.

Also for gcc4 which doesn't support this at all -- that will report
error on cc-option. We don't need to support it, but we shouldn't let it
be enabled either.

> 
> > Combined with an installed
> > version of binutils that is more recent than the one the compiler was
> > built with, it is possible for all three tests to succeed, yet an actual
> > compilation with -gz=zlib to fail.
> 
> It kind of sounds like the assembler must be invoked to verify this
> will work for the cflags then?
> 

Yes, the gcc driver reports an error when deciding what to pass to the
assembler for -gz=zlib, if it was configured with a linker that does not
support the flag. It's even more weird actually -- if it was configured
with a linker that supports the flag but an assembler that doesn't, it
will silently eat the flag when calling the assembler. At least that
won't break anything, though none of the .o files will be compressed.

> >
> > Moreover, it is unnecessary to explicitly pass
> > --compressed-debug-sections=zlib to the assembler via -Wa, since the
> > driver will do that automatically.
> >
> > Convert the as-option to just -gz=zlib, simplifying it as well as
> > performing a better test of the gcc driver's capabilities.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> 
> Does this imply all feature tests of as-option with -W(comma)... are
> broken?  IIUC, then the assembler is still not invoked, much as in
> this case?  (as in they all pass when maybe they should not?)  (or
> based on below, maybe just the Kconfig from 74afda4016a74 in
> arch/arm64/Kconfig, AS_HAS_PAC)

No, as-option does invoke the assembler. The problem here is that with
-Wa, the option is only seen by the assembler, not the gcc driver. So it
will succeed because the assembler supports it, but it will not test
whether the gcc driver also supports it.

> 
> In the other thread, you discussed -c vs -s.  It looks like -c is used
> for as-option, so I expect the assembler to be invoked.
> 
> Maybe we should look at the mismatch between Kbuild and Kconfig
> regarding -c vs -s in scripts/Kbuild.include vs
> scripts/Kconfig.include?  Otherwise it sounds like cc-option cannot be
> used to check for `-Wa,` flags in Kconfig, since if the assembler is
> never invoked, it may appear that GCC has support for
> -Wa,--compress-debug-sections=zlib when it indeed does not.
> 

Yeah, we might want to fix the mismatch there.  In Kconfig, there aren't
any instances of cc-option being used with -Wa, but there certainly are
in Kbuild. It actually originally used to only run the preprocessor and
got fixed to at least run the compiler in commit
  3bed1b7b9d79 ("kbuild: use -S instead of -E for precise cc-option test in Kconfig")

> > ---
> >  Makefile          | 2 +-
> >  lib/Kconfig.debug | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 839f9fee22cb..cb29e56f227a 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -842,7 +842,7 @@ endif
> >
> >  ifdef CONFIG_DEBUG_INFO_COMPRESSED
> >  DEBUG_CFLAGS   += -gz=zlib
> > -KBUILD_AFLAGS  += -Wa,--compress-debug-sections=zlib
> > +KBUILD_AFLAGS  += -gz=zlib
> >  KBUILD_LDFLAGS += --compress-debug-sections=zlib
> >  endif
> >
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index cb98741601bd..94ce36be470c 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
> >         bool "Compressed debugging information"
> >         depends on DEBUG_INFO
> >         depends on $(cc-option,-gz=zlib)
> > -       depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
> > +       depends on $(as-option,-gz=zlib)
> >         depends on $(ld-option,--compress-debug-sections=zlib)
> >         help
> >           Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
> > --
> > 2.26.2
> >
> 
> 
> --
> Thanks,
> ~Nick Desaulniers

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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-10 23:30                       ` Arvind Sankar
@ 2020-06-10 23:39                         ` Arvind Sankar
  2020-06-11 20:44                           ` Nick Desaulniers
  2020-06-11 21:09                         ` Nick Desaulniers
  1 sibling, 1 reply; 21+ messages in thread
From: Arvind Sankar @ 2020-06-10 23:39 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Nick Desaulniers, Masahiro Yamada, Fangrui Song, Rong Chen,
	kernel test robot, kbuild-all, LKML

On Wed, Jun 10, 2020 at 07:30:46PM -0400, Arvind Sankar wrote:
> On Wed, Jun 10, 2020 at 02:27:55PM -0700, Nick Desaulniers wrote:
> 
> No, as-option does invoke the assembler. The problem here is that with
> -Wa, the option is only seen by the assembler, not the gcc driver. So it
> will succeed because the assembler supports it, but it will not test
> whether the gcc driver also supports it.
> 

I think in theory another way to fix it is to just use -Wa even for
CFLAGS, assuming the compiler itself doesn't have to do anything with
the option and it's purely an assembler thing. Then you'd just do the as
and ld tests.

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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-10 23:39                         ` Arvind Sankar
@ 2020-06-11 20:44                           ` Nick Desaulniers
  2020-06-11 21:44                             ` Arvind Sankar
  0 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-06-11 20:44 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Masahiro Yamada, Fangrui Song, Rong Chen, kernel test robot,
	kbuild-all, LKML

On Wed, Jun 10, 2020 at 4:39 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Wed, Jun 10, 2020 at 07:30:46PM -0400, Arvind Sankar wrote:
> > On Wed, Jun 10, 2020 at 02:27:55PM -0700, Nick Desaulniers wrote:
> >
> > No, as-option does invoke the assembler. The problem here is that with
> > -Wa, the option is only seen by the assembler, not the gcc driver. So it
> > will succeed because the assembler supports it, but it will not test
> > whether the gcc driver also supports it.
> >
>
> I think in theory another way to fix it is to just use -Wa even for
> CFLAGS, assuming the compiler itself doesn't have to do anything with
> the option and it's purely an assembler thing. Then you'd just do the as
> and ld tests.

I don't think the CFLAGS are used for .S source files though.  We may
drive assembler via the compiler, but AFLAGS are used in place of
CFLAGS IIRC.  (eh, maybe not for ARCH=arc, ARCH=sh, ARCH=csky,
ARCH=mips)

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-10 23:30                       ` Arvind Sankar
  2020-06-10 23:39                         ` Arvind Sankar
@ 2020-06-11 21:09                         ` Nick Desaulniers
  2020-06-11 21:52                           ` Arvind Sankar
  2020-06-11 22:03                           ` [PATCH v2] " Arvind Sankar
  1 sibling, 2 replies; 21+ messages in thread
From: Nick Desaulniers @ 2020-06-11 21:09 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Masahiro Yamada, Fangrui Song, Rong Chen, kernel test robot,
	kbuild-all, LKML

On Wed, Jun 10, 2020 at 4:30 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Wed, Jun 10, 2020 at 02:27:55PM -0700, Nick Desaulniers wrote:
> > On Wed, Jun 10, 2020 at 12:11 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> > >
> > > Commit
> > >   10e68b02c861 ("Makefile: support compressed debug info")
> > > added support for compressed debug sections.
> > >
> > > Support is detected by checking
> > > - does the compiler support -gz=zlib
> > > - does the assembler support --compressed-debug-sections=zlib
> > > - does the linker support --compressed-debug-sections=zlib
> > >
> > > However, the gcc driver's support for this option is somewhat
> > > convoluted. The driver's builtin specs are set based on the version of
> > > binutils that it was configured with, and it reports an error only if
> > > the assembler (or linker) is actually invoked.
> > >
> > > The cc-option check in scripts/Kconfig.include does not invoke the
> > > assembler, so the gcc driver reports success even if it does not support
> > > the option being passed to the assembler.
> >
> > Thanks for the patch! In that case, should we consider dropping the
> > cc-option check from the Kconfg then, too?
> >
> > It seems it would help for clang-4 and older, since they do error
> > about the unknown option, but I'm not too worried about trying to
> > support that version of Clang with this config.
>
> Also for gcc4 which doesn't support this at all -- that will report
> error on cc-option. We don't need to support it, but we shouldn't let it
> be enabled either.

ah, right, good to fail early in that case then.

>
> >
> > > Combined with an installed
> > > version of binutils that is more recent than the one the compiler was
> > > built with, it is possible for all three tests to succeed, yet an actual
> > > compilation with -gz=zlib to fail.
> >
> > It kind of sounds like the assembler must be invoked to verify this
> > will work for the cflags then?
> >
>
> Yes, the gcc driver reports an error when deciding what to pass to the
> assembler for -gz=zlib, if it was configured with a linker that does not
> support the flag. It's even more weird actually -- if it was configured
> with a linker that supports the flag but an assembler that doesn't, it
> will silently eat the flag when calling the assembler. At least that
> won't break anything, though none of the .o files will be compressed.

Not sure whether we'd like to prevent the option from being selectable
in that case, or just to silently not compress the debug info.  Given
that the compression is an optimization, it doesn't hurt to silently
not do it, but it would be nice to notify the user their toolchain may
have been misconfigured.  Though another part of me feels "garbage in,
garbage out."

>
> > >
> > > Moreover, it is unnecessary to explicitly pass
> > > --compressed-debug-sections=zlib to the assembler via -Wa, since the
> > > driver will do that automatically.
> > >
> > > Convert the as-option to just -gz=zlib, simplifying it as well as
> > > performing a better test of the gcc driver's capabilities.
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> >
> > Does this imply all feature tests of as-option with -W(comma)... are
> > broken?  IIUC, then the assembler is still not invoked, much as in
> > this case?  (as in they all pass when maybe they should not?)  (or
> > based on below, maybe just the Kconfig from 74afda4016a74 in
> > arch/arm64/Kconfig, AS_HAS_PAC)
>
> No, as-option does invoke the assembler. The problem here is that with
> -Wa, the option is only seen by the assembler, not the gcc driver. So it
> will succeed because the assembler supports it, but it will not test
> whether the gcc driver also supports it.

^ Those 2 last sentences should go in the commit message, as the
current form doesn't allude to that.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> >
> > In the other thread, you discussed -c vs -s.  It looks like -c is used
> > for as-option, so I expect the assembler to be invoked.
> >
> > Maybe we should look at the mismatch between Kbuild and Kconfig
> > regarding -c vs -s in scripts/Kbuild.include vs
> > scripts/Kconfig.include?  Otherwise it sounds like cc-option cannot be
> > used to check for `-Wa,` flags in Kconfig, since if the assembler is
> > never invoked, it may appear that GCC has support for
> > -Wa,--compress-debug-sections=zlib when it indeed does not.
> >
>
> Yeah, we might want to fix the mismatch there.  In Kconfig, there aren't
> any instances of cc-option being used with -Wa, but there certainly are
> in Kbuild. It actually originally used to only run the preprocessor and

Yep. Got it.

> got fixed to at least run the compiler in commit
>   3bed1b7b9d79 ("kbuild: use -S instead of -E for precise cc-option test in Kconfig")
>
> > > ---
> > >  Makefile          | 2 +-
> > >  lib/Kconfig.debug | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 839f9fee22cb..cb29e56f227a 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -842,7 +842,7 @@ endif
> > >
> > >  ifdef CONFIG_DEBUG_INFO_COMPRESSED
> > >  DEBUG_CFLAGS   += -gz=zlib
> > > -KBUILD_AFLAGS  += -Wa,--compress-debug-sections=zlib
> > > +KBUILD_AFLAGS  += -gz=zlib

I verified that Clang will still produce compressed debug info
sections for .s/.S input with -gz=zlib.  So this doesn't regress
anything, AFAICT.

Thanks for the patch.

> > >  KBUILD_LDFLAGS += --compress-debug-sections=zlib
> > >  endif
> > >
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index cb98741601bd..94ce36be470c 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
> > >         bool "Compressed debugging information"
> > >         depends on DEBUG_INFO
> > >         depends on $(cc-option,-gz=zlib)
> > > -       depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
> > > +       depends on $(as-option,-gz=zlib)
> > >         depends on $(ld-option,--compress-debug-sections=zlib)
> > >         help
> > >           Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
> > > --
> > > 2.26.2
> > >
> >
> >
> > --
> > Thanks,
> > ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-11 20:44                           ` Nick Desaulniers
@ 2020-06-11 21:44                             ` Arvind Sankar
  0 siblings, 0 replies; 21+ messages in thread
From: Arvind Sankar @ 2020-06-11 21:44 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Arvind Sankar, Masahiro Yamada, Fangrui Song, Rong Chen,
	kernel test robot, kbuild-all, LKML

On Thu, Jun 11, 2020 at 01:44:53PM -0700, Nick Desaulniers wrote:
> On Wed, Jun 10, 2020 at 4:39 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > On Wed, Jun 10, 2020 at 07:30:46PM -0400, Arvind Sankar wrote:
> > > On Wed, Jun 10, 2020 at 02:27:55PM -0700, Nick Desaulniers wrote:
> > >
> > > No, as-option does invoke the assembler. The problem here is that with
> > > -Wa, the option is only seen by the assembler, not the gcc driver. So it
> > > will succeed because the assembler supports it, but it will not test
> > > whether the gcc driver also supports it.
> > >
> >
> > I think in theory another way to fix it is to just use -Wa even for
> > CFLAGS, assuming the compiler itself doesn't have to do anything with
> > the option and it's purely an assembler thing. Then you'd just do the as
> > and ld tests.
> 
> I don't think the CFLAGS are used for .S source files though.  We may
> drive assembler via the compiler, but AFLAGS are used in place of
> CFLAGS IIRC.  (eh, maybe not for ARCH=arc, ARCH=sh, ARCH=csky,
> ARCH=mips)
> 
> -- 
> Thanks,
> ~Nick Desaulniers

I meant just replace
	KBUILD_CFLAGS += -gz=zlib
with
	KBUILD_CFLAGS += -Wa,--compress-debug-sections=zlib
leaving KBUILD_AFLAGS the same as before
	KBUILD_AFLAGS += -Wa,--compress-debug-sections=zlib

This would avoid depending on the subtleties in the gcc driver's support
for this option. But -gz=zlib is passed to cc1 as well as the assembler,
so I'm not sure if there would be some loss from not passing it to the
compiler.

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

* Re: [PATCH] Makefile: Improve compressed debug info support detection
  2020-06-11 21:09                         ` Nick Desaulniers
@ 2020-06-11 21:52                           ` Arvind Sankar
  2020-06-11 22:03                           ` [PATCH v2] " Arvind Sankar
  1 sibling, 0 replies; 21+ messages in thread
From: Arvind Sankar @ 2020-06-11 21:52 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Arvind Sankar, Masahiro Yamada, Fangrui Song, Rong Chen,
	kernel test robot, kbuild-all, LKML

On Thu, Jun 11, 2020 at 02:09:21PM -0700, Nick Desaulniers wrote:
> On Wed, Jun 10, 2020 at 4:30 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > Yes, the gcc driver reports an error when deciding what to pass to the
> > assembler for -gz=zlib, if it was configured with a linker that does not
> > support the flag. It's even more weird actually -- if it was configured
> > with a linker that supports the flag but an assembler that doesn't, it
> > will silently eat the flag when calling the assembler. At least that
> > won't break anything, though none of the .o files will be compressed.
> 
> Not sure whether we'd like to prevent the option from being selectable
> in that case, or just to silently not compress the debug info.  Given
> that the compression is an optimization, it doesn't hurt to silently
> not do it, but it would be nice to notify the user their toolchain may
> have been misconfigured.  Though another part of me feels "garbage in,
> garbage out."
> 

I don't think it's worth trying to detect it -- I can see it in the
source code, but it should be highly unlikely for a gcc to be configured
this way. Btw, it looks like if you configure gcc with LLD, it will
enable this option only because it thinks that "LLD 11.0.0 (compatible
with GNU linkers)" is GNU LD version 11, which is bigger than 2. Is that
intentional :)

> > No, as-option does invoke the assembler. The problem here is that with
> > -Wa, the option is only seen by the assembler, not the gcc driver. So it
> > will succeed because the assembler supports it, but it will not test
> > whether the gcc driver also supports it.
> 
> ^ Those 2 last sentences should go in the commit message, as the
> current form doesn't allude to that.

Ok.

> 
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> 

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

* [PATCH v2] Makefile: Improve compressed debug info support detection
  2020-06-11 21:09                         ` Nick Desaulniers
  2020-06-11 21:52                           ` Arvind Sankar
@ 2020-06-11 22:03                           ` Arvind Sankar
  2020-06-11 23:38                             ` Nick Desaulniers
  1 sibling, 1 reply; 21+ messages in thread
From: Arvind Sankar @ 2020-06-11 22:03 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Nick Desaulniers, Fangrui Song, Rong Chen, kernel test robot,
	kbuild-all, LKML

Commit
  10e68b02c861 ("Makefile: support compressed debug info")
added support for compressed debug sections.

Support is detected by checking
- does the compiler support -gz=zlib
- does the assembler support --compressed-debug-sections=zlib
- does the linker support --compressed-debug-sections=zlib

However, the gcc driver's support for this option is somewhat
convoluted. The driver's builtin specs are set based on the version of
binutils that it was configured with. It reports an error if the
configure-time linker/assembler (i.e., not necessarily the actual
assembler that will be run) do not support the option, but only if the
assembler (or linker) is actually invoked when -gz=zlib is passed.

The cc-option check in scripts/Kconfig.include does not invoke the
assembler, so the gcc driver reports success even if it does not support
the option being passed to the assembler.

Because the as-option check passes the option directly to the assembler
via -Wa,--compressed-debug-sections=zlib, the gcc driver does not see
this option and will never report an error.

Combined with an installed version of binutils that is more recent than
the one the compiler was built with, it is possible for all three tests
to succeed, yet an actual compilation with -gz=zlib to fail.

Moreover, it is unnecessary to explicitly pass
--compressed-debug-sections=zlib to the assembler via -Wa, since the
driver will do that automatically when it supports -gz=zlib.

Convert the as-option to just -gz=zlib, simplifying it as well as
performing a better test of the gcc driver's capabilities.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
 Makefile          | 2 +-
 lib/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 839f9fee22cb..cb29e56f227a 100644
--- a/Makefile
+++ b/Makefile
@@ -842,7 +842,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO_COMPRESSED
 DEBUG_CFLAGS	+= -gz=zlib
-KBUILD_AFLAGS	+= -Wa,--compress-debug-sections=zlib
+KBUILD_AFLAGS	+= -gz=zlib
 KBUILD_LDFLAGS	+= --compress-debug-sections=zlib
 endif
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index cb98741601bd..94ce36be470c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
 	bool "Compressed debugging information"
 	depends on DEBUG_INFO
 	depends on $(cc-option,-gz=zlib)
-	depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
+	depends on $(as-option,-gz=zlib)
 	depends on $(ld-option,--compress-debug-sections=zlib)
 	help
 	  Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
-- 
2.26.2


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

* Re: [PATCH v2] Makefile: Improve compressed debug info support detection
  2020-06-11 22:03                           ` [PATCH v2] " Arvind Sankar
@ 2020-06-11 23:38                             ` Nick Desaulniers
  2020-06-14  2:21                               ` Masahiro Yamada
  0 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-06-11 23:38 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Masahiro Yamada, Fangrui Song, Rong Chen, kernel test robot,
	kbuild-all, LKML

On Thu, Jun 11, 2020 at 3:03 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> Commit
>   10e68b02c861 ("Makefile: support compressed debug info")
> added support for compressed debug sections.
>
> Support is detected by checking
> - does the compiler support -gz=zlib
> - does the assembler support --compressed-debug-sections=zlib
> - does the linker support --compressed-debug-sections=zlib
>
> However, the gcc driver's support for this option is somewhat
> convoluted. The driver's builtin specs are set based on the version of
> binutils that it was configured with. It reports an error if the
> configure-time linker/assembler (i.e., not necessarily the actual
> assembler that will be run) do not support the option, but only if the
> assembler (or linker) is actually invoked when -gz=zlib is passed.
>
> The cc-option check in scripts/Kconfig.include does not invoke the
> assembler, so the gcc driver reports success even if it does not support
> the option being passed to the assembler.
>
> Because the as-option check passes the option directly to the assembler
> via -Wa,--compressed-debug-sections=zlib, the gcc driver does not see
> this option and will never report an error.

Thanks for expanding on the failure.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Combined with an installed version of binutils that is more recent than
> the one the compiler was built with, it is possible for all three tests
> to succeed, yet an actual compilation with -gz=zlib to fail.
>
> Moreover, it is unnecessary to explicitly pass
> --compressed-debug-sections=zlib to the assembler via -Wa, since the
> driver will do that automatically when it supports -gz=zlib.
>
> Convert the as-option to just -gz=zlib, simplifying it as well as
> performing a better test of the gcc driver's capabilities.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> ---
>  Makefile          | 2 +-
>  lib/Kconfig.debug | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 839f9fee22cb..cb29e56f227a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -842,7 +842,7 @@ endif
>
>  ifdef CONFIG_DEBUG_INFO_COMPRESSED
>  DEBUG_CFLAGS   += -gz=zlib
> -KBUILD_AFLAGS  += -Wa,--compress-debug-sections=zlib
> +KBUILD_AFLAGS  += -gz=zlib
>  KBUILD_LDFLAGS += --compress-debug-sections=zlib
>  endif
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index cb98741601bd..94ce36be470c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
>         bool "Compressed debugging information"
>         depends on DEBUG_INFO
>         depends on $(cc-option,-gz=zlib)
> -       depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
> +       depends on $(as-option,-gz=zlib)
>         depends on $(ld-option,--compress-debug-sections=zlib)
>         help
>           Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
> --
> 2.26.2
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v2] Makefile: Improve compressed debug info support detection
  2020-06-11 23:38                             ` Nick Desaulniers
@ 2020-06-14  2:21                               ` Masahiro Yamada
  0 siblings, 0 replies; 21+ messages in thread
From: Masahiro Yamada @ 2020-06-14  2:21 UTC (permalink / raw)
  To: Nick Desaulniers, Arvind Sankar
  Cc: Fangrui Song, Rong Chen, kernel test robot, kbuild-all, LKML

On Fri, Jun 12, 2020 at 8:39 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Thu, Jun 11, 2020 at 3:03 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > Commit
> >   10e68b02c861 ("Makefile: support compressed debug info")
> > added support for compressed debug sections.
> >
> > Support is detected by checking
> > - does the compiler support -gz=zlib
> > - does the assembler support --compressed-debug-sections=zlib
> > - does the linker support --compressed-debug-sections=zlib
> >
> > However, the gcc driver's support for this option is somewhat
> > convoluted. The driver's builtin specs are set based on the version of
> > binutils that it was configured with. It reports an error if the
> > configure-time linker/assembler (i.e., not necessarily the actual
> > assembler that will be run) do not support the option, but only if the
> > assembler (or linker) is actually invoked when -gz=zlib is passed.
> >
> > The cc-option check in scripts/Kconfig.include does not invoke the
> > assembler, so the gcc driver reports success even if it does not support
> > the option being passed to the assembler.
> >
> > Because the as-option check passes the option directly to the assembler
> > via -Wa,--compressed-debug-sections=zlib, the gcc driver does not see
> > this option and will never report an error.
>
> Thanks for expanding on the failure.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>


Applied to linux-kbuild/fixes.
Thanks.





-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2020-06-14  2:22 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 13:11 gcc-5: error: -gz is not supported in this configuration kernel test robot
2020-06-09 17:28 ` Nick Desaulniers
2020-06-09 17:49   ` Fangrui Song
2020-06-10  0:30     ` [kbuild-all] " Rong Chen
2020-06-10  0:58       ` Fangrui Song
2020-06-10  1:49         ` Rong Chen
2020-06-10  3:12           ` Arvind Sankar
2020-06-10  3:23             ` Arvind Sankar
2020-06-10  4:26               ` Arvind Sankar
2020-06-10  6:37                 ` Fangrui Song
2020-06-10 19:11                   ` [PATCH] Makefile: Improve compressed debug info support detection Arvind Sankar
2020-06-10 21:27                     ` Nick Desaulniers
2020-06-10 23:30                       ` Arvind Sankar
2020-06-10 23:39                         ` Arvind Sankar
2020-06-11 20:44                           ` Nick Desaulniers
2020-06-11 21:44                             ` Arvind Sankar
2020-06-11 21:09                         ` Nick Desaulniers
2020-06-11 21:52                           ` Arvind Sankar
2020-06-11 22:03                           ` [PATCH v2] " Arvind Sankar
2020-06-11 23:38                             ` Nick Desaulniers
2020-06-14  2:21                               ` Masahiro Yamada

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).