I'm compiling a c file in xv6 and I used their Makefile to compile. I used readelf and found out the ELF it outputs has just one program header.
ryan@ubuntu:~/Documents/xv6-OS-for-arm-v8-fixed/xv6-armv8/usr$ readelf -l _init --wideElf file type is EXEC (Executable file)Entry point 0x0There is 1 program header, starting at offset 64Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000078 0x0000000000000000 0x0000000000000000 0x0011a8 0x0011c0 RWE 0x8 Section to Segment mapping: Segment Sections... 00 .text .rodata .data .bss
This program header has just 4 sections: .text .rodata .data .bss
I checked its CFLAGS and it's showed below:
CROSSCOMPILE := aarch64-none-elf-# try linux eabi# CROSSCOMPILE := arm-linux-gnueabi-CC = $(CROSSCOMPILE)gccAS = $(CROSSCOMPILE)asLD = $(CROSSCOMPILE)ldOBJCOPY = $(CROSSCOMPILE)objcopyOBJDUMP = $(CROSSCOMPILE)objdumpCFLAGS = -march=armv8-a -mtune=cortex-a57 -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g LDFLAGS = -L.ASFLAGS = -march=armv8-a
But I don't know which of these flags make it this way.I'm build a ARM-based OS. How can I compile one of this ELF in ARM by myself?