diff options
author | Kito Cheng <kito.cheng@sifive.com> | 2025-03-10 16:26:04 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2025-05-27 13:41:45 +0800 |
commit | 447156e4d143d7f513c488dd0b44037524a01fba (patch) | |
tree | 9a808d76d66b5655c2cce8b17353ac0dc92c01a5 /libgcc | |
parent | a91679a3d9f7cbc079880f201fd8292c1d54baa7 (diff) | |
download | gcc-447156e4d143d7f513c488dd0b44037524a01fba.zip gcc-447156e4d143d7f513c488dd0b44037524a01fba.tar.gz gcc-447156e4d143d7f513c488dd0b44037524a01fba.tar.bz2 |
driver: Fix multilib_os_dir and multiarch_dir for those target use TARGET_COMPUTE_MULTILIB
This patch fixes the multilib_os_dir and multiarch_dir for those targets
that use TARGET_COMPUTE_MULTILIB, since the TARGET_COMPUTE_MULTILIB hook
only update/fix the multilib_dir but not the multilib_os_dir and multiarch_dir,
so the multilib_os_dir and multiarch_dir are not set correctly for those targets.
Use RISC-V linux target (riscv64-unknown-linux-gnu) as an example:
```
$ riscv64-unknown-linux-gnu-gcc -print-multi-lib
.;
lib32/ilp32;@march=rv32imac@mabi=ilp32
lib32/ilp32d;@march=rv32imafdc@mabi=ilp32d
lib64/lp64;@march=rv64imac@mabi=lp64
lib64/lp64d;@march=rv64imafdc@mabi=lp64d
```
If we use the exactly same -march and -mabi options to compile a source file,
the multilib_os_dir and multiarch_dir are set correctly:
```
$ riscv64-unknown-linux-gnu-gcc -print-multi-os-directory -march=rv64imafdc -mabi=lp64d
../lib64/lp64d
$ riscv64-unknown-linux-gnu-gcc -print-multi-directory -march=rv64imafdc -mabi=lp64d
lib64/lp64d
```
However if we use the -march=rv64imafdcv -mabi=lp64d option to compile a source
file, the multilib_os_dir and multiarch_dir are not set correctly:
```
$ riscv64-unknown-linux-gnu-gcc -print-multi-os-directory -march=rv64imafdc -mabi=lp64d
lib64/lp64d
$ riscv64-unknown-linux-gnu-gcc -print-multi-directory -march=rv64imafdc -mabi=lp64d
lib64/lp64d
```
That's because the TARGET_COMPUTE_MULTILIB hook only update/fix the multilib_dir
but not the multilib_os_dir, so the multilib_os_dir is blank and will use same
value as multilib_dir, but that is not correct.
So we introduce second chance to fix the multilib_os_dir if it's not set, we do
also try to fix the multiarch_dir, because it may also not set correctly if
multilib_os_dir is not set.
Changes since v1:
- Fix non-multilib build.
- Fix fix indentation.
gcc/ChangeLog:
* gcc.cc (find_multilib_os_dir_by_multilib_dir): New.
(set_multilib_dir): Fix multilib_os_dir and multiarch_dir
if multilib_os_dir is not set.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions