Comment 2 for bug 1523315

Revision history for this message
Justin (ckc1222) wrote :

Hi Andre:

      It 's great to hear your reply.

      Yes , you are right. "123" , "234", "456" will be in .rodata. But in case of PIC application, sometimes we may need GOT or data.rel.* to achieve the PIC (position independent code) requirement.

      At compile time, you can specify any default address to compile and work fine. But, in case of PIC application, you may want to load binary into non-default address, then you need to do data and code relocation. That means you need to change the address of "123" , "234", "456" during the runtime. So data.rel.* and GOT section can help to do this, if every data access reference the data.rel.* and GOT. you can relocate the "123", "234", "456" at runtime.

     BTW, my compile command is listed in below

      /projects/ntsw-tools/gnu/gcc-arm-none-eabi-4_8-2014q1/bin/arm-none-eabi-gcc -g -std=gnu99 -Wunused -Wall -Werror -fpic -msingle-pic-base -mno-pic-data-is-text-relative -ffunction-sections -fdata-sections -msoft-float -mtpcs-frame -mlittle-endian -fno-builtin -fms-extensions -D__ARM__ -mthumb -mcpu=cortex-r4 -Wa,-meabi=5 -MP -MD -o test.o test.c -c