[Solved] Generating PIC, but reference is not PIC-safe lazarus / 32-Linux ---------------------------------------------------------------------- Fred vS · 2021-10-22 17:27 Hello. I am able to use -k-pie -k-znow -Cg for all my projects thanks to fpc 3.3.1. and create a pie executable. But in a project that uses asm code there is that error at linking: QuoteGenerating PIC, but reference is not PIC-safe This point to 2 asm lines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure teefo.MemWD;  var    f : byte;begin gev.wd := 0;for f := 0 to 6 do if ListWD[f] then gev.wd := gev.wd or (1 shl f); if tun.engtrue_calend_fmt then begin asm     push ax     mov  al, gev.wd  // This line point to gev.wd     mov  ah, al     and  al, Byte(1{bit1})     shl  al, 7     or   ah, al     ror  ah, 1     mov  gev.wd, ah  // This line point to gev.wd     pop  ax end; end;end; If, for workaround, those 2 lines are commented, the compilation + link is ok. Sadly my asm knowledge are too poor and I dont see how to fix it. Does somebody have a idea? Thanks. Fre;D ---------------------------------------------------------------------- Fred vS · 2021-10-22 17:55 Hello. OK, solved using a temp variable: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure teefo.MemWD;  var    f, wdtmp : byte;   begin gev.wd := 0;wdtmp := gev.wd; for f := 0 to 6 do if ListWD[f] thenbegin gev.wd := gev.wd or (1 shl f); wdtmp := gev.wd;end;   if tun.engtrue_calend_fmt then begin asm     push ax     mov  al, wdtmp     mov  ah, al     and  al, Byte(1{bit1})     shl  al, 7     or   ah, al     ror  ah, 1     mov  wdtmp, ah     pop  ax end; end;end; Sorry for the noise. Fre;D