On Thu, Oct 17, 2019 at 9:31 PM 謝憲譁 <r901042004@xxxxxxxxx> wrote: > If we compile without *-flto* option, linker will replace the weak function > with global function. > The sequence of linking doesn’t matter. > If we compile with *-flto* option, linker will use the function in the > later file. I have reproduced the problem, but expect that it will take some time to debug as I have a lot of other issues to look at also, and LTO issues tend to be complicated. I know that there have been some LTO and weak related bug reports over time, and fixes for them, so I suspect this should work. I don't know if this is a RISC-V specific problem or not, but the testcase does work correctly on x86_64-linux. Jim