@@ -75,20 +75,39 @@ jobs:
7575 - name : Add more failing tests because of undefined symbol errors (FIXME)
7676 run : cat tests/failing-lto-tests.txt >> tests/failing-ui-tests.txt
7777
78- - name : Run tests
79- run : |
78+ # - name: Run tests
79+ # run: |
8080 # FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
8181 # 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
8696 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 -fPIC -O3
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 .*my_add" ) ||:
105+ gcc -v
106+ /usr/bin/gcc -v
107+ objdump -dj .text tests/cross_lang_lto/target/release/cross_lang_lto | grep -C 15 "call .*my_add"
89108 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 "
109+ echo "ERROR: call my_add found in asm"
110+ echo "Test is done with cross-language LTO enabled, hence inlining should occur across object files "
92111 exit 1
93112 fi
94113
0 commit comments