This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gcc segment usage

Note: This was originally posted on 17th April 2011 at http://forums.arm.com

Hi!

With gcc, we have 4 segment:
.rodata : readonly data
.data : initialized global var
.bss : uninitialized global var
.text : assembler code source

To use ADR opcode, you have to put your data into .text segment.

For example


main:
    push {r7, lr}
    adr r0, .myString
    bl printf
    mov r0, #0
    pop {r7, pc}

.myString:
.asciz "Hello\n"


I'd like to know (to be sure in fact) if you can't write into .text segment.
Ie, you can't write into r0 after the ADR instruction !

Can anybody confirm me that .text segment is read only ?
0