[Bug binutils/13051] windres fails on reading VERSIONINFO with multiple language BLOCKS

2011-08-18 Thread player1 at onet dot eu
http://sourceware.org/bugzilla/show_bug.cgi?id=13051

--- Comment #6 from Chris  2011-08-18 17:34:20 UTC ---
Hi Nick,

I understand you need the copyright assignment so the patch code is now
released under the GPLv3 licence.

I created a ChangeLog entry, test files and cleaned the code up. Now the latest
Microsoft Windows RC compiler and patched version of windres generate identical
binary structures of VERSIONINFO resource. Changes to the source code I made
are minimal and not that complicated. :)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/13051] windres fails on reading VERSIONINFO with multiple language BLOCKS

2011-08-18 Thread player1 at onet dot eu
http://sourceware.org/bugzilla/show_bug.cgi?id=13051

--- Comment #5 from Chris  2011-08-18 17:29:51 UTC ---
Created attachment 5905
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5905
patch source

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/13051] windres fails on reading VERSIONINFO with multiple language BLOCKS

2011-08-18 Thread player1 at onet dot eu
http://sourceware.org/bugzilla/show_bug.cgi?id=13051

Chris  changed:

   What|Removed |Added

   Attachment #5871|0   |1
is obsolete||

--- Comment #4 from Chris  2011-08-18 17:25:36 UTC ---
Created attachment 5904
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5904
windres patch to solve the VERSIONINFO bug GPLv3

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


RFA: gas/cgen.[ch]: Make it easier to generate pc-relative relocations

2011-08-18 Thread Joern Rennecke


I find that it is currently too hard to get pc-relative relocations
right in a cgen-generated gas.  E.g. look at testsuite/ld-elf/merge* .

When the bfd_reloc_code_real_type of a fragment is selected, it is not
known if the fragment is pc-relative or not.
You could define tc_gen_reloc to your own function that parses the
expression to find out if it is pc-relative and do the right thing then,
but that would require a lot of duplicated code for each target,
and defeat the purpose of having gas_cgen_tc_gen_reloc.

With the appended patch, tc-.h only has to do
#define GAS_CGEN_PCREL_R_TYPE(R_TYPE) gas_cgen_pcrel_r_type(R_TYPE)
to handle the vanilla pc-relative relocations.
If a few pc-relative relocations need different handling, that should
also be easily accomplished with a wrapper function.

2011-08-06  Joern Rennecke 

* cgen.c (gas_cgen_pcrel_r_type): New function.
(gas_cgen_tc_gen_reloc): Check for GAS_CGEN_PCREL_R_TYPE.
* cgen.h (gas_cgen_pcrel_r_type): Declare.

Index: cgen.c
===
--- cgen.c  (revision 2024)
+++ cgen.c  (revision 2025)
@@ -1018,6 +1018,32 @@ gas_cgen_md_apply_fix (fixP, valP, seg)
   fixP->fx_addnumber = value;
 }
 
+bfd_reloc_code_real_type
+gas_cgen_pcrel_r_type (bfd_reloc_code_real_type r)
+{
+  switch (r)
+{
+case BFD_RELOC_8:
+  r = BFD_RELOC_8_PCREL;
+  break;
+case BFD_RELOC_16:
+  r = BFD_RELOC_16_PCREL;
+  break;
+case BFD_RELOC_24:
+  r = BFD_RELOC_24_PCREL;
+  break;
+case BFD_RELOC_32:
+  r = BFD_RELOC_32_PCREL;
+  break;
+case BFD_RELOC_64:
+  r = BFD_RELOC_64_PCREL;
+  break;
+default:
+  break;
+}
+  return r;
+}
+
 /* Translate internal representation of relocation info to BFD target format.
 
FIXME: To what extent can we get all relevant targets to use this?  */
@@ -1027,10 +1053,16 @@ gas_cgen_tc_gen_reloc (section, fixP)
  asection * section ATTRIBUTE_UNUSED;
  fixS * fixP;
 {
+  bfd_reloc_code_real_type r_type = fixP->fx_r_type;
   arelent *reloc;
+
   reloc = (arelent *) xmalloc (sizeof (arelent));
 
-  reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
+#ifdef GAS_CGEN_PCREL_R_TYPE
+  if (fixP->fx_pcrel)
+r_type = GAS_CGEN_PCREL_R_TYPE (r_type);
+#endif
+  reloc->howto = bfd_reloc_type_lookup (stdoutput, r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
 {
   as_bad_where (fixP->fx_file, fixP->fx_line,
Index: cgen.h
===
--- cgen.h  (revision 2024)
+++ cgen.h  (revision 2025)
@@ -80,6 +80,8 @@ extern fixS * gas_cgen_record_fixup_exp 
 int, const CGEN_OPERAND *, int,
 expressionS *);
 
+extern bfd_reloc_code_real_type gas_cgen_pcrel_r_type 
(bfd_reloc_code_real_type);
+
 /* md_apply_fix handler */
 extern void gas_cgen_md_apply_fix (fixS *, valueT *, segT);
 
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils