The problem was solved by rearranging the sections. After I placed the .data section before the .text section in the linkerscript.