I want to enclose an entire C file in a output section,
Here is the example code I am trying:
#include<stdio.h>
#pragma arm section code = ".sec_ro"
int main(void)
{
printf("Hi\n");
}
#pragma arm section
I used :
arm-none-linux-gnueabi-gcc -S hello.c
to get the .S file.
But it looks like the sec_ro
section is not present in the .S file.
EDIT/UPDATE :
Attaching the .s file contents :
.arch armv5te
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 6
.eabi_attribute 18, 4
.file "hello.c"
.section .rodata
.align 2
.LC0:
.ascii "Hi\000"
.text
.align 2
.global main
.type main, %function
main:
.fnstart
.LFB0:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
stmfd sp!, {fp, lr}
.save {fp, lr}
.setfp fp, sp, #4
add fp, sp, #4
ldr r0, .L2
bl puts
mov r0, r3
ldmfd sp!, {fp, pc}
I want to enclose an entire C file to create an output section , I am using GNU ARM tool chain, Am I missing something ?