Skip to content
  1. Mar 02, 2023
    • Arnaldo Carvalho de Melo's avatar
      rust: bindgen: Add `alt_instr` as opaque type · 3098cb65
      Arnaldo Carvalho de Melo authored
      
      
      To address this build error:
      
          BINDGEN rust/bindings/bindings_generated.rs
          BINDGEN rust/bindings/bindings_helpers_generated.rs
          EXPORTS rust/exports_core_generated.h
          RUSTC P rust/libmacros.so
          RUSTC L rust/compiler_builtins.o
          RUSTC L rust/alloc.o
          RUSTC L rust/bindings.o
          RUSTC L rust/build_error.o
          EXPORTS rust/exports_alloc_generated.h
        error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
             --> /var/home/acme/git/linux/rust/bindings/bindings_generated.rs:10094:1
              |
        10094 | / pub struct alt_instr {
        10095 | |     pub instr_offset: s32,
        10096 | |     pub repl_offset: s32,
        10097 | |     pub __bindgen_anon_1: alt_instr__bindgen_ty_1,
        10098 | |     pub instrlen: u8_,
        10099 | |     pub replacementlen: u8_,
        10100 | | }
              | |_^
              |
        note: `alt_instr__bindgen_ty_1__bindgen_ty_1` has a `#[repr(align)]` attribute
             --> /var/home/acme/git/linux/rust/bindings/bindings_generated.rs:10111:1
              |
        10111 | / pub struct alt_instr__bindgen_ty_1__bindgen_ty_1 {
        10112 | |     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u16>,
        10113 | | }
              | |_^
        note: `alt_instr` contains a field of type `alt_instr__bindgen_ty_1`
             --> /var/home/acme/git/linux/rust/bindings/bindings_generated.rs:10097:9
              |
        10097 |     pub __bindgen_anon_1: alt_instr__bindgen_ty_1,
              |         ^^^^^^^^^^^^^^^^
        note: ...which contains a field of type `alt_instr__bindgen_ty_1__bindgen_ty_1`
             --> /var/home/acme/git/linux/rust/bindings/bindings_generated.rs:10104:9
              |
        10104 |     pub __bindgen_anon_1: alt_instr__bindgen_ty_1__bindgen_ty_1,
              |         ^^^^^^^^^^^^^^^^
      
        error: aborting due to previous error
      
        For more information about this error, try `rustc --explain E0588`.
        make[1]: *** [rust/Makefile:389: rust/bindings.o] Error 1
        make: *** [Makefile:1293: prepare] Error 2
      
      Cc: Derek Barbosa <debarbos@redhat.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Fixes: 5d1dd961 ("x86/alternatives: Add alt_instr.flags")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reported-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
      Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
      Reviewed-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      3098cb65
  2. Feb 07, 2023
  3. Feb 01, 2023
  4. Jan 31, 2023
  5. Jan 22, 2023
    • Masahiro Yamada's avatar
      kbuild: rust: move rust/target.json to scripts/ · c83b16ce
      Masahiro Yamada authored
      
      
      scripts/ is a better place to generate files used treewide.
      
      With target.json moved to scripts/, you do not need to add target.json
      to no-clean-files or MRPROPER_FILES.
      
      'make clean' does not visit scripts/, but 'make mrproper' does.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Tested-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      c83b16ce
    • Masahiro Yamada's avatar
      kbuild: remove sed commands after rustc rules · 2185242f
      Masahiro Yamada authored
      
      
      rustc may put comments in dep-info, so sed is used to drop them before
      passing it to fixdep.
      
      Now that fixdep can remove comments, Makefiles do not need to run sed.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Tested-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Reviewed-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
      2185242f
    • Masahiro Yamada's avatar
      kbuild: specify output names separately for each emission type from rustc · 295d8398
      Masahiro Yamada authored
      
      
      In Kbuild, two different rules must not write to the same file, but
      it happens when compiling rust source files.
      
      For example, set CONFIG_SAMPLE_RUST_MINIMAL=m and run the following:
      
        $ make -j$(nproc) samples/rust/rust_minimal.o samples/rust/rust_minimal.rsi \
                          samples/rust/rust_minimal.s samples/rust/rust_minimal.ll
          [snip]
          RUSTC [M] samples/rust/rust_minimal.o
          RUSTC [M] samples/rust/rust_minimal.rsi
          RUSTC [M] samples/rust/rust_minimal.s
          RUSTC [M] samples/rust/rust_minimal.ll
        mv: cannot stat 'samples/rust/rust_minimal.d': No such file or directory
        make[3]: *** [scripts/Makefile.build:334: samples/rust/rust_minimal.ll] Error 1
        make[3]: *** Waiting for unfinished jobs....
        mv: cannot stat 'samples/rust/rust_minimal.d': No such file or directory
        make[3]: *** [scripts/Makefile.build:309: samples/rust/rust_minimal.o] Error 1
        mv: cannot stat 'samples/rust/rust_minimal.d': No such file or directory
        make[3]: *** [scripts/Makefile.build:326: samples/rust/rust_minimal.s] Error 1
        make[2]: *** [scripts/Makefile.build:504: samples/rust] Error 2
        make[1]: *** [scripts/Makefile.build:504: samples] Error 2
        make: *** [Makefile:2008: .] Error 2
      
      The reason for the error is that 4 threads running in parallel renames
      the same file, samples/rust/rust_minimal.d.
      
      This does not happen when compiling C or assembly files because
      -Wp,-MMD,$(depfile) explicitly specifies the dependency filepath.
      $(depfile) is a unique path for each target.
      
      Currently, rustc is only given --out-dir and --emit=<list-of-types>
      So, all the rust build rules output the dep-info into the default
      <CRATE_NAME>.d, which causes the path conflict.
      
      Fortunately, the --emit option is able to specify the output path
      individually, with the form --emit=<type>=<path>.
      
      Add --emit=dep-info=$(depfile) to the common part. Also, remove the
      redundant --out-dir because the output path is specified for each type.
      
      The code gets much cleaner because we do not need to rename *.d files.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Tested-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Reviewed-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
      295d8398
  6. Jan 16, 2023
  7. Jan 15, 2023
  8. Dec 04, 2022
Loading