Re: [uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-19 Thread John Williams
On Tue, May 19, 2009 at 8:32 AM, David McCullough
david_mccullo...@securecomputing.com wrote:

 Jivin John Williams lays it down ...
 Attached is a patch that updates elf2flt support for microblaze:

  * Handling for new reloc type R_MICROBLAZE_32_PCREL_LO (we can just ignore 
 it)
  * remove workarounds for old microblaze linker bugs, fixed in 2.16
  * Tweak configure{.in} to indicate that MicroBlaze needs the
 --disable-emit-relocs switch

 signed-off-by: John Williams john.willi...@petalogix.com

 Applied the elf2flt changes.

Thanks

 Still awaiting a conclusion to the emit-relocs bits discussion :-)

 Seems like MB would be better served with a preset default like Mike
 suggested ?

Yeah - I'm about to go away for a week so this change has slipped off
my priority queue - will look at it when I get back!

Cheers,

John
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-19 Thread David McCullough

Jivin John Williams lays it down ...
 On Tue, May 19, 2009 at 8:32 AM, David McCullough
 david_mccullo...@securecomputing.com wrote:
 
  Jivin John Williams lays it down ...
  Attached is a patch that updates elf2flt support for microblaze:
 
   * Handling for new reloc type R_MICROBLAZE_32_PCREL_LO (we can just 
  ignore it)
   * remove workarounds for old microblaze linker bugs, fixed in 2.16
   * Tweak configure{.in} to indicate that MicroBlaze needs the
  --disable-emit-relocs switch
 
  signed-off-by: John Williams john.willi...@petalogix.com
 
  Applied the elf2flt changes.
 
 Thanks
 
  Still awaiting a conclusion to the emit-relocs bits discussion :-)
 
  Seems like MB would be better served with a preset default like Mike
  suggested ?
 
 Yeah - I'm about to go away for a week so this change has slipped off
 my priority queue - will look at it when I get back!

Ok,  no problems,

Cheers,
Davidm

-- 
David McCullough,  david_mccullo...@securecomputing.com,  Ph:+61 734352815
McAfee - SnapGear  http://www.snapgear.comhttp://www.uCdot.org
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-18 Thread David McCullough

Jivin John Williams lays it down ...
 Attached is a patch that updates elf2flt support for microblaze:
 
  * Handling for new reloc type R_MICROBLAZE_32_PCREL_LO (we can just ignore 
 it)
  * remove workarounds for old microblaze linker bugs, fixed in 2.16
  * Tweak configure{.in} to indicate that MicroBlaze needs the
 --disable-emit-relocs switch
 
 signed-off-by: John Williams john.willi...@petalogix.com

Applied the elf2flt changes.

Still awaiting a conclusion to the emit-relocs bits discussion :-)

Seems like MB would be better served with a preset default like Mike
suggested ?

Thanks,
Davidm


 Index: configure
 ===
 RCS file: /var/cvs/elf2flt/configure,v
 retrieving revision 1.17
 diff -u -r1.17 configure
 --- configure 7 May 2009 23:09:35 -   1.17
 +++ configure 17 May 2009 03:10:00 -
 @@ -1355,7 +1355,7 @@
--disable-FEATURE   do not include FEATURE (same as 
 --enable-FEATURE=no)
--enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-got-check - disable check for GOT (needed on H8)
 - --disable-emit-relocs - don't use the --emit-relocs (-q) linker option
 + --disable-emit-relocs - don't use the --emit-relocs (-q) linker option 
 (needed on MicroBlaze)
