This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
usage of --start-group and --end-group
- From: tong chen <csicong at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 17 May 2018 14:58:37 +0800
- Subject: usage of --start-group and --end-group
hi, all:
I'm compiling libelf.so of elfutils with:
cc -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition
-Wstrict-prototypes -Werror -Wunused -Wextra -Wstack-usage=262144
-I/home/tom/new_from_st_170401/code/code/julp/build/host/include
-fgnu89-inline -fbuiltin
-L/home/tom/new_from_st_170401/code/code/julp/build/host/lib -lintl
-lz -o libelf.so -shared -o libelf.so
-Wl,--whole-archive,./libelf/libelf_pic.a,--no-whole-archive,--no-undefined
-Wl,--version-script,./libelf/libelf.map,--no-undefined
-Wl,--soname,libelf.so.1,-z,defs,-z,relro
It reports some undefined reference from libelf_pic.a archive.
But if surround "-lint -lz" with --start-group/--end-group, like this:
-Wl,--start-group -lintl -lz -Wl,--end-group
It still reports undefined symbols. To remove this error, I must
place "-lint -lz" in the end of the cmd, after libelf_pic.a.
Am I using wrong? lintl and lz archives seem haven't been searched
repeatedly.