Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Halfway through the article when he finds stat is the problem, I was surprised he didn't just solve it with a hastily coded LD_PRELOAD shim and move on with his day. I'm routinely working with Fortran that predates my birth. If I find a convenient inflection point to inject a trivial solution, that's usually much easier and safer than trying to debug the code and later discover that it makes use of a computed goto or a longjmp that would cause an insidious bug


Does ld_preload work for static binaries?


Ah, I missed that part. No, LD_PRELOAD isn't going to be able to overwrite statically linked functions


Not for fully static, but apart from go programs those are pretty rare, right? For everything-static-but-libc it's still OK.


https://stackoverflow.com/questions/60450102/why-does-ld-pre...

> No, it doesn't. A static binary has no need to resolve any symbol dynamically, and therefore the dynamic loader is not invoked to resolve the usual library function symbols.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: