Relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object

Hello,

I’m trying exercise 2 of x86-64 assembly. I don’t know what I’m doing wrong. I’m just beginning the exercise; it is far from complete.

/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: leap.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:32: tests] Error 1

Here is the code:

section .rodata
    fl:  dw 4.0
    fl2: dw 4.0

section .text
global leap_year
leap_year:
    ; Provide your implementation here
    fld   dword [fl]
    fdiv  dword [fl2]
    ret

Type default rel at the very beginning of source code.

Due to compile option used here, you should use RIP-relative address when you want to access data from label.