Subject: bin/2342: gcc does not accept the -R linker option
To: None <gnats-bugs@NetBSD.ORG>
From: Christos Zoulas <christos@deshaw.com>
List: netbsd-bugs
Date: 04/19/1996 14:58:22
>Number:         2342
>Category:       bin
>Synopsis:       gcc does not accept the -R linker option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 19 15:20:02 1996
>Last-Modified:
>Originator:     Christos Zoulas
>Organization:
	Save the Prince of Whales
>Release:        Fri Apr 19 14:53:47 EDT 1996
>Environment:
	
System: NetBSD ramoth.nyc.deshaw.com 1.1B NetBSD 1.1B (ZEOS_AIC) #8: Mon Apr 8 17:38:10 EDT 1996 christos@ramoth.nyc.deshaw.com:/tmp_mnt/src/NetBSD/cvsroot/src/sys/arch/i386/compile/ZEOS_AIC i386


>Description:
	gcc does not accept the linker -R flag.
>How-To-Repeat:
	gcc foo.o -o foo -R/usr/mylib -L/usr/mylib  -lmylib
	where there is libmylib.so.1.0 in /usr/lib.
>Fix:

Add the necessary defines to enable the option:

Index: netbsd.h
===================================================================
RCS file: /a/cvsroot/src/gnu/usr.bin/gcc/arch/netbsd.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 netbsd.h
*** netbsd.h	1995/12/01 17:58:54	1.1.1.1
--- netbsd.h	1996/04/19 18:55:39
***************
*** 54,65 ****
  #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
  
  /* Provide a LINK_SPEC appropriate for NetBSD.  Here we provide support
!    for the special GCC options -static, -assert, and -nostdlib.  */
  
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
  
  
  /* We have atexit(3).  */
  
--- 54,76 ----
  #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
  
  /* Provide a LINK_SPEC appropriate for NetBSD.  Here we provide support
!    for the special GCC options -static, -assert, and -nostdlib. 
!    Also provide support for the -R linker option */
  
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp \
!    %{R*} %{!static:%{!R*:%{L*:-R %*}}} \
!    %{static:-Bstatic} %{assert*}"
  
+ 
+ /* This should be the same as the in gcc.c, with the addition of -R */
+ #undef SWITCH_TAKES_ARG
+ #define SWITCH_TAKES_ARG(CHAR)      \
+   ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
+    || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
+    || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
+    || (CHAR) == 'L' || (CHAR) == 'R' || (CHAR) == 'A')
  
  /* We have atexit(3).  */
  
>Audit-Trail:
>Unformatted: