Rewrite of relocation code