Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop emitting duplicate symbols for armv7-linux-androideabi #450

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

dcsommer
Copy link
Contributor

The change in 186517b was intended to
affect only arm-linux-androideabi but also affected
armv7-linux-androideabi which is not a pre-ARMv6 architecture.
Fixes #449

@dcsommer dcsommer changed the title Stop emitting duplicate symbols for armv7-linux-androideabi Stop emitting duplicate symbols for armv7-linux-androideabi Jan 27, 2022
The change in 186517b was intended to
affect only `arm-linux-androideabi` but also affected
`armv7-linux-androideabi` which is not a pre-ARMv6 architecture.
Fixes rust-lang#449
@dcsommer
Copy link
Contributor Author

To test, I did the following:
Downloaded the NDK used by rust-lang/rust as the docker scripts for rust-lang/rust do. Then I ran python3 android-ndk-r15c/build/tools/make_standalone_toolchain.py --install-dir /path/to/android-ndk-r15c-arm-14 --arch arm --api 14 as the docker scripts do too.

With HEAD at rust-lang/rust@6abb638 I set my config.toml to:

profile = "library"
changelog-seen = 2

[build]
target = ["armv7-linux-androideabi"]
docs = false
extended = true

[target.armv7-linux-androideabi]
android-ndk = "/path/to/android-ndk-r15c-arm-14"

Then I built the distribution artifacts:

./x.py dist --host='' --target=armv7-linux-androideabi

Then I looked at the contents of build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-3d9661a82c59c66a.rlib

Summary of changes in dist libcompiler_builtins-XXXXX.rlib before and after this change:

301,337d300
< 00000000 T __sync_fetch_and_add_1
< 00000000 T __sync_fetch_and_add_2
< 00000000 T __sync_fetch_and_add_4
< 00000000 T __sync_fetch_and_and_1
< 00000000 T __sync_fetch_and_and_2
< 00000000 T __sync_fetch_and_and_4
< 00000000 T __sync_fetch_and_max_1
< 00000000 T __sync_fetch_and_max_2
< 00000000 T __sync_fetch_and_max_4
< 00000000 T __sync_fetch_and_min_1
< 00000000 T __sync_fetch_and_min_2
< 00000000 T __sync_fetch_and_min_4
< 00000000 T __sync_fetch_and_nand_1
< 00000000 T __sync_fetch_and_nand_2
< 00000000 T __sync_fetch_and_nand_4
< 00000000 T __sync_fetch_and_or_1
< 00000000 T __sync_fetch_and_or_2
< 00000000 T __sync_fetch_and_or_4
< 00000000 T __sync_fetch_and_sub_1
< 00000000 T __sync_fetch_and_sub_2
< 00000000 T __sync_fetch_and_sub_4
< 00000000 T __sync_fetch_and_umax_1
< 00000000 T __sync_fetch_and_umax_2
< 00000000 T __sync_fetch_and_umax_4
< 00000000 T __sync_fetch_and_umin_1
< 00000000 T __sync_fetch_and_umin_2
< 00000000 T __sync_fetch_and_umin_4
< 00000000 T __sync_fetch_and_xor_1
< 00000000 T __sync_fetch_and_xor_2
< 00000000 T __sync_fetch_and_xor_4
< 00000000 T __sync_lock_test_and_set_1
< 00000000 T __sync_lock_test_and_set_2
< 00000000 T __sync_lock_test_and_set_4
< 00000000 T __sync_synchronize
< 00000000 T __sync_val_compare_and_swap_1
< 00000000 T __sync_val_compare_and_swap_2
< 00000000 T __sync_val_compare_and_swap_4
359c322
< 00000000 T _ZN17compiler_builtins3int3mul5UMulo4mulo17h6ebe8a25f3a18c0dE.llvm.698921072623391490
---
> 00000000 T _ZN17compiler_builtins3int3mul5UMulo4mulo17h6ebe8a25f3a18c0dE.llvm.9884457542086207240
400,402c363,365
< 00000000 T _ZN17compiler_builtins3int6addsub6AddSub3add17hced610ae232a945dE.llvm.10435582529288110963
< 00000000 T _ZN17compiler_builtins3int6addsub6AddSub3add17hde9f87aeaaf8b5c1E.llvm.10435582529288110963
< 00000000 T _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.10435582529288110963
---
> 00000000 T _ZN17compiler_builtins3int6addsub6AddSub3add17hced610ae232a945dE.llvm.13684769725188279451
> 00000000 T _ZN17compiler_builtins3int6addsub6AddSub3add17hde9f87aeaaf8b5c1E.llvm.13684769725188279451
> 00000000 T _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.13684769725188279451
1030c993
<          U _ZN17compiler_builtins3int3mul5UMulo4mulo17h6ebe8a25f3a18c0dE.llvm.698921072623391490
---
>          U _ZN17compiler_builtins3int3mul5UMulo4mulo17h6ebe8a25f3a18c0dE.llvm.9884457542086207240
1054,1060c1017,1023
<          U _ZN17compiler_builtins3int6addsub6AddSub3add17hced610ae232a945dE.llvm.10435582529288110963
<          U _ZN17compiler_builtins3int6addsub6AddSub3add17hced610ae232a945dE.llvm.10435582529288110963
<          U _ZN17compiler_builtins3int6addsub6AddSub3add17hde9f87aeaaf8b5c1E.llvm.10435582529288110963
<          U _ZN17compiler_builtins3int6addsub6AddSub3add17hde9f87aeaaf8b5c1E.llvm.10435582529288110963
<          U _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.10435582529288110963
<          U _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.10435582529288110963
<          U _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.10435582529288110963
---
>          U _ZN17compiler_builtins3int6addsub6AddSub3add17hced610ae232a945dE.llvm.13684769725188279451
>          U _ZN17compiler_builtins3int6addsub6AddSub3add17hced610ae232a945dE.llvm.13684769725188279451
>          U _ZN17compiler_builtins3int6addsub6AddSub3add17hde9f87aeaaf8b5c1E.llvm.13684769725188279451
>          U _ZN17compiler_builtins3int6addsub6AddSub3add17hde9f87aeaaf8b5c1E.llvm.13684769725188279451
>          U _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.13684769725188279451
>          U _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.13684769725188279451
>          U _ZN17compiler_builtins3int6addsub7UAddSub4usub17ha046c9d21f420f34E.llvm.13684769725188279451

The only significant changes seem to be the __sync_* family functions getting removed (whose _4 suffixed variants are already defined) as we want. I'm not sure why the name mangling of some other functions change, but I guess that's okay?

@Amanieu Amanieu merged commit 0f6248a into rust-lang:master Jan 28, 2022
@Amanieu
Copy link
Member

Amanieu commented Jan 28, 2022

The stuff after a . in the symbol name is specific to LLVM internals, it's normal for it to vary with minor changes in codegen.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 1, 2022
Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib

I ran `./x.py dist --host= --target=armv7-linux-androideabi` before this diff:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-3d9661a82c59c66a.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
2
```
And after:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-ffd2745070943321.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
1
```
Fixes rust-lang#93310

See also rust-lang/compiler-builtins#449 and rust-lang/compiler-builtins#450
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 1, 2022
Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib

I ran `./x.py dist --host= --target=armv7-linux-androideabi` before this diff:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-3d9661a82c59c66a.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
2
```
And after:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-ffd2745070943321.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
1
```
Fixes rust-lang#93310

See also rust-lang/compiler-builtins#449 and rust-lang/compiler-builtins#450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libcompiler_builtins.rlib for armv7-linux-androideabi includes multiple definitions of __sync_fetch_and_add_4
2 participants