https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101245
Bug ID: 101245 Summary: Bootstrap fails for a combined tree with --enable-shared Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: christoph.hoeger at celeraone dot com Target Milestone: --- Created attachment 51075 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51075&action=edit Reproduction build script I tried to bootstrap gcc 11.1.0 with binutils 2.36.1 in a combined tree and the build fails in stage2 when building libiberty. The failure stems from as not finding its shared libraries (opcode and bfd). The RPATH is set wrong: ➜ test2 readelf -d build/prev-gas/.libs/lt-as-new | grep RPATH 0x000000000000000f (RPATH) Library rpath: [/home/choeger/c1/scratch/gcc-combined/test2/build/opcodes/.libs:/home/choeger/c1/scratch/gcc-combined/test2/build/bfd/.libs:/usr/local/lib] ➜ test2 As you can see, the RPATH is not reset to the prev- directories. ➜ test2 build/prev-gas/as-new /home/choeger/c1/scratch/gcc-combined/test2/build/prev-gas/.libs/lt-as-new: error while loading shared libraries: libopcodes-2.36.1.so: cannot open shared object file: No such file or directory Find attached a script to reproduce the issue.