Re: ld compat linker warnings considered harmful

RVP <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On Thu, 20 Aug 2026, David Holland wrote:

> On Wed, Aug 19, 2026 at 11:42:37PM +0000, RVP wrote:
>
> > I don't get this error at all. The only function that libroken's using from
> > libutil is pidfile(3), so why are those warning being triggered.
>
> Thanks for the simple example; that was sufficient to determine that
> it's being caused by the LTO plugin. As in, if you take the LTO plugin
> material out of the link line, it stops happening.
>

Actually, I believe it's this:

https://github.com/NetBSD/src/commit/d138d9f7e9bad645835c789d42405d05fb3dd84b

Adding the `--copy-dt-needed-entries' behaviour's been lost and put back twice
before:

https://github.com/NetBSD/src/commit/ac4a17f185bbc107fd63d47bf7715b066ca83115
https://github.com/NetBSD/src/commit/d138d9f7e9bad645835c789d42405d05fb3dd84b

All of them to fix what PR lib/57615 wants to do (as this is done on Linux).

In addition to wiz@'s issue, this change also has another unexpected side-effect:

```
$ cat t.c
#include <util.h>

int main(void) {
 	int fd = pidfile("/tmp/my.pid");
 	return fd != 0;
}

$ cc -o t t.c -lroken
```

Don't need to link with `-lutil' at all. Any library which `DT_NEEDED's libutil
will do: libroken, libgssapi, ... Fun!

-RVP

PS. cc'ing rin@, christos@ & joerg@ as they're the ones who put back this change
each time it was lost.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.