--enable-emit-ctor-dtor manually create ctor/dtor list
  
  Optional Packages:
 Index: configure.in
 ===
 RCS file: /var/cvs/elf2flt/configure.in,v
 retrieving revision 1.16
 diff -u -r1.16 configure.in
 --- configure.in  7 May 2009 06:14:27 -   1.16
 +++ configure.in  17 May 2009 03:10:00 -
 @@ -50,7 +50,7 @@
  )
  
  AC_ARG_ENABLE(emit_relocs,
 - [ --disable-emit-relocs - don't use the --emit-relocs (-q) linker 
 option ],
 + [ --disable-emit-relocs - don't use the --emit-relocs (-q) linker 
 option (needed on MicroBlaze)],
   [ emit_relocs=$enableval ],
   [ emit_relocs=yes ]
  )
 Index: elf2flt.c
 ===
 RCS file: /var/cvs/elf2flt/elf2flt.c,v
 retrieving revision 1.57
 diff -u -r1.57 elf2flt.c
 --- elf2flt.c 7 May 2009 06:23:02 -   1.57
 +++ elf2flt.c 17 May 2009 03:10:01 -
 @@ -522,6 +522,7 @@
   {
   case R_MICROBLAZE_NONE:
   case R_MICROBLAZE_64_NONE:
 + case R_MICROBLAZE_32_PCREL_LO:
   continue;
   }
  #endif /* TARGET_microblaze */
 @@ -979,15 +980,11 @@
  the relocation symbol. */
   {
   unsigned char *p = r_mem;
 - uint32_t offset;
   pflags=0x8000;
  
   /* work out the relocation */
   sym_vma = bfd_section_vma(abs_bfd, 
 sym_section);
 - /* grab any offset from the text */
 - offset = (p[2]24) + (p[3]  16) + 
 (p[6]  8) + (p[7]);
 - /* Update the address */
 - sym_addr += offset + sym_vma + 
 q-addend;
 + sym_addr += sym_vma + q-addend;
   /* Write relocated pointer back */
   p[2] = (sym_addr  24)  0xff;
   p[3] = (sym_addr  16)  0xff;
 @@ -1019,36 +1016,21 @@
   case R_MICROBLAZE_32:
   {   
   unsigned char *p = r_mem;
 - unsigned long offset;
  
 - /* grab any offset from the text */
 - offset = (p[0]24) + (p[1]  16) + 
 (p[2]  8) + (p[3]);
   sym_vma = bfd_section_vma(abs_bfd, 
 sym_section);
 - /* This is a horrible kludge.  For some
 -reason, *sometimes* the offset is in
 -both addend and the code.  Detect
 -it, and cancel the effect.  Otherwise
 -the offset gets added twice - ouch.
 -There should be a better test
 -for this condition, based on the
 -BFD data structures */
 - if(offset==q-addend)
 - offset=0;
 -
 - sym_addr += offset + sym_vma + 
 q-addend;
 + sym_addr += sym_vma + q-addend;
   

Re: [uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-17 Thread Mike Frysinger
On Saturday 16 May 2009 23:10:42 John Williams wrote:
 Tweak configure{.in} to indicate that MicroBlaze needs the
 --disable-emit-relocs switch

i dont think it's appropriate to list arch needs in the configure script like 
this.
-mike


signature.asc
Description: This is a digitally signed message part.
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Re: [uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-17 Thread John Williams
On Mon, May 18, 2009 at 7:19 AM, Mike Frysinger vap...@gentoo.org wrote:
 On Saturday 16 May 2009 23:10:42 John Williams wrote:
 Tweak configure{.in} to indicate that MicroBlaze needs the
 --disable-emit-relocs switch

 i dont think it's appropriate to list arch needs in the configure script like
 this.

I was inspired by the similar recommendation for H8 in one of the
other configure args.

Any better way of doing this?  Fact is, if you don't pass this arg, it
is broken for MicroBlaze.

Ultimately I don't care if that part is dropped, the elf2flt.c changes
are what is important.

Cheers,

John
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-17 Thread Mike Frysinger
On Sunday 17 May 2009 23:58:12 John Williams wrote:
 On Mon, May 18, 2009 at 7:19 AM, Mike Frysinger vap...@gentoo.org wrote:
  On Saturday 16 May 2009 23:10:42 John Williams wrote:
  Tweak configure{.in} to indicate that MicroBlaze needs the
  --disable-emit-relocs switch
 
  i dont think it's appropriate to list arch needs in the configure script
  like this.

 I was inspired by the similar recommendation for H8 in one of the
 other configure args.

 Any better way of doing this?  Fact is, if you don't pass this arg, it
 is broken for MicroBlaze.

people dont read documentation.  if we really want arch checks, make it a 
warning in the configure script.
case $emit_relocs:$target_cpu in
yes:microblaze) AC_MSG_WARNING([emitting relocs on your arch will 
break]);; 
esac

and if you want a sane default, then add support for that:
AC_ARG_ENABLE(emit_relocs,
...
[case $target_cpu in
microblaze) emit_relocs=no;;
*) emit_relocs=yes;;
esac]
)
-mike


signature.asc
Description: This is a digitally signed message part.
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

[uClinux-dev] [patch ] elf2flt MicroBlaze update

2009-05-16 Thread John Williams
Attached is a patch that updates elf2flt support for microblaze:

 * Handling for new reloc type R_MICROBLAZE_32_PCREL_LO (we can just ignore it)
 * remove workarounds for old microblaze linker bugs, fixed in 2.16
 * Tweak configure{.in} to indicate that MicroBlaze needs the
--disable-emit-relocs switch

signed-off-by: John Williams john.willi...@petalogix.com

 configure|2 +-
 configure.in |2 +-
 elf2flt.c|   28 +---
 3 files changed, 7 insertions(+), 25 deletions(-)
? microblaze-elf2flt-update.patch
Index: configure
===
RCS file: /var/cvs/elf2flt/configure,v
retrieving revision 1.17
diff -u -r1.17 configure
--- configure	7 May 2009 23:09:35 -	1.17
+++ configure	17 May 2009 03:10:00 -
@@ -1355,7 +1355,7 @@
   --disable-FEATURE   do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --disable-got-check - disable check for GOT (needed on H8)
- --disable-emit-relocs - don't use the --emit-relocs (-q) linker option
+ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option (needed on MicroBlaze)
   --enable-emit-ctor-dtor manually create ctor/dtor list
 
 Optional Packages:
Index: configure.in
===
RCS file: /var/cvs/elf2flt/configure.in,v
retrieving revision 1.16
diff -u -r1.16 configure.in
--- configure.in	7 May 2009 06:14:27 -	1.16
+++ configure.in	17 May 2009 03:10:00 -
@@ -50,7 +50,7 @@
 )
 
 AC_ARG_ENABLE(emit_relocs,
-	[ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option ],
+	[ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option (needed on MicroBlaze)],
 	[ emit_relocs=$enableval ],
 	[ emit_relocs=yes ]
 )
