🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #927

[binutils-2.0/bfd/reloc.c] Make clear what reloc_funcs should do...

#927
From: Andrew Cagney - aka Noid
Date: Thu, 15 Oct 1992 05:03
67 lines
2311 bytes
[This is a cosmetic change]

In binutils-2.0/bfd/reloc.c:bfd_perform_relocation() the following code
sequence occures:

		if symbol undefined
			flag = bfd_reloc_undefined

		if have special_relocation_funciton
			cont = special_relocation_function()
			if cont != continue
				return cont

		<rest of relocation code>

The patch below rearanges this code to be:

		if have special_relocation_funciton
			cont = special_relocation_function()
			if cont != continue
				return cont

		if symbol undefined
			flag = bfd_reloc_undefined

		<rest of relocation code>

Which makes it more obivous to the user that a special_relocation_function()
must check (and possibly return the corresponding status) for undefined
symbols.

					Andrew Cagney


cagney@winnie% rcsdiff -c bfd/reloc.c
===================================================================
RCS file: bfd/RCS/reloc.c,v
retrieving revision 1.1
diff -c -r1.1 bfd/reloc.c
*** /tmp/RCSAa15969     Thu Oct 15 11:00:13 1992
--- bfd/reloc.c Thu Oct 15 10:44:36 1992
***************
*** 452,461 ****
         
    }
  
-   if ((symbol->section == &bfd_und_section) && output_bfd == (bfd *)NULL) {
-     flag = bfd_reloc_undefined;
-   }
- 
    if (howto->special_function) {
      bfd_reloc_status_type cont;
      cont = howto->special_function(abfd,
--- 452,457 ----
***************
*** 465,470 ****
--- 461,470 ----
                                   input_section,
                                   output_bfd);
      if (cont != bfd_reloc_continue) return cont;
+   }
+ 
+   if ((symbol->section == &bfd_und_section) && output_bfd == (bfd *)NULL) {
+     flag = bfd_reloc_undefined;
    }
  
    /* 
Technical Details
Message-ID: <1biu3hINN8p6@huon.itd.adelaide.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.adelaide.EDU.AU!cagney

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.adelaide.EDU.AU!cagney
From: cagney@cs.adelaide.EDU.AU (Andrew Cagney - aka Noid)
Subject: [binutils-2.0/bfd/reloc.c] Make clear what reloc_funcs should do...
Message-ID: <1biu3hINN8p6@huon.itd.adelaide.edu.au>
Sender: gnulists@ai.mit.edu
Reply-To: cagney@cs.adelaide.edu.au (Andrew Cagney - aka Noid)
Organization: Comp Sci, Uni of Adelaide, Australia
Distribution: gnu
Date: Thu, 15 Oct 1992 05:03:45 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 71