This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/4] pe/coff: Display GUID build-id in the conventional way


bfd/ChangeLog:

2014-04-10  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* peXXigen.c (pe_print_debugdata): Display GUID build-id in the
	conventional way

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 bfd/peXXigen.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index ea7846f..ebb80b1 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -2435,7 +2435,20 @@ pe_print_debugdata (bfd * abfd, void * vfile)
 					       idd.SizeOfData, cvinfo))
             continue;
 
-          for (i = 0; i < cvinfo->SignatureLength; i++)
+          /* The standard way to display a GUID seems to be as 4,2,2 bytes in
+             host order, followed by 8 single bytes, which we adopt for
+             consistency with other tools.  Display non-GUID signatures as a
+             sequence of bytes. */
+          i = 0;
+          if (cvinfo->SignatureLength >= CV_INFO_SIGNATURE_LENGTH)
+            {
+              char *guid = &(cvinfo->Signature[0]);
+              sprintf (signature, "%08x", *(uint32_t *)(guid));
+              sprintf (signature + 8, "%04x", *(uint16_t *)(guid + 4));
+              sprintf (signature + 12, "%04x", *(uint16_t *)(guid + 6));
+              i = 8;
+            }
+          for (; i < cvinfo->SignatureLength; i++)
             sprintf (&signature[i*2], "%02x", cvinfo->Signature[i] & 0xff);
 
           fprintf (file, "(format %c%c%c%c signature %s age %ld)\n",
-- 
1.8.3.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]