]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Correct -Ue output for nm, objdump and readelf
authorAndrew C Aitchison <github@aitchison.me.uk>
Tue, 9 Sep 2025 10:06:42 +0000 (12:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 9 Sep 2025 10:06:42 +0000 (12:06 +0200)
..., like PR33360 does for strings.

Signed-off-by: Andrew C Aitchison <github@aitchison.me.uk>
binutils/nm.c
binutils/objdump.c
binutils/readelf.c

index c3d118a93c3833bb4ebcae56be4508fc298250ec..4ea5c1190e75634a8127dbf9b7f993761a7bc94c 100644 (file)
@@ -566,8 +566,8 @@ display_utf8 (const unsigned char * in, char * out, unsigned int * consumed)
 
        case 4:
          out += sprintf (out, "\\u%02x%02x%02x",
-                 ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
-                 ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
+                 ((in[0] & 0x07) << 2) | ((in[1] & 0x30) >> 4),
+                 ((in[1] & 0x0f) << 4) | ((in[2] & 0x3c) >> 2),
                  ((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
          break;
        default:
index ee8823da05a6dee88690a4c6a2eb016644b93567..513f6162204fa5d97d6803c881114dbbb1f3c783 100644 (file)
@@ -659,8 +659,8 @@ display_utf8 (const unsigned char * in, char * out, unsigned int * consumed)
 
        case 4:
          out += sprintf (out, "\\u%02x%02x%02x",
-                 ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
-                 ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
+                 ((in[0] & 0x07) << 2) | ((in[1] & 0x30) >> 4),
+                 ((in[1] & 0x0f) << 4) | ((in[2] & 0x3c) >> 2),
                  ((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
          break;
        default:
index 10f81779d09ee428e937bb297006522dbe1674d1..8162cbb70033755015b9e173340606c1086e23eb 100644 (file)
@@ -848,8 +848,8 @@ print_symbol_name (signed int width, const char * symbol)
                  if (width_remaining < 8)
                    break;
                  printf ("\\u%02x%02x%02x",
-                         ((bytes[0] & 0x07) << 6) | ((bytes[1] & 0x3c) >> 2),
-                         ((bytes[1] & 0x03) << 6) | ((bytes[2] & 0x3c) >> 2),
+                         ((bytes[0] & 0x07) << 2) | ((bytes[1] & 0x30) >> 4),
+                         ((bytes[1] & 0x0f) << 4) | ((bytes[2] & 0x3c) >> 2),
                          ((bytes[2] & 0x03) << 6) | (bytes[3] & 0x3f));
 
                  break;