I’m building for a Xilinx 7000 Zynq dual ARM processor. I thought the linker was gnu, but now I’m not sure whether it is or not.
I can create a memory section in the linker script, with something like the following (ps7_ram_1 is a shared memory area but that’s not really important here)
.shared_mem (NOLOAD) : {
my_memory = .;
} > ps7_ram_1
From my C program, I can get the address of this with something like;-
extern char* my_memory;
…and sure enough, I can use that pointer to read and write to/from the memory and it’s definitely referring to the expected address (the start of ps7_ram_1
). This is behaving exactly as I would expect.
However, if I want to get the address of the start of .bss, I have to take the address of the __bss_start
name; ie, &__bss_start
(if I just use the name directly, I get zero, which is the contents of the .bss). It’s acting as if __bss_start
is the name of a (I assume? zero-sized) object. If I take the address in this way, I DO get to the start of .bss, but considering __bss_start
and __bss_end
are defined in the same way as my example above, ie;-
__bss_start = .;
…then why aren’t the __bss_start
and __bss_end
names addresses already?