Index: elf2flt.c
===
RCS file: /var/cvs/elf2flt/elf2flt.c,v
retrieving revision 1.57
diff -u -r1.57 elf2flt.c
--- elf2flt.c	7 May 2009 06:23:02 -	1.57
+++ elf2flt.c	17 May 2009 03:10:01 -
@@ -522,6 +522,7 @@
 			{
 			case R_MICROBLAZE_NONE:
 			case R_MICROBLAZE_64_NONE:
+			case R_MICROBLAZE_32_PCREL_LO:
 continue;
 			}
 #endif /* TARGET_microblaze */
@@ -979,15 +980,11 @@
 		   the relocation symbol. */
 {
 	unsigned char *p = r_mem;
-	uint32_t offset;
 	pflags=0x8000;
 
 	/* work out the relocation */
 	sym_vma = bfd_section_vma(abs_bfd, sym_section);
-	/* grab any offset from the text */
-	offset = (p[2]24) + (p[3]  16) + (p[6]  8) + (p[7]);
-	/* Update the address */
-	sym_addr += offset + sym_vma + q-addend;
+	sym_addr += sym_vma + q-addend;
 	/* Write relocated pointer back */
 	p[2] = (sym_addr  24)  0xff;
 	p[3] = (sym_addr  16)  0xff;
@@ -1019,36 +1016,21 @@
 case R_MICROBLAZE_32:
 {	
 	unsigned char *p = r_mem;
-	unsigned long offset;
 
-	/* grab any offset from the text */
-	offset = (p[0]24) + (p[1]  16) + (p[2]  8) + (p[3]);
 	sym_vma = bfd_section_vma(abs_bfd, sym_section);
-	/* This is a horrible kludge.  For some
-	   reason, *sometimes* the offset is in
-	   both addend and the code.  Detect
-	   it, and cancel the effect.  Otherwise
-	   the offset gets added twice - ouch.
-	   There should be a better test
-	   for this condition, based on the
-	   BFD data structures */
-	if(offset==q-addend)
-		offset=0;
-
-	sym_addr += offset + sym_vma + q-addend;
+	sym_addr += sym_vma + q-addend;
 	relocation_needed = 1;
 	break;
 }
 case R_MICROBLAZE_64_PCREL:
 	sym_vma = 0;
-	//sym_addr = (*(q-sym_ptr_ptr))-value;
 	sym_addr += sym_vma + q-addend;
 	sym_addr -= (q-address + 4);
 	sym_addr = htonl(sym_addr);
 	/* insert 16 MSB */
-	* ((unsigned short *) (r_mem+2)) |= (sym_addr)  0x;
+	* ((unsigned short *) (r_mem+2)) = (sym_addr)  0x;
 	/* then 16 LSB */
-	* ((unsigned short *) (r_mem+6)) |= (sym_addr  16)  0x;
+	* ((unsigned short *) (r_mem+6)) = (sym_addr  16)  0x;
 	/* We've done all the work, so continue
 	   to next reloc instead of break */
 	continue;
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev