Re: .S_shipped unnecessary?
On Fri, Nov 9, 2018 at 8:42 AM Ard Biesheuvel wrote: > > (+ Masahiro, kbuild ml) > > On 8 November 2018 at 21:37, Jason A. Donenfeld wrote: > > Hi Ard, Eric, and others, > > > > As promised, the next Zinc patchset will have less generated code! After a > > bit of work with Andy and Samuel, I'll be bundling the perlasm. > > > > Wonderful! Any problems doing that for x86_64 ? > > > One thing I'm wondering about, though, is the wisdom behind the current > > .S_shipped pattern. Usually the _shipped is for big firmware blobs that are > > hard (or impossible) to build independently. But in this case, the .S is > > generated from the .pl significantly faster than gcc even compiles a basic > > C file. And, since perl is needed to build the kernel anyway, it's not like > > it will be impossible to find the right tools. Rather than clutter up > > commits > > with the .pl _and_ the .S_shipped, what would you think if I just generated > > the .S each time as an ordinary build artifact. AFAICT, this is fairly > > usual, > > and it's hard to see downsides. Hence, why I'm writing this email: are there > > any downsides to that? > > > > I agree 100%. When I added this the first time, it was at the request > of the ARM maintainer, who was reluctant to rely on Perl for some > reason. > > Recently, we have had to add a kludge to prevent spurious rebuilds of > the .S_shipped files as well. > > I'd be perfectly happy to get rid of this entirely, and always > generate the .S from the .pl, which to me is kind of the point of > carrying these files in the first place. > > Masahiro: do you see any problems with this? No problem. Documentation/process/changes.rst says the following: You will need perl 5 and the following modules: ``Getopt::Long``, ``Getopt::Std``, ``File::Basename``, and ``File::Find`` to build the kernel. We can assume perl is installed on the user's build machine. -- Best Regards Masahiro Yamada
Re: [PATCH 07/10] kbuild: clean up *-asn1.[ch] patterns from top-level Makefile
+CC linux-crypto@vger.kernel.org No functional change, though. 2018-03-23 22:04 GMT+09:00 Masahiro Yamada <yamada.masah...@socionext.com>: > Clean up these patterns from the top Makefile to omit 'clean-files' > in each Makefile. > > Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> > --- > > Makefile| 1 + > crypto/Makefile | 2 -- > crypto/asymmetric_keys/Makefile | 7 --- > net/ipv4/netfilter/Makefile | 1 - > 4 files changed, 1 insertion(+), 10 deletions(-) > > diff --git a/Makefile b/Makefile > index 168432e..054f43a 100644 > --- a/Makefile > +++ b/Makefile > @@ -1614,6 +1614,7 @@ clean: $(clean-dirs) > -o -name '*.su' \ > -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ > -o -name '*.lex.c' -o -name '*.tab.[ch]' \ > + -o -name '*-asn1.[ch]' \ > -o -name '*.symtypes' -o -name 'modules.order' \ > -o -name modules.builtin -o -name '.tmp_*.o.*' \ > -o -name .cache.mk \ > diff --git a/crypto/Makefile b/crypto/Makefile > index cdbc03b..4eae4da 100644 > --- a/crypto/Makefile > +++ b/crypto/Makefile > @@ -38,8 +38,6 @@ obj-$(CONFIG_CRYPTO_DH) += dh_generic.o > $(obj)/rsapubkey-asn1.o: $(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h > $(obj)/rsaprivkey-asn1.o: $(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h > $(obj)/rsa_helper.o: $(obj)/rsapubkey-asn1.h $(obj)/rsaprivkey-asn1.h > -clean-files += rsapubkey-asn1.c rsapubkey-asn1.h > -clean-files += rsaprivkey-asn1.c rsaprivkey-asn1.h > > rsa_generic-y := rsapubkey-asn1.o > rsa_generic-y += rsaprivkey-asn1.o > diff --git a/crypto/asymmetric_keys/Makefile b/crypto/asymmetric_keys/Makefile > index 4719aad..bd8ed09 100644 > --- a/crypto/asymmetric_keys/Makefile > +++ b/crypto/asymmetric_keys/Makefile > @@ -29,9 +29,6 @@ $(obj)/x509_cert_parser.o: \ > $(obj)/x509-asn1.o: $(obj)/x509-asn1.c $(obj)/x509-asn1.h > $(obj)/x509_akid-asn1.o: $(obj)/x509_akid-asn1.c $(obj)/x509_akid-asn1.h > > -clean-files+= x509-asn1.c x509-asn1.h > -clean-files+= x509_akid-asn1.c x509_akid-asn1.h > - > # > # PKCS#7 message handling > # > @@ -45,8 +42,6 @@ pkcs7_message-y := \ > $(obj)/pkcs7_parser.o: $(obj)/pkcs7-asn1.h > $(obj)/pkcs7-asn1.o: $(obj)/pkcs7-asn1.c $(obj)/pkcs7-asn1.h > > -clean-files+= pkcs7-asn1.c pkcs7-asn1.h > - > # > # PKCS#7 parser testing key > # > @@ -66,5 +61,3 @@ verify_signed_pefile-y := \ > > $(obj)/mscode_parser.o: $(obj)/mscode-asn1.h $(obj)/mscode-asn1.h > $(obj)/mscode-asn1.o: $(obj)/mscode-asn1.c $(obj)/mscode-asn1.h > - > -clean-files+= mscode-asn1.c mscode-asn1.h > diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile > index 2dad20e..e5f5638 100644 > --- a/net/ipv4/netfilter/Makefile > +++ b/net/ipv4/netfilter/Makefile > @@ -31,7 +31,6 @@ obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o > nf_nat_snmp_basic-y := nf_nat_snmp_basic-asn1.o nf_nat_snmp_basic_main.o > nf_nat_snmp_basic-y : nf_nat_snmp_basic-asn1.h nf_nat_snmp_basic-asn1.c > obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o > -clean-files := nf_nat_snmp_basic-asn1.c nf_nat_snmp_basic-asn1.h > > obj-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o > > -- > 2.7.4 > -- Best Regards Masahiro Yamada
Re: [PATCH 08/10] kbuild: rename *-asn1.[ch] to *.asn.[ch]
+CC linux-crypto@vger.kernel.org No functional change, though. (I fixed up the subject.) 2018-03-23 22:04 GMT+09:00 Masahiro Yamada <yamada.masah...@socionext.com>: > Our convention is to distinguish file types by suffixes with a period > as a separator. > > *-asn1.[ch] is a different pattern from other generated sources such > as *.lex.c, *.tab.[ch], *.dtb.S, etc. More confusing, files with > '-asn1.[ch]' are generated files, but '_asn1.[ch]' are checked-in > files: > net/netfilter/nf_conntrack_h323_asn1.c > include/linux/netfilter/nf_conntrack_h323_asn1.h > include/linux/sunrpc/gss_asn1.h > > Rename generated files to *.asn1.[ch] for consistency. > > Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> > --- > > .gitignore | 2 +- > Makefile| 2 +- > crypto/Makefile | 10 +- > crypto/asymmetric_keys/Makefile | 24 > crypto/asymmetric_keys/mscode_parser.c | 2 +- > crypto/asymmetric_keys/pkcs7_parser.c | 2 +- > crypto/asymmetric_keys/x509_cert_parser.c | 4 ++-- > crypto/rsa_helper.c | 4 ++-- > net/ipv4/netfilter/Makefile | 4 ++-- > net/ipv4/netfilter/nf_nat_snmp_basic_main.c | 2 +- > scripts/Makefile.build | 4 ++-- > scripts/asn1_compiler.c | 2 +- > 12 files changed, 31 insertions(+), 31 deletions(-) > > diff --git a/.gitignore b/.gitignore > index a7fef34..1c8189e 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -11,7 +11,7 @@ > # > .* > *.a > -*-asn1.[ch] > +*.asn1.[ch] > *.bin > *.bz2 > *.c.[012]*.* > diff --git a/Makefile b/Makefile > index 054f43a..702f154 100644 > --- a/Makefile > +++ b/Makefile > @@ -1614,7 +1614,7 @@ clean: $(clean-dirs) > -o -name '*.su' \ > -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ > -o -name '*.lex.c' -o -name '*.tab.[ch]' \ > - -o -name '*-asn1.[ch]' \ > + -o -name '*.asn1.[ch]' \ > -o -name '*.symtypes' -o -name 'modules.order' \ > -o -name modules.builtin -o -name '.tmp_*.o.*' \ > -o -name .cache.mk \ > diff --git a/crypto/Makefile b/crypto/Makefile > index 4eae4da..9be77d0 100644 > --- a/crypto/Makefile > +++ b/crypto/Makefile > @@ -35,12 +35,12 @@ dh_generic-y := dh.o > dh_generic-y += dh_helper.o > obj-$(CONFIG_CRYPTO_DH) += dh_generic.o > > -$(obj)/rsapubkey-asn1.o: $(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h > -$(obj)/rsaprivkey-asn1.o: $(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h > -$(obj)/rsa_helper.o: $(obj)/rsapubkey-asn1.h $(obj)/rsaprivkey-asn1.h > +$(obj)/rsapubkey.asn1.o: $(obj)/rsapubkey.asn1.c $(obj)/rsapubkey.asn1.h > +$(obj)/rsaprivkey.asn1.o: $(obj)/rsaprivkey.asn1.c $(obj)/rsaprivkey.asn1.h > +$(obj)/rsa_helper.o: $(obj)/rsapubkey.asn1.h $(obj)/rsaprivkey.asn1.h > > -rsa_generic-y := rsapubkey-asn1.o > -rsa_generic-y += rsaprivkey-asn1.o > +rsa_generic-y := rsapubkey.asn1.o > +rsa_generic-y += rsaprivkey.asn1.o > rsa_generic-y += rsa.o > rsa_generic-y += rsa_helper.o > rsa_generic-y += rsa-pkcs1pad.o > diff --git a/crypto/asymmetric_keys/Makefile b/crypto/asymmetric_keys/Makefile > index bd8ed09..d4b2e1b 100644 > --- a/crypto/asymmetric_keys/Makefile > +++ b/crypto/asymmetric_keys/Makefile > @@ -17,30 +17,30 @@ obj-$(CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE) += > public_key.o > # > obj-$(CONFIG_X509_CERTIFICATE_PARSER) += x509_key_parser.o > x509_key_parser-y := \ > - x509-asn1.o \ > - x509_akid-asn1.o \ > + x509.asn1.o \ > + x509_akid.asn1.o \ > x509_cert_parser.o \ > x509_public_key.o > > $(obj)/x509_cert_parser.o: \ > - $(obj)/x509-asn1.h \ > - $(obj)/x509_akid-asn1.h > + $(obj)/x509.asn1.h \ > + $(obj)/x509_akid.asn1.h > > -$(obj)/x509-asn1.o: $(obj)/x509-asn1.c $(obj)/x509-asn1.h > -$(obj)/x509_akid-asn1.o: $(obj)/x509_akid-asn1.c $(obj)/x509_akid-asn1.h > +$(obj)/x509.asn1.o: $(obj)/x509.asn1.c $(obj)/x509.asn1.h > +$(obj)/x509_akid.asn1.o: $(obj)/x509_akid.asn1.c $(obj)/x509_akid.asn1.h > > # > # PKCS#7 message handling > # > obj-$(CONFIG_PKCS7_MESSAGE_PARSER) += pkcs7_message.o > pkcs7_message-y := \ > - pkcs7-asn1.o \ > + pkcs7.asn1.o \ > pkcs7_parser.o \ > pkcs7_trust.o \ > pkcs7_verify.o > > -$(obj)/pkcs7_parser.o: $(obj)/pkcs7-asn1.h > -$(obj)/pkcs7-asn1.o: $(obj)/pkcs7-asn1.c $(obj)/pkcs7-asn1.h > +$(obj)/pkcs7_parser.o: $(obj)/pkcs7.asn1.h > +$(
Re: [PATCH 06/10] .gitignore: move *-asn1.[ch] patterns to the top-level .gitignore
+CC linux-crypto@vger.kernel.org No functional change, though. 2018-03-23 22:04 GMT+09:00 Masahiro Yamada <yamada.masah...@socionext.com>: > These are common patterns where source files are parsed by the > asn1_compiler. > > Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> > --- > > .gitignore | 5 + > crypto/.gitignore| 1 - > crypto/asymmetric_keys/.gitignore| 1 - > drivers/crypto/qat/qat_common/.gitignore | 1 - > 4 files changed, 1 insertion(+), 7 deletions(-) > delete mode 100644 crypto/.gitignore > delete mode 100644 crypto/asymmetric_keys/.gitignore > delete mode 100644 drivers/crypto/qat/qat_common/.gitignore > > diff --git a/.gitignore b/.gitignore > index 1e82be1..a7fef34 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -11,6 +11,7 @@ > # > .* > *.a > +*-asn1.[ch] > *.bin > *.bz2 > *.c.[012]*.* > @@ -130,7 +131,3 @@ all.config > > # Kdevelop4 > *.kdev4 > - > -#Automatically generated by ASN.1 compiler > -net/ipv4/netfilter/nf_nat_snmp_basic-asn1.c > -net/ipv4/netfilter/nf_nat_snmp_basic-asn1.h > diff --git a/crypto/.gitignore b/crypto/.gitignore > deleted file mode 100644 > index ee328374..000 > --- a/crypto/.gitignore > +++ /dev/null > @@ -1 +0,0 @@ > -*-asn1.[ch] > diff --git a/crypto/asymmetric_keys/.gitignore > b/crypto/asymmetric_keys/.gitignore > deleted file mode 100644 > index ee328374..000 > --- a/crypto/asymmetric_keys/.gitignore > +++ /dev/null > @@ -1 +0,0 @@ > -*-asn1.[ch] > diff --git a/drivers/crypto/qat/qat_common/.gitignore > b/drivers/crypto/qat/qat_common/.gitignore > deleted file mode 100644 > index ee328374..000 > --- a/drivers/crypto/qat/qat_common/.gitignore > +++ /dev/null > @@ -1 +0,0 @@ > -*-asn1.[ch] > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada
Re: [PATCH] crypto: arm,arm64 - Fix random regeneration of S_shipped
2018-03-14 5:17 GMT+09:00 Leonard Crestez <leonard.cres...@nxp.com>: > The decision to rebuild .S_shipped is made based on the relative > timestamps of .S_shipped and .pl files but git makes this essentially > random. This means that the perl script might run anyway (usually at > most once per checkout), defeating the whole purpose of _shipped. > > Fix by skipping the rule unless explicit make variables are provided: > REGENERATE_ARM_CRYPTO or REGENERATE_ARM64_CRYPTO. > > This can produce nasty occasional build failures downstream, for example > for toolchains with broken perl. The solution is minimally intrusive to > make it easier to push into stable. > > Another report on a similar issue here: https://lkml.org/lkml/2018/3/8/1379 > > Signed-off-by: Leonard Crestez <leonard.cres...@nxp.com> > Cc: <sta...@vger.kernel.org> > --- Reviewed-by: Masahiro Yamada <yamada.masah...@socionext.com> > arch/arm/crypto/Makefile | 2 ++ > arch/arm64/crypto/Makefile | 2 ++ > 2 files changed, 4 insertions(+) > > Not clear if this needs to go through crypto or arm but all commits in these > directories start with "crypto:". > > My problems were only on arm64 because of a yocto toolchain which ships a > version > of perl which fails on "use integer;". > > CC stable because this can cause trouble for downstream packagers. > > diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile > index 30ef8e2..c9919c2 100644 > --- a/arch/arm/crypto/Makefile > +++ b/arch/arm/crypto/Makefile > @@ -47,20 +47,22 @@ sha256-arm-y:= sha256-core.o sha256_glue.o > $(sha256-arm-neon-y) > sha512-arm-neon-$(CONFIG_KERNEL_MODE_NEON) := sha512-neon-glue.o > sha512-arm-y := sha512-core.o sha512-glue.o $(sha512-arm-neon-y) > sha1-arm-ce-y := sha1-ce-core.o sha1-ce-glue.o > sha2-arm-ce-y := sha2-ce-core.o sha2-ce-glue.o > aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o > ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o > crct10dif-arm-ce-y := crct10dif-ce-core.o crct10dif-ce-glue.o > crc32-arm-ce-y:= crc32-ce-core.o crc32-ce-glue.o > chacha20-neon-y := chacha20-neon-core.o chacha20-neon-glue.o > > +ifdef REGENERATE_ARM_CRYPTO > quiet_cmd_perl = PERL$@ >cmd_perl = $(PERL) $(<) > $(@) > > $(src)/sha256-core.S_shipped: $(src)/sha256-armv4.pl > $(call cmd,perl) > > $(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl > $(call cmd,perl) > +endif > > .PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S > diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile > index cee9b8d9..dfe651b 100644 > --- a/arch/arm64/crypto/Makefile > +++ b/arch/arm64/crypto/Makefile > @@ -60,20 +60,22 @@ obj-$(CONFIG_CRYPTO_AES_ARM64_BS) += aes-neon-bs.o > aes-neon-bs-y := aes-neonbs-core.o aes-neonbs-glue.o > > AFLAGS_aes-ce.o:= -DINTERLEAVE=4 > AFLAGS_aes-neon.o := -DINTERLEAVE=4 > > CFLAGS_aes-glue-ce.o := -DUSE_V8_CRYPTO_EXTENSIONS > > $(obj)/aes-glue-%.o: $(src)/aes-glue.c FORCE > $(call if_changed_rule,cc_o_c) > > +ifdef REGENERATE_ARM64_CRYPTO > quiet_cmd_perlasm = PERLASM $@ >cmd_perlasm = $(PERL) $(<) void $(@) > > $(src)/sha256-core.S_shipped: $(src)/sha512-armv8.pl > $(call cmd,perlasm) > > $(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl > $(call cmd,perlasm) > +endif > > .PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S > -- > 2.7.4 > -- Best Regards Masahiro Yamada
Re: [PATCH 1/7] Makefile, LLVM: add -no-integrated-as to KBUILD_[AC]FLAGS
Hi Michael, 2017-03-17 9:15 GMT+09:00 Michael Davidson <m...@google.com>: > Add -no-integrated-as to KBUILD_AFLAGS and KBUILD_CFLAGS > for clang. >From the code-diff, it is apparent that you added -no-integrated-as. Rather, I'd like to see "why" in the git-log. Obviously, clang needs this patch to build the kernel, but can you describe the reason why the integrated assembler is bad? With git-log reworded, I will pick up this shortly. Thanks! > Signed-off-by: Michael Davidson <m...@google.com> > --- > Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Makefile b/Makefile > index b841fb36beb2..b21fd0ca2946 100644 > --- a/Makefile > +++ b/Makefile > @@ -704,6 +704,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, > tautological-compare) > # See modpost pattern 2 > KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) > KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) > +KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) > +KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) > else > > # These warnings generated too much noise in a regular build. -- Best Regards Masahiro Yamada
Re: [PATCH 2/7] Makefile, x86, LLVM: disable unsupported optimization flags
Hi. 2017-04-06 4:11 GMT+09:00 Michael Davidson <m...@google.com>: > It "works" for the cases that I currently care about but I have to say > that I am uneasy about adding -Werror to the cc-option test in this > way. > > Suppose that one of the *other* flags that is implicitly passed to the > compiler by cc-option - eg something that was explicitly specified in > $(KBUILD_CFLAGS) - triggers a warning. In that case all calls to > cc-option will silently fail because of the -Werror and valid options > will not be detected correctly. Theoretically, options explicitly specified in KBUILD_CFLAGS should be always valid. Options that may not be supported in some cases should be wrapped with $(call cc-option ). > If everyone is OK with that because "it shouldn't normally ever > happen" then that is fine, but if does result in a subtle change from > existing behavior (and a trap that I almost immediately fell into > after applying a similar patch). There is a rare case where a particular combination fails (such as the conflict between -pg and -ffunction-sections as reported in https://patchwork.kernel.org/patch/9624573/). In a such case, we may end up with swapping the order, but this should not happen quite often. > On Wed, Apr 5, 2017 at 12:01 PM, Matthias Kaehlcke <m...@chromium.org> wrote: >> Hi Masahiro, >> >> El Thu, Apr 06, 2017 at 03:08:26AM +0900 Masahiro Yamada ha dit: >> >>> 2017-03-17 9:15 GMT+09:00 Michael Davidson <m...@google.com>: >>> > Unfortunately, while clang generates a warning about these flags >>> > being unsupported it still exits with a status of 0 so we have >>> > to explicitly disable them instead of just using a cc-option check. >>> > >>> > Signed-off-by: Michael Davidson <m...@google.com> >>> >>> >>> Instead, does the following work for you? >>> https://patchwork.kernel.org/patch/9657285/ >> >> Thanks for the pointer, I was about to give this change (or rather its >> ancestor) a rework myself :) >> >>> You need to use >>> $(call cc-option, ...) >>> for -falign-jumps=1 and -falign-loops=1 >> >> I can confirm that this works. >> >> Thanks >> >> Matthias > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada