wrong address
Posted: Sat Jan 29, 2005 1:01 pm
Hi!
I've got this code:
Which displays 442* and FFFFFFFC, the first address is correct but the second isn't, so why do variables in functions get incorrect addresses?
This is my linker script:
And this is how I compile:
I'm posting in this forum because I'm loading it into my OS as a module.
I've got this code:
Code: Select all
int gtest;
int main() {
int test;
printf("%x, %x", >est, &test);
return 0;
}
This is my linker script:
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(main)
OUTPUT("test")
SECTIONS {
.text 0x44200000: {
*(.text)
}
.data : {
*(.data)
}
.rodata : {
*(.rodata)
}
.bss : {
*(.bss)
}
}
Code: Select all
CFLAGS = -Wall -nostdlib -nostartfiles -fno-builtin -fwritable-strings -Isrc/include
OBJS = src/main.o
all: $(OBJS)
%.o:%.c
$(CC) $(CFLAGS) -o $@ -c $<
all:
$(LD) $(OBJS) -T link.ld