Skip to content

Commit 9cc826c

Browse files
authored
Merge pull request #773 from rust-lang/fix/undefined-symbols-lto
Fix undefined symbols error with lto
2 parents b25c2bf + e44d493 commit 9cc826c

File tree

4 files changed

+3
-43
lines changed

4 files changed

+3
-43
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,10 @@ jobs:
7272
git config --global user.name "User"
7373
./y.sh prepare
7474
75-
- name: Add more failing tests because of undefined symbol errors (FIXME)
76-
run: cat tests/failing-lto-tests.txt >> tests/failing-ui-tests.txt
77-
7875
- name: Run tests
7976
run: |
8077
# FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
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-
./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
78+
CG_RUSTFLAGS="-Cembed-bitcode=yes" ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
8479
8580
- name: LTO test
8681
run: |
@@ -99,7 +94,7 @@ jobs:
9994
ar rcs libadd.a add.o
10095
popd
10196
102-
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
97+
CHANNEL="release" CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" ./y.sh cargo build --release --manifest-path tests/cross_lang_lto/Cargo.toml
10398
call_found=$(objdump -dj .text tests/cross_lang_lto/target/release/cross_lang_lto | grep -c "call .*my_add" ) ||:
10499
if [ $call_found -gt 0 ]; then
105100
echo "ERROR: call my_add found in asm"

src/back/write.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ pub(crate) fn codegen(
5959
if lto_supported {
6060
context.add_command_line_option("-flto=auto");
6161
context.add_command_line_option("-flto-partition=one");
62-
// TODO(antoyo): remove since we don't want fat objects when it is for Bitcode only.
63-
context.add_command_line_option("-ffat-lto-objects");
6462
}
6563
context
6664
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));

tests/cross_lang_lto/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* ar rcs libadd.a add.o
55
*
66
* Compile the Rust code with:
7-
* EMBED_LTO_BITCODE=1 CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" y cargo run --release
7+
* CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" y cargo run --release
88
*/
99

1010
#[link(name="add")]

tests/failing-lto-tests.txt

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)