我要评分
获取效率
正确性
完整性
易理解

-fmulti-version-lib=<value>

Description

This option is a link-time option used together with -flto. It is used to inform the compiler that the input library files are in multi-version LTO format during link time optimization (LTO) and trigger the compiler to switch to the LTO parsing mode of the earlier version (currently, those compiled by openEuler 24.03 LTS SP1 and later versions are supported) for compatibility with static libraries or object files in different LTO formats for linking and optimization.

Usage

The usage is as follows. If multiple file names are passed, separate them with commas (,).

1
-flto -fmulti-version-lib=liba.a,libb.a 

Example:

1
2
3
4
5
6
# gcc for openEuler 24.09
gcc -O2 -fPIC -flto -c fa.c -o fa.o
gcc-ar rcs liba.a fa.o

# gcc for openEuler latest
gcc -O2 -fPIC -flto -fmulti-version-lib=liba.a main.c liba.a -o exe