.bss VS .data

.bss is a "section [that] is guaranteed to be all zeros when the program is loaded into memory". That's a section that will always contain 0s when loaded, hence its content does not have to be stored.

.data is a section that's stored in the ELF, and need to be read upon loading.

Moving values to .data

Initializing a global variable with something else than 0 means moving it from .bss to .data.

So if you're doing; e.g:

static int8_t buffer[1024] = {1};

what you're actually doing is moving it from .bss to .data.

A reason to do that would be to ensure that the data gets initialized to 0s even if .bss initialization is skipped, which you could be willing to do if this section's initialization was really slow on some hardware.

Implications on PSX

On PSX, .bss initialization is slow :

Nicolas Noble:

DMA (.data) versus a byte-wise memset (.bss) ; a byte-wise memset that's running off the bios ROM, that takes about 20 cycles per instructions therefore takes about 40 cycles per byte to set to 0.

On the other hand, initializating from .data, you have to take into account the PSX's slow CDROM speed.

Source

https://discord.com/channels/642647820683444236/663664210525290507/868225849202208838
https://stackoverflow.com/a/16557776