mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 11:18:37 +04:00
gcc builds the target libraries with CFLAGS_FOR_TARGET, which carries no prefix map. __FILE__ therefore expands to an absolute path, and assert in libstdc++ and the ryu code put seven of them into .rodata, where the strip before packaging cannot reach them. The libstdcpp6 package differs between two builds in different directories, and so does every image that ships it. The published package shows the same thing. libstdcpp6-14.4.0-r5.apk of bcm47xx/mips74k holds /builder/shared-workdir/build/build_dir/toolchain-mipsel_74kc_gcc-14.4.0_musl/gcc-14.4.0/libstdc++-v3/src/c++11/debug.cc so no rebuild of that package can match today. iremap is called with BUILD_DIR for the kernel, with PKG_BUILD_DIR for a package and with STAGING_DIR for the target headers. The toolchain build directory has no such call. Add one for the three FOR_TARGET flag sets. The replacement keeps the build_dir element, because the last element of the toolchain build directory and of the toolchain staging directory is the same string and one replacement for both would make the two roots indistinguishable. Tested with two bcm47xx/mips74k trees whose directory names differ in length. The shipped libstdc++.so.6.0.33 holds no absolute path any more and the libstdcpp6 package is now identical in both trees. It differed by 165 bytes before. The toolchain staging directory still appears in the debug information of the same library, 244 times. Those are DWARF include directories, they do not survive the strip, and no shipped file carries them. Signed-off-by: John Crispin <john@phrozen.org>