3
\$\begingroup\$

The .bss section is simply a way of saying 'I want this amount of space beforehand'

You cannot store extra information in the section, it's entire purpose is preallocating space, and it does not allow initializing the data beforehand.

Should the size of the .bss section count against the score?

This is aimed at x86 Assembly answers, and probably isn't applicable towards C/C++/Jelly/Brainfuck and others.

\$\endgroup\$
7
\$\begingroup\$

Yes, it should

This answer is very generic and does not apply to x86 exclusively, but rather to assembly in general.

For assembly source code

All statements in the .bss section are definitely part of the source code and are similar to -- say -- array declarations in other languages. The program can't possibly compile without them.

For executable dumps

The .bss section will basically be stored as a total size to be allocated at runtime. It's a small overhead but, again, the program could not work without this information.

\$\endgroup\$
  • \$\begingroup\$ For executable dumps, how would you get the size. I assume they should just be counted using wc -c? \$\endgroup\$ – moonheart08 Apr 23 '18 at 21:59
  • \$\begingroup\$ @moonheart08 I believe that only a full program is allowed in case of a machine code submission. So your total size would include the size of the minimal executable boilerplate, which in turn contains the size of the .bss section if applicable. Here is a related question. \$\endgroup\$ – Arnauld Apr 23 '18 at 22:07
  • 5
    \$\begingroup\$ I have answered with x86 machine code anonymous functions before, which makes perfect sense to me. If that chunk of bytes is loaded into memory somewhere, then it works perfectly to simply to call <address>. Of course, if your code requires .bss storage, then the idea of an anonymous x86 function hardly makes sense anymore. \$\endgroup\$ – feersum Apr 24 '18 at 15:43
  • 1
    \$\begingroup\$ @feersum I agree (and submitted a couple of anonymous CP1610 functions myself). In my previous comment, I should have said in case of a machine code submission using .bss storage (or any other resource or information provided at runtime that needs to be described). \$\endgroup\$ – Arnauld Apr 24 '18 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .