* PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff
@ 2005-02-22 0:15 H. J. Lu
2005-02-22 9:34 ` Alan Modra
0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2005-02-22 0:15 UTC (permalink / raw)
To: binutils
TI relocation has a r_reserved field. But we never initialize it and
we get some random values. This patch makes sure that it is always
initialized.
H.J.
----
bfd/
2005-02-21 H.J. Lu <hongjiu.lu@intel.com>
* coffcode.h (coff_write_relocs): Clear the r_reserved field
if COFF_REL_HAS_R_RESERVED is defined before swapping out
relocation.
include/coff/
2005-02-21 H.J. Lu <hongjiu.lu@intel.com>
* ti.h (COFF_REL_HAS_R_RESERVED): Defined.
* tic80.h (COFF_REL_HAS_R_RESERVED): Defined.
--- binutils/bfd/coffcode.h.ti 2005-02-21 10:18:36.000000000 -0800
+++ binutils/bfd/coffcode.h 2005-02-21 13:03:05.178091748 -0800
@@ -2510,6 +2510,10 @@ coff_write_relocs (abfd, first_undef)
if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
return FALSE;
+#ifdef COFF_REL_HAS_R_RESERVED
+ memset (&dst.r_reserved, 0, sizeof (dst.r_reserved));
+#endif
+
#ifdef COFF_WITH_PE
if (obj_pe (abfd) && s->reloc_count >= 0xffff)
{
--- binutils/include/coff/ti.h.ti 2003-08-07 09:02:59.000000000 -0700
+++ binutils/include/coff/ti.h 2005-02-21 12:49:58.767373577 -0800
@@ -441,6 +441,9 @@ union external_auxent {
/********************** RELOCATION DIRECTIVES **********************/
+/* Relocation has r_reserved. */
+#define COFF_REL_HAS_R_RESERVED 1
+
struct external_reloc_v0
{
char r_vaddr[4];
--- binutils/include/coff/tic80.h.ti 2001-03-15 15:06:40.000000000 -0800
+++ binutils/include/coff/tic80.h 2005-02-21 12:50:23.729673155 -0800
@@ -81,6 +81,9 @@ struct external_scnhdr
/********************** RELOCATION DIRECTIVES **********************/
+/* Relocation has r_reserved. */
+#define COFF_REL_HAS_R_RESERVED 1
+
/* The external reloc has an offset field, because some of the reloc
types on the h8 don't have room in the instruction for the entire
offset - eg the strange jump and high page addressing modes. */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff
2005-02-22 0:15 PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff H. J. Lu
@ 2005-02-22 9:34 ` Alan Modra
2005-02-22 18:45 ` Nick Clifton
0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2005-02-22 9:34 UTC (permalink / raw)
To: H. J. Lu; +Cc: binutils
> * coffcode.h (coff_write_relocs): Clear the r_reserved field
> if COFF_REL_HAS_R_RESERVED is defined before swapping out
> relocation.
This should really be done by defining a coff_SWAP_reloc_out function
for these targets. I'm not disapproving of the patch since the coff
support is already a mess of macros, but I'm not willing to approve
the patch myself..
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff
2005-02-22 9:34 ` Alan Modra
@ 2005-02-22 18:45 ` Nick Clifton
2005-02-23 8:03 ` H. J. Lu
0 siblings, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2005-02-22 18:45 UTC (permalink / raw)
To: Alan Modra; +Cc: H. J. Lu, binutils
Hi Alan, Hi H.J.
>> * coffcode.h (coff_write_relocs): Clear the r_reserved field
>> if COFF_REL_HAS_R_RESERVED is defined before swapping out
>> relocation.
> This should really be done by defining a coff_SWAP_reloc_out function
> for these targets.
I agree with Alan - why not define the SWAP_OUT_RELOC_EXTRA macro for
the tic54x-coff port and have that write out zeros for the r_reserved
field ?
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff
2005-02-22 18:45 ` Nick Clifton
@ 2005-02-23 8:03 ` H. J. Lu
2005-02-23 14:20 ` Nick Clifton
0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2005-02-23 8:03 UTC (permalink / raw)
To: Nick Clifton; +Cc: Alan Modra, binutils
On Tue, Feb 22, 2005 at 04:28:51PM +0000, Nick Clifton wrote:
> Hi Alan, Hi H.J.
>
> >> * coffcode.h (coff_write_relocs): Clear the r_reserved field
> >> if COFF_REL_HAS_R_RESERVED is defined before swapping out
> >> relocation.
>
> >This should really be done by defining a coff_SWAP_reloc_out function
> >for these targets.
>
> I agree with Alan - why not define the SWAP_OUT_RELOC_EXTRA macro for
> the tic54x-coff port and have that write out zeros for the r_reserved
> field ?
>
Here is the patch.
H.J.
----
2005-02-22 H.J. Lu <hongjiu.lu@intel.com>
* coff-tic54x.c (SWAP_OUT_RELOC_EXTRA): Defined.
* coff-tic80.c (SWAP_OUT_RELOC_EXTRA): Likewise.
--- bfd/coff-tic54x.c.ti 2004-08-12 20:15:56.000000000 -0700
+++ bfd/coff-tic54x.c 2005-02-22 16:01:59.728220997 -0800
@@ -328,6 +328,15 @@ ticoff_bfd_is_local_label_name (abfd, na
#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
+/* Clear the r_reserved field in relocs. */
+#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
+ do \
+ { \
+ dst->r_reserved[0] = 0; \
+ dst->r_reserved[1] = 0; \
+ } \
+ while (0)
+
/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
and COFF0 vectors use custom _bad_format_hook procs instead of setting
--- bfd/coff-tic80.c.ti 2004-11-05 14:41:32.000000000 -0800
+++ bfd/coff-tic80.c 2005-02-22 15:41:06.000000000 -0800
@@ -714,6 +714,15 @@ coff_tic80_relocate_section (output_bfd,
return TRUE;
}
\f
+/* Clear the r_reserved field in relocs. */
+#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
+ do \
+ { \
+ dst->r_reserved[0] = 0; \
+ dst->r_reserved[1] = 0; \
+ } \
+ while (0)
+
#define TIC80COFF 1 /* Customize coffcode.h */
#undef C_AUTOARG /* Clashes with TIc80's C_UEXT */
#undef C_LASTENT /* Clashes with TIc80's C_STATLAB */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff
2005-02-23 8:03 ` H. J. Lu
@ 2005-02-23 14:20 ` Nick Clifton
0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2005-02-23 14:20 UTC (permalink / raw)
To: H. J. Lu; +Cc: Alan Modra, binutils
Hi H. J.
> 2005-02-22 H.J. Lu <hongjiu.lu@intel.com>
>
> * coff-tic54x.c (SWAP_OUT_RELOC_EXTRA): Defined.
> * coff-tic80.c (SWAP_OUT_RELOC_EXTRA): Likewise.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-23 10:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-22 0:15 PATCH: Fix "FAIL: objcopy (simple copy)" for tic54x-coff H. J. Lu
2005-02-22 9:34 ` Alan Modra
2005-02-22 18:45 ` Nick Clifton
2005-02-23 8:03 ` H. J. Lu
2005-02-23 14:20 ` Nick Clifton
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).