x86 Assembly: cannot use more than one symbol in memory operand
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Example code: https://godbolt.org/z/1TY9qrK3f
I am attempting to write a code sequence for getting the pc-relative offset on 32-bit x86. On GNU AS, it is correct to write `OFFSET foo-bar` (where `bar` is a symbol with a known offset - the result is emitting an `R_386_PC32` relocation, of which I can see no other way to coerce an assembler into generating). On llvm-mc and the llvm internal assembler (when used for inline assembly), you get the error "cannot use more than one symbol in memory operand", which is both a wierd diagnostic (given that its an OFFSET operand, not a memory operand) and an incompatibility with GNU AS, which makes the assembly language less expressive.
Contributor guide
Research direction
Start by reproducing the Godbolt example with llvm-mc and the LLVM internal assembler, then compare the result with GNU AS for `OFFSET foo-bar`. Trace the assembler handling of this operand and verify that the valid two-symbol expression is accepted and produces the expected R_386_PC32 relocation.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100