Subject: bin/5846: cc -R and -rpath arguments not consistent
To: None <gnats-bugs@gnats.netbsd.org>
From: Tim Rightnour <root@polaris.garbled.net>
List: netbsd-bugs
Date: 07/25/1998 07:42:54
>Number: 5846
>Category: bin
>Synopsis: cc -R and -rpath arguments not consistent
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 25 07:35:00 1998
>Last-Modified:
>Originator: Tim Rightnour
>Organization:
Tim Rightnour - root@garbled.net
http://www.zynetwc.com/~garbled/garbled.html
>Release: 1.3 i386 and -current alpha<NetBSD-current source date>
>Environment:
System: NetBSD polaris 1.3 NetBSD 1.3 (POLARIS) #0: Thu Mar 26 13:17:18 MST 1998 root@polaris:/usr/src/sys/arch/i386/compile/POLARIS i386
>Description:
Attempting to create a -R or -rpath string that can be given to a.out
platforms as a nop uncovered this little gem:
legend: rigel= alpha with snapshot -current toolchain
polaris= i386 with 1.3
[/home/garbled] polaris# ctest
+ cc -Wl,-rpath,/usr/pkg/lib test.c
ld: /usr/pkg/lib: malformed input file (not rel or archive)
+ cc -rpath /usr/pkg/lib test.c
ld: /usr/pkg/lib: malformed input file (not rel or archive)
+ cc -R /usr/pkg/lib test.c
+ cc -R/usr/pkg/lib test.c
rigel# ./ctest
+ cc -Wl,-rpath,/usr/pkg/lib test.c
+ cc -rpath /usr/pkg/lib test.c
+ cc -R /usr/pkg/lib test.c
cc: unrecognized option `-R'
/usr/pkg/lib: file not recognized: File format not recognized
+ cc -R/usr/pkg/lib test.c
cc: unrecognized option `-R/usr/pkg/lib'
Also note: the -R option, while it generates an error and does not perform
a proper link, does *not* give a failure exit status, and creates the
useless binary. This means that big make files just keep on chugging
even though they are generating garbage binaries. (and pkgs!)
>How-To-Repeat:
for any test.c:
#!/bin/sh -x
cc -Wl,-rpath,/usr/pkg/lib test.c
cc -rpath /usr/pkg/lib test.c
cc -R /usr/pkg/lib test.c
cc -R/usr/pkg/lib test.c
>Fix:
Make the options consistent.. First off, -R should work on alpha.. second,
-rpath shouldn't generate wild ld warnings and fail the build on a.out.
And some checking should be done to make sure cc uses EXIT_FAILURE if it blows
up on an unknown option.
>Audit-Trail:
>Unformatted: