On 06.10.2017 18:37, Taylor R Campbell wrote: > We have a definition of the symbol gethostbyname_r in libc. It is > problematic because: > > 1. It is not compatible with the glibc definition of the symbol. > 2. It is not declared anywhere in a header file we install. > > So autoconf will detect that the symbol exists, a C compiler with > -Wno-error will invent a bogus implicit declaration for the symbol, > and there will be mysterious run-time misbheaviour because the calling > code doesn't match the expectations of the gethostbyname_r definition. > > As far as I can tell, it has *never* been possible to legitimately use > our gethostbyname_r symbol. The above scenario has already caused > trouble in various pkgsrc packages. See, for example, > <https://mail-index.netbsd.org/netbsd-users/2016/06/30/msg018651.html>. > > Can we remove gethostbyname_r now, before the mythical libc bump? > > Since it has never been possible to use the symbol legitimately, any > application that *would* break if we removed it is *already* broken. > The only difference is that if we remove the symbol from libc, then we > get an immediate report that the application is broken, instead of > mysterious run-time misbehaviour some time in the future. > > The same goes for the symbols: > > endhostent_r > gethostbyaddr_r > gethostbyname2_r > gethostbyname_r > gethostent_r > sethostent_r > There is a possible hack solution with a shim-library. 1. Add a light version of libc in /lib/libc.so (and put it to /usr/lib/libc.so?). 2. Remove from this shim library all the code to make it light. 3. Keep SONAME to real libc.so.x.y. 4. Users will dynamically open the proper library at DT_NEEDED. GCC developers pointed me to this example script: https://github.com/negativo17/compat-gcc-53/blob/master/dummylib.sh Basically we run "readelf -Ws /lib/libc.so" and generate from this table a shim library with removed unwanted symbols. This way we remove new users on link-time, and keep compat for run-time ones. No symbol versioning is needed. This approach can be used to prepare for major bump and removal of legacy interfaces like bcmp(3), strtoq(3) etc.
Description: OpenPGP digital signature