[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Some questions about use libtool when linking
From: |
Kun Yang |
Subject: |
Some questions about use libtool when linking |
Date: |
Tue, 8 Oct 2024 15:31:48 +0000 |
Greetings,
I'm intended to update libtool package for MSYS2, but some troubles occurred
that beyond my ability. I'm confused by some flags when linking.
Compared to v2.4.7, libtool now accepts more flags when linking. The most of the
flags in
https://github.com/msys2/MSYS2-packages/blob/master/libtool/0003-Pass-various-runtime-library-flags-to-GCC.mingw.patch
were added in v2.5.3. As you can see, there is still some flags automatically
ignored by libtool when linking. For example, you can run the following commands
in your shell.
libtool --version | head -1
echo "void foo(void) {}" >foo.c
libtool --mode=compile --tag=CC cc -c foo.c -o foo.lo -O3 -ffast-math
libtool --mode=link --tag=CC cc foo.lo -o libfoo.la -O3 -ffast-math -rpath
/usr/lib -version-info 0 -no-undefined
Here is the output on Arch Linux with libtool v2.5.3 (they prefer uses git
instead of the unstable version, so -dirty were append in the version string)
libtool (GNU libtool) 2.5.3-dirty
libtool: compile: cc -c foo.c -O3 -ffast-math -fPIC -DPIC -o .libs/foo.o
libtool: compile: cc -c foo.c -O3 -ffast-math -o foo.o >/dev/null 2>&1
libtool: link: rm -fr .libs/libfoo.a .libs/libfoo.la .libs/libfoo.lai
.libs/libfoo.so .libs/libfoo.so.0 .libs/libfoo.so.0.0.0 libtool: link: gcc
-shared -fPIC -DPIC .libs/foo.o -O3 -Wl,-soname -Wl,libfoo.so.0 -o
.libs/libfoo.so.0.0.0 libtool: link: (cd ".libs" && rm -f "libfoo.so.0" && ln -s
"libfoo.so.0.0.0" "libfoo.so.0") libtool: link: (cd ".libs" && rm -f "libfoo.so"
&& ln -s "libfoo.so.0.0.0" "libfoo.so") libtool: link: ar cr .libs/libfoo.a
foo.o libtool: link: ranlib .libs/libfoo.a libtool: link: ( cd ".libs" && rm -f
"libfoo.la" && ln -s "../libfoo.la" "libfoo.la" )
As what you saw, -ffast-math were ignored. However, I found that some flags were
necessary on some platforms to generate startup code for these flags. See the
footnote in the following page.
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#FOOT1
Is there any reason why these flags not included? Is it necessary for linking?
If so, could anyone please give me a full list of these flags which are probably
necessary for linking?
I would really appreciate it if you could give me a hand.
Best Regards,
Yang Kun
- Some questions about use libtool when linking,
Kun Yang <=