Skip to content

Commit

Permalink
Emit metadata instead of link
Browse files Browse the repository at this point in the history
It allows us to save a bit of space, ignore the duplicate object files,
and the archiving steps; e.g.:

      643544 libcompiler_builtins.rlib
    64171752 libcore.rlib

vs.

      530004 libcompiler_builtins.rmeta
    63679866 libcore.rmeta

We couldn't do it right away in [1] because `rustc` required a fix [2,3].
The fix is now in [4] and available since the 2021-01-21 nightly, so now
we can go ahead and make the change.

Fixes #75.

[1] #52
[2] rust-lang/rust#81117
[3] rust-lang/rust#81118
[4] rust-lang/rust@f9275e1

Suggested-by: bjorn3
Signed-off-by: Miguel Ojeda <[email protected]>
  • Loading branch information
ojeda committed Jan 21, 2021
1 parent 780faf2 commit f8eac82
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
arch: [x86_64, arm64]
toolchain: [gcc, clang, llvm]
config: [debug, release]
rustc: [2021-01-02]
rustc: [2021-01-21]
output: [src] # [src, build]
install: [rustup] # [rustup, standalone]
sysroot: [common] # [common, custom]
Expand All @@ -27,23 +27,23 @@ jobs:
- arch: x86_64
toolchain: gcc
config: debug
rustc: 2021-01-09
rustc: 2021-01-21
output: build
install: rustup
sysroot: custom

- arch: arm64
toolchain: clang
config: release
rustc: 2021-01-16
rustc: 2021-01-21
output: build
install: standalone
sysroot: common

- arch: x86_64
toolchain: llvm
config: debug
rustc: 2021-01-19
rustc: 2021-01-21
output: build
install: standalone
sysroot: custom
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*.o
*.o.*
*.patch
*.rlib
*.rmeta
*.s
*.so
*.so.dbg
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-Werror=return-type -Wno-format-security \
-std=gnu89
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_RUSTCFLAGS := --emit=dep-info,obj,link -Zbinary_dep_depinfo=y \
KBUILD_RUSTCFLAGS := --emit=dep-info,obj,metadata -Zbinary_dep_depinfo=y \
-Cpanic=abort -Cembed-bitcode=n -Clto=n -Crpath=n \
-Cforce-unwind-tables=n -Ccodegen-units=1 \
-Zsymbol-mangling-version=v0
Expand Down Expand Up @@ -1874,7 +1874,7 @@ clean: $(clean-dirs)
$(call cmd,rmfiles)
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '*.rlib' \
-o -name '*.rmeta' \
-o -name '*.ko.*' \
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
-o -name '*.dwo' -o -name '*.lst' \
Expand Down
2 changes: 1 addition & 1 deletion rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $(objtree)/rust/exports_kernel_generated.h: $(objtree)/rust/kernel.o FORCE

quiet_cmd_rustc_procmacro = RUSTC P $@
cmd_rustc_procmacro = \
$(RUSTC) $(rustc_flags) --edition 2018 --extern proc_macro \
$(RUSTC) $(rustc_flags) --emit=dep-info,link --edition 2018 --extern proc_macro \
--crate-type proc-macro --out-dir $(objtree)/rust/ \
--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \
mv $(objtree)/rust/$(patsubst lib%.so,%,$(notdir $@)).d $(depfile); \
Expand Down

0 comments on commit f8eac82

Please sign in to comment.