Delphi Error – E2111 Cannot add or subtract relocatable symbols

Delphi Compiler Error

E2111 Cannot add or subtract relocatable symbols

Reason for the Error & Solution

The inline assembler is not able to add or subtract memory address which may be changed by the linker.

program Produce;

  var
    a : array [1..10] of Integer;
    endOfA : Integer;

  procedure Relocatable;
  begin
  end;

  procedure Assembly;
  asm
    mov eax, a + endOfA
  end;

begin
end.

Global variables fall into the class of items which produce relocatable addresses, and the inline assembler is unable to add or subtract these.

Make sure you don’t try to add or subtract relocatable addresses from within your inline assembler statements.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...