Bug 30953 - Objdump cuts 32bit displacements for AVX instructions
Summary: Objdump cuts 32bit displacements for AVX instructions
Status: RESOLVED NOTABUG
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-09 15:40 UTC by Guinevere Larsen
Modified: 2023-10-09 16:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guinevere Larsen 2023-10-09 15:40:31 UTC
Compiling the following program with gcc:

int global = 1;

int main() {
    asm("vmovd %0, %%xmm0": "=m"(global) : : "xmm0");
    return 0;
}

And examining with objump -d, I get the following disassembly for the main function:

0000000000401106 <main>:
  401106:       55                      push   %rbp
  401107:       48 89 e5                mov    %rsp,%rbp
  40110a:       c5 f9 6e 05 0a 2f 00    vmovd  0x2f0a(%rip),%xmm0        # 40401c <global>
  401111:       00 
  401112:       b8 00 00 00 00          mov    $0x0,%eax
  401117:       5d                      pop    %rbp
  401118:       c3                      ret    

notice how byte 401111 is a single null byte. That byte is part of the 32 bit displacement for the vmovd instruction, and should be printed in the same line.

Results obtained with:
$ objdump -v
GNU objdump version 2.38-27.fc37
Comment 1 Nick Clifton 2023-10-09 16:22:07 UTC
Hi Guinevere,

>   40110a:       c5 f9 6e 05 0a 2f 00    vmovd  0x2f0a(%rip),%xmm0        #
> 40401c <global>
>   401111:       00 

> notice how byte 401111 is a single null byte. That byte is part of the 32
> bit displacement for the vmovd instruction, and should be printed in the
> same line.

AH - you have run into the 'objdump defaults to 80 column maximum output width' issue.  Please try rerunning your disassembly with --wide (or just -w) added to the command line:

  $ objdump -d fred.o --wide
[...] 
   4:	c5 f9 6e 05 00 00 00 00 	vmovd  0x0(%rip),%xmm0        # c <main+0xc>
   c:	b8 00 00 00 00       	mov    $0x0,%eax
[...]

Cheers
  Nick