Subject: toolchain/23251: ld names wrong files
To: None <>
From: Martin Husemann <>
List: netbsd-bugs
Date: 10/23/2003 22:09:41
>Number:         23251
>Category:       toolchain
>Synopsis:       ld names wrong files
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 23 20:10:00 UTC 2003
>Originator:     Martin Husemann
>Release:        NetBSD 1.6ZD
System: NetBSD 1.6ZD NetBSD 1.6ZD (NELLY) #22: Mon Oct 20 23:30:28 CEST 2003 sparc64
Architecture: sparc64
Machine: sparc64

When listing references to undefined symbols ld(1) uses wrong file names, if
source files of library modules use the same basename as the real source

Create a small test program with a typo in a function name. Safe it as "test.c".
Try to compile it. Watch the bogus ld error message:

[/tmp/emptydir] martin@nelly > pwd
[/tmp/emptydir] martin@nelly > ls -l
total 1
-rw-r--r--  1 martin  wheel  446 Oct 23 22:00 test.c
[/tmp/emptydir] martin@nelly > cc -g -Wall -O2 -pthread -lm test.c
test.c: In function `main':
test.c:20: warning: implicit declaration of function `phtread_create'
/var/tmp//ccRp4Xks.o: In function `main':
itimerspec/test.c:20: undefined reference to `phtread_create'