Some packages using MakeMaker (some perl modules, irssi) to generate makefiles. The generated makefiles contains CFLAGS that were used to build perl. This is wrong for two reasons:
1) When building in another root for another machine, this will incorrectly use the build machine's CFLAGS. I'll attach to this bug an example of this, in which I build irssi on a machine with CFLAGS="-march=skylake" for a target machine with CFLAGS="-march=ivybridge".
2) When changing CFLAGS, one has to rebuild perl for the change to be taken into account for MakeMaker packages. Initially I had "-march=native" on my build machine. When I decided to build packages for other machines, I changed every make.conf so that the -march flag is the actual architecture, to make things easier. Thus, I had no -march=native anywhere anymore, yet irssi and perl modules where still using that, which was confusing. It turned out that I didn't rebuild perl, so it was still using my old CFLAGS.
Created attachment 674731 [details]
Note that in the src/perl/common subdirectory, the compiler commands contain both -march=ivybridge and -march=skylake.
Created attachment 674734 [details]
Makefile generated by MakeMaker
Lines containing hardcoded perl build flags are:
- line 40, in LDDLFLAGS
- line 311, in OPTIMIZE