Package: mklibs
Version: 0.1.40
Tags: patch
Hello,
We encountered a bug in mklibs in our build system where there were required symbols that weren't added. The reason the symbols weren't added was because the library that required them was treated as a hardlink to an object that was already in the objects dictionary.
At every "library reduction pass", stripped versions of required libraries are created/recreated using objcopy. If a separate thread or process creates a new file in between the
deletion and recreation of a library, the recreated library will have a
different inode from the one used in the objects dictionary and the new
file would get the recreated library's old inode. At the next pass there
would be two entries of the same library on the objects dictionary. If
the new file gets deleted before a new library is created, the new
library might get the the previous library's old inode. If this new
library hasn't been added to the objects dictionary yet then it will mistaken as a hardlink and will not
be added in the next pass. As a result, it will not be checked for undefined
symbols.
Adding a check at the start of every library reduction pass to make sure that all entries in the objects dictionary are updated. Attached is a patch that does that.