@@ -75,20 +75,36 @@ jobs:
75
75
- name : Add more failing tests because of undefined symbol errors (FIXME)
76
76
run : cat tests/failing-lto-tests.txt >> tests/failing-ui-tests.txt
77
77
78
- - name : Run tests
79
- run : |
78
+ # - name: Run tests
79
+ # run: |
80
80
# FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
81
81
# FIXME(antoyo): this should probably not be needed since we embed the LTO bitcode.
82
- printf '[profile.release]\nlto = "fat"\n' >> build/build_sysroot/sysroot_src/library/Cargo.toml
83
- EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
84
-
85
- - name : Run y.sh cargo build
82
+ # printf '[profile.release]\nlto = "fat"\n' >> build/build_sysroot/sysroot_src/library/Cargo.toml
83
+ # EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
84
+
85
+ # - name: LTO test
86
+ # run: |
87
+ # EMBED_LTO_BITCODE=1 CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
88
+ # call_found=$(objdump -dj .text tests/hello-world/target/release/hello_world | grep -c "call .*mylib.*my_func" ) ||:
89
+ # if [ $call_found -gt 0 ]; then
90
+ # echo "ERROR: call my_func found in asm"
91
+ # echo "Test is done with LTO enabled, hence inlining should occur across crates"
92
+ # exit 1
93
+ # fi
94
+
95
+ - name : Cross-language LTO test
86
96
run : |
87
- EMBED_LTO_BITCODE=1 CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
88
- call_found=$(objdump -dj .text tests/hello-world/target/release/hello_world | grep -c "call .*mylib.*my_func" ) ||:
97
+ pushd tests/cross_lang_lto
98
+ gcc -c -flto add.c -masm=intel
99
+ ar rcs libadd.a add.o
100
+ popd
101
+
102
+ ./y.sh build --sysroot --release # TODO: Remove this line.
103
+ EMBED_LTO_BITCODE=1 CHANNEL="release" CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" ./y.sh cargo build --release --manifest-path tests/cross_lang_lto/Cargo.toml
104
+ call_found=$(objdump -dj .text tests/cross_lang_lto/target/release/cross_lang_lto | grep -c "call" ) ||:
89
105
if [ $call_found -gt 0 ]; then
90
- echo "ERROR: call my_func found in asm"
91
- echo "Test is done with LTO enabled, hence inlining should occur across crates "
106
+ echo "ERROR: call my_add found in asm"
107
+ echo "Test is done with cross-language LTO enabled, hence inlining should occur across object files "
92
108
exit 1
93
109
fi
94
110
0 commit comments