public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* mn10300: relaxing vs section merging
@ 2004-05-05 18:18 DJ Delorie
  2004-05-06  7:14 ` Alexandre Oliva
  0 siblings, 1 reply; 18+ messages in thread
From: DJ Delorie @ 2004-05-05 18:18 UTC (permalink / raw)
  To: binutils


There are problems with the mn10300 when you turn on both relaxing and
section merging.  What happens is, the relaxing code uses the
pre-merged symbol offsets.  I finally figured out why the obvious
solution didn't work, and now have a patch.  However, before I
consider applying it, I have a question: why don't we bother adjusting
relocs in gas?  You have to use section-relative relocs with section
merging, but I couldn't find any explanation of why the call to do so
was commented out.

2004-05-05  DJ Delorie  <dj@redhat.com>

	* config/tc-mn10300.h (tc_fix_adjustable): Enable so we get
	section-relative symbols.

	* elf-m10300.c (mn10300_elf_relax_section): Preserve reloc
	addend so it doesn't get adjusted twice, but do use merged
	value when calculating symbol value.

Index: gas/config/tc-mn10300.h
===================================================================
RCS file: /cvs/uberbaum/./gas/config/tc-mn10300.h,v
retrieving revision 1.14
diff -p -C2 -r1.14 tc-mn10300.h
*** gas/config/tc-mn10300.h	10 Jul 2003 04:44:56 -0000	1.14
--- gas/config/tc-mn10300.h	5 May 2004 18:12:29 -0000
*************** void mn10300_cons_fix_new PARAMS ((fragS
*** 103,108 ****
  
  /* Don't bother to adjust relocs.  */
! #define tc_fix_adjustable(FIX) 0
! /* #define tc_fix_adjustable(FIX) mn10300_fix_adjustable (FIX) */
  extern bfd_boolean mn10300_fix_adjustable PARAMS ((struct fix *));
  
--- 103,108 ----
  
  /* Don't bother to adjust relocs.  */
! /* #define tc_fix_adjustable(FIX) 0 */
! #define tc_fix_adjustable(FIX) mn10300_fix_adjustable (FIX)
  extern bfd_boolean mn10300_fix_adjustable PARAMS ((struct fix *));
  
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/uberbaum/./bfd/elf-m10300.c,v
retrieving revision 1.49
diff -p -C2 -r1.49 elf-m10300.c
*** bfd/elf-m10300.c	27 Mar 2004 10:58:05 -0000	1.49
--- bfd/elf-m10300.c	5 May 2004 18:12:31 -0000
*************** mn10300_elf_relax_section (abfd, sec, li
*** 2440,2443 ****
--- 2440,2444 ----
  	  const char *sym_name;
  	  char *new_name;
+ 	  bfd_vma saved_addend;
  
  	  /* A local symbol.  */
*************** mn10300_elf_relax_section (abfd, sec, li
*** 2459,2462 ****
--- 2460,2467 ----
  						      isym->st_name);
  
+ 	  saved_addend = irel->r_addend;
+ 	  symval = _bfd_elf_rela_local_sym (abfd, isym, &sym_sec, irel);
+ 	  symval += irel->r_addend;
+ 	  irel->r_addend = saved_addend;
  	  /* Tack on an ID so we can uniquely identify this
  	     local symbol in the global hash table.  */

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-05-28 21:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-05 18:18 mn10300: relaxing vs section merging DJ Delorie
2004-05-06  7:14 ` Alexandre Oliva
2004-05-07  1:19   ` DJ Delorie
2004-05-11 22:36     ` Alexandre Oliva
2004-05-12  1:35       ` Alan Modra
2004-05-25 23:14         ` DJ Delorie
2004-05-25 23:31           ` Alan Modra
2004-05-25 23:43             ` DJ Delorie
2004-05-26  0:02               ` Alan Modra
2004-05-26  0:18                 ` DJ Delorie
2004-05-26  1:09                   ` Alan Modra
2004-05-28  2:15                     ` DJ Delorie
2004-05-28  2:36                       ` Alexandre Oliva
2004-05-28  4:11                         ` Alexandre Oliva
2004-05-28  4:17                           ` DJ Delorie
2004-05-28  4:30                             ` Alexandre Oliva
2004-05-28 21:49                               ` DJ Delorie
2004-05-28  4:55                             ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).