Bug 34162 - check that things have been compiled with %optflags
: check that things have been compiled with %optflags
Status: NEW
: Sisyphus
(All bugs in Sisyphus/rpm-build)
: unstable
: all Linux
: P3 enhancement
Assigned To:
:
:
:
:
: 34161
  Show dependency tree
 
Reported: 2017-11-09 14:08 by
Modified: 2018-05-28 18:47 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2017-11-09 14:08:06
4.0.4-alt105

A BRP check that would check that the resulting files have been compiled with
flags which include all %optflags would help to see which packages have
problems with honoring %optflags.

This would warn the maintainers that their attention is needed to fix this
before someone changes %optflags to rebuild packages differently en masse (on
another platform or with a different mechanism for passing %optflags to the
compiler as in https://bugzilla.altlinux.org/show_bug.cgi?id=34161 ).

bircoph@ had this idea and suggested to use a special GCC flag to record the
actually used flags in the resulting files.
------- Comment #1 From 2017-12-12 00:07:03 -------
(In reply to comment #0)
> bircoph@ had this idea and suggested to use a special GCC flag to record the
> actually used flags in the resulting files.

The option is called -frecord-gcc-switches; it adds .GCC.command.line section
in each generated ELF file.  These sections have the same type (PROGBITS) and
flags (MERGE, STRINGS) as .comment sections. Like .comment sections,
.GCC.command.line sections are moved to .debug files by debugedit.
------- Comment #2 From 2018-01-07 20:11:19 -------
rpm-build:

Sun Jan 07 2018 Dmitry V. Levin <ldv@altlinux> 4.0.4-alt107
- compare_deps: fixed a bug in handling epochs.
- platform.in:
  + %optflags_core: added -frecord-gcc-switches (see: #34162);
  + %make_build: implemented as a simple command (closes: #34237).
- genCpioListAndHeader: implemented remapping of device and inode numbers
  (by Vladimir D. Seleznev and me; closes: #34398).
------- Comment #3 From 2018-05-28 18:17:43 -------
А как теперь поступать с такой ошибкой при сборке:

 "/usr/bin/clang"

 is not able to compile a simple test program.

 It fails with the following output:

  clang-6.0: error: unknown argument: '-frecord-gcc-switches'
------- Comment #4 From 2018-05-28 18:26:14 -------
(In reply to comment #3)
> А как теперь поступать с такой ошибкой при сборке:
> 
>  "/usr/bin/clang"
> 
>  is not able to compile a simple test program.
> 
>  It fails with the following output:
> 
>   clang-6.0: error: unknown argument: '-frecord-gcc-switches'

не передавать -frecord-gcc-switches в clang?
не использовать clang?
------- Comment #5 From 2018-05-28 18:33:00 -------
(В ответ на комментарий №4)
...
> не передавать -frecord-gcc-switches в clang?
> не использовать clang?
Хороший совет, но по строке changelog
  + %optflags_core: added -frecord-gcc-switches (see: #34162);
я ожидал хоть где-то найти его, чтобы не передавать, но
$ rpm --showrc | grep optflags_core
-14: optflags_core    -pipe

А... Ах вот оно что...
$ rpmbuild --showrc | grep optflags_core
-14: optflags_core    -pipe -frecord-gcc-switches

А точно нельзя, чтобы команда rpm --showrc выдавала те же макросы, или не
работала бы вообще. А то я теперь даже не знаю, откуда она берёт свой вывод.
------- Comment #6 From 2018-05-28 18:47:16 -------
(В ответ на комментарий №4)
...
> не передавать -frecord-gcc-switches в clang?
так и сделаю, спасибо:
%remove_optflags -frecord-gcc-switches