Committed, MMIX: gas: check the weakness of a symbol when relaxing

Hans-Peter Nilsson hp@bitrange.com
Thu Mar 14 02:06:00 GMT 2002


Doh!

gas:
	* config/tc-mmix.c (md_estimate_size_before_relax): Don't consider
	a weak symbol in same section to be within reach.

gas/testsuite:
	* gas/mmix/weak1.d, gas/mmix/weak1.d: New test.

Index: tc-mmix.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mmix.c,v
retrieving revision 1.5
diff -p -c -r1.5 tc-mmix.c
*** tc-mmix.c	2002/02/04 04:03:15	1.5
--- tc-mmix.c	2002/03/14 09:53:39
*************** md_estimate_size_before_relax (fragP, se
*** 2172,2178 ****
  #define HANDLE_RELAXABLE(state)						\
   case ENCODE_RELAX (state, STATE_UNDF):					\
     if (fragP->fr_symbol != NULL						\
!        && S_GET_SEGMENT (fragP->fr_symbol) == segment)			\
       {									\
         /* The symbol lies in the same segment - a relaxable case.  */	\
         fragP->fr_subtype						\
--- 2172,2179 ----
  #define HANDLE_RELAXABLE(state)						\
   case ENCODE_RELAX (state, STATE_UNDF):					\
     if (fragP->fr_symbol != NULL						\
!        && S_GET_SEGMENT (fragP->fr_symbol) == segment			\
!        && !S_IS_WEAK (fragP->fr_symbol))				\
       {									\
         /* The symbol lies in the same segment - a relaxable case.  */	\
         fragP->fr_subtype						\

*** /dev/null	Tue Jan  1 05:00:00 1980
--- weak1.s	Thu Mar 14 10:50:40 2002
***************
*** 0 ****
--- 1,7 ----
+ 	.weak foo
+ foo:
+ 	POP 1,0
+ 	.global main
+ main:
+ 	PUSHJ $15,foo
+ 	.quad foo
*** /dev/null	Tue Jan  1 05:00:00 1980
--- weak1.d	Thu Mar 14 10:48:51 2002
***************
*** 0 ****
--- 1,23 ----
+ #as: -x
+ #objdump: -str
+
+ # Relaxation thought a weak symbol was within reach.
+
+ .*:     file format elf64-mmix
+
+ SYMBOL TABLE:
+ 0+ l    d  \.text	0+
+ 0+ l    d  \.data	0+
+ 0+ l    d  \.bss	0+
+ 0+  w      \.text	0+ foo
+ 0+4 g       \.text	0+ main
+
+ RELOCATION RECORDS FOR \[\.text\]:
+ OFFSET           TYPE              VALUE
+ 0+18 R_MMIX_64         foo
+ 0+4 R_MMIX_PUSHJ      foo
+
+ Contents of section \.text:
+  0000 f8010000 f20f0000 fd000000 fd000000  .*
+  0010 fd000000 fd000000 00000000 00000000  .*
+ Contents of section \.data:

brgds, H-P



More information about the Binutils mailing list