Summary: | dev-debug/gdb-13.1-r1: undefined reference to `__atomic_fetch_add_4' on MIPS (/usr/lib/gcc/mips-unknown-linux-gnu/12/include/g++-v12/ext/atomicity.h:66: more undefined references to `__atomic_fetch_add_4' follow) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | BRULE Herman <alpha_one_x86> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | UNCONFIRMED --- | ||
Severity: | major | CC: | mips |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | MIPS | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 721344 | ||
Attachments: | build.log |
Description
BRULE Herman
2023-03-23 03:36:56 UTC
Please always include the full build.log. Created attachment 858663 [details]
build.log
This is a returning issue. I got met with it this week on dev-util/apr and www-servers/apache. To try overcome the issue I added LDFLAGS="${LDFLAGS} -Wl,--as-needed -latomic" in the package environment but that results in the following link line failing: ================================================ armv5tel-softfloat-linux-gnueabi-gcc -O2 -pipe -march=armv5te -Wl,-O1 -o ab ab.o -Wl,--as-needed //usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/12/libatomic.so -Wl,--no-as-needed -laprutil-1 -lgdbm -lapr-1 -lm -lssl -lcrypto -pthread -Wl,-rpath -Wl,//usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/12 /usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/12/../../../../armv5tel-softfloat-linux-gnueabi/bin/ld: /usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/12/../../../libapr-1.so: undefined reference to `__atomic_exchange_8' ... collect2: error: ld returned 1 exit status ================================================ * Note that '-latomic' gets translated to the actual path of libatomic.so It is apparent that the order of definitions is important, because what does work is when '-Wl,--as-needed -latomic' is added to the end of the line, i.e.: ================================================ armv5tel-softfloat-linux-gnueabi-gcc -O2 -pipe -march=armv5te -Wl,-O1 -o ab ab.o -Wl,--as-needed //usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/12/libatomic.so -Wl,--no-as-needed -laprutil-1 -lgdbm -lapr-1 -lm -lssl -lcrypto -pthread -Wl,-rpath -Wl,//usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/12 -Wl,--as-needed -latomic ================================================ So I tried various combinations of forcing libatomic into the build through LDFLAGS but it turns out that libtool even overrides '-Wl,--no-as-needed' and due to the order of processing gcc considers libatomic in the resulting link command as not needed and the build still requires libatomic to be added manually to complete it after going bust. |