Knowledge

.bss

Source đź“ť

211:, statically allocated objects without an explicit initializer are initialized to zero (for arithmetic types) or a null pointer (for pointer types). Implementations of C typically represent zero values and null pointer values using a bit pattern consisting solely of zero-valued bits (despite filling bss with zero is not required by the C standard, all variables in .bss are required to be individually initialized to some sort of zeroes according to Section 6.7.8 of C ISO Standard 9899:1999 or section 6.7.9 for newer standards). Hence, the BSS segment typically includes all uninitialized objects (both variables and 140: 243:, a C programmer and author, says, "Some people like to remember it as 'Better Save Space'. Since the BSS segment only holds variables that don't have any value yet, it doesn't actually need to store the image of these variables. The size that BSS will require at runtime is recorded in the object file, but BSS (unlike the data segment) doesn't take up any actual space in the object file." 236:
must be initialized at declaration, however, as they do not have a separate declaration, and thus are typically not in the BSS section, though they may be implicitly or explicitly initialized to zero. An implementation may also assign statically-allocated variables and constants initialized with a
259:
instruction sets, limit offsets, in instructions that access this segment, to 32 bits, limiting its size to 2 GB or 4 GB. Also, note that Fortran does not require static data to be initialized to zero. On those systems where the bss segment is initialized to zero, putting common
99:
statically allocated variables that are initialized to all zero bits. Operating systems may use a technique called zero-fill-on-demand to efficiently implement the bss segment. In embedded software, the bss segment is mapped into memory that is initialized to zero by the C
191:. In this situation BSS served as a shorthand in place of individually reserving a number of separate smaller data locations. Some assemblers support a complementary or alternative directive 123:
segment for "small data". Typically, these data items can be accessed using shorter instructions that may only be able to access a certain range of addresses. Architectures supporting
108:
is entered. Some C run-time systems may allow part of the bss segment not to be initialized; C variables must explicitly be placed into that portion of the bss segment.
460: 260:
block variables and other static data into that segment guarantees that it will be zero, but for portability, programmers should not depend on that.
514: 621: 76:
allocates memory for the bss section when it loads the program. By placing variables with no value in the .bss section, instead of the
31: 386: 143:
This shows the typical layout of a simple computer's program memory with the text, various data, and stack and heap sections.
65:
that are declared but have not been assigned a value yet. It is often referred to as the "bss section" or "bss segment".
468: 587: 398: 606: 212: 184: 532: 357: 229: 187:
computers. It defined a label (i.e. symbol) and reserved a block of uninitialized space for a given number of
550: 116: 616: 17: 611: 160: 156: 324: 208: 176: 92: 339: 319: 304: 284: 164: 490: 445: 425: 216: 112: 80:
or .rodata section which require initial value data, the size of the object file is reduced.
572: 240: 124: 38: 8: 579: 567: 312: 269: 583: 427:
IBM 7090/7094 IBSYS Operating System Version 13 Macro Assembly Program (MAP) Language
308: 58: 256: 225: 188: 172: 101: 62: 255:, common block variables are allocated in this segment. Some compilers may, for 220: 215:) declared at file scope (i.e., outside any function) as well as uninitialized 73: 600: 83:
On some platforms, some or all of the bss section is initialized to zeroes.
68:
Typically only the length of the bss section, but no data, is stored in the
279: 274: 199:, where the specified symbol corresponds to the end of the reserved block. 77: 69: 54: 139: 502: 84: 555:
Using the GNU Compiler Collection (GCC) – GCC 7.2.0
537:
Using the GNU Compiler Collection (GCC) – GCC 7.2.0
519:
Using the GNU Compiler Collection (GCC) – GCC 7.2.0
252: 168: 88: 237:
value consisting solely of zero-valued bits to the BSS section.
131:
section for uninitialized, static data marked as thread-local.
91:
initialize the bss section to zero, which can thus be used for
96: 32:
Service set (802.11 network) § Basic service sets (BSSs)
458: 387:
Coding for the MIT-IBM 704 Computer October 1957, p. V-10
180: 27:
Code section for declared statically-allocated variables
313:"A New Virtual Memory Implementation for Berkeley UNIX" 503:
How does Fortran 77 allocate common-block variables?
400:
FORTRAN ASSEMBLY PROGRAM (FAP) for the IBM 709/7090
571: 30:For a Basic Service Set (BSS) in a Wi-Fi LAN, see 318:. University of California, Berkeley. p. 3. 163:(United Aircraft Symbolic Assembly Program), the 598: 303: 175:. The BSS keyword was later incorporated into 574:Advanced Programming in the Unix Environment 362:Linux Standard Base PDA Specification 3.0RC1 171:by Roy Nutt, Walter Ramshaw, and others at 446:"Unix - Frequently Asked Questions (1/7)" 323: 179:(FAP) and Macro Assembly Program (MAP), 138: 566: 14: 599: 465:Using as: Using as, the Gnu Assembler 443: 491:Expert C Programming: Deep C Secrets 622:Programming language implementation 406:. IBM. 1961. p. 30. J28-6098-1 167:developed in the mid-1950s for the 24: 418: 391: 25: 633: 515:"IBM RS/6000 and PowerPC Options" 246: 444:Timar, Ted; et al. (1996). 543: 525: 507: 496: 483: 459:Free Software Foundation, Inc. 183:'s standard assemblers for its 452: 437: 380: 368: 350: 332: 297: 63:statically allocated variables 13: 1: 290: 493:, Prentice Hall 1994, p. 141 377:. Javvin Press, 2007, p. 70. 117:application binary interface 7: 263: 202: 173:United Aircraft Corporation 10: 638: 29: 134: 433:. IBM. 1963. C28-6392-4. 177:FORTRAN Assembly Program 607:Executable file formats 305:McKusick, Marshall Kirk 153:Block Started by Symbol 53:) is the portion of an 489:Peter van der Linden, 358:"ELF Special Sections" 285:Uninitialized variable 217:static local variables 144: 113:computer architectures 197:Block Ended by Symbol 142: 43:block starting symbol 280:Code segment (.text) 275:Data segment (.data) 241:Peter van der Linden 125:thread-local storage 39:computer programming 568:Stevens, W. Richard 61:code that contains 617:Assembly languages 461:"38.9. Directives" 375:Network Dictionary 344:AVR Libc Home page 309:Karels, Michael J. 270:Linker (computing) 223:declared with the 145: 612:Memory management 471:on March 19, 2014 340:"Memory Sections" 119:also supports an 59:assembly language 57:, executable, or 16:(Redirected from 629: 593: 577: 559: 558: 547: 541: 540: 529: 523: 522: 511: 505: 500: 494: 487: 481: 480: 478: 476: 467:. Archived from 456: 450: 449: 441: 435: 434: 432: 422: 416: 415: 413: 411: 405: 395: 389: 384: 378: 372: 366: 365: 354: 348: 347: 336: 330: 329: 327: 317: 301: 232:); static local 228: 157:pseudo-operation 107: 45:(abbreviated to 21: 637: 636: 632: 631: 630: 628: 627: 626: 597: 596: 590: 582:. Section 7.6. 563: 562: 549: 548: 544: 533:"SPARC Options" 531: 530: 526: 513: 512: 508: 501: 497: 488: 484: 474: 472: 457: 453: 448:. Question 1.3. 442: 438: 430: 424: 423: 419: 409: 407: 403: 397: 396: 392: 385: 381: 373: 369: 356: 355: 351: 338: 337: 333: 315: 302: 298: 293: 266: 249: 224: 221:local variables 205: 185:709 and 7090/94 137: 105: 102:run-time system 35: 28: 23: 22: 15: 12: 11: 5: 635: 625: 624: 619: 614: 609: 595: 594: 588: 580:Addison–Wesley 561: 560: 542: 524: 506: 495: 482: 451: 436: 417: 390: 379: 367: 349: 331: 325:10.1.1.368.432 295: 294: 292: 289: 288: 287: 282: 277: 272: 265: 262: 248: 247:BSS in Fortran 245: 204: 201: 147:Historically, 136: 133: 74:program loader 26: 9: 6: 4: 3: 2: 634: 623: 620: 618: 615: 613: 610: 608: 605: 604: 602: 591: 589:0-201-56317-7 585: 581: 576: 575: 569: 565: 564: 556: 552: 551:"x86 Options" 546: 538: 534: 528: 520: 516: 510: 504: 499: 492: 486: 470: 466: 462: 455: 447: 440: 429: 428: 421: 402: 401: 394: 388: 383: 376: 371: 363: 359: 353: 345: 341: 335: 326: 321: 314: 310: 306: 300: 296: 286: 283: 281: 278: 276: 273: 271: 268: 267: 261: 258: 254: 244: 242: 238: 235: 231: 227: 222: 218: 214: 210: 200: 198: 194: 190: 186: 182: 178: 174: 170: 166: 162: 158: 154: 150: 141: 132: 130: 126: 122: 118: 114: 109: 103: 98: 94: 90: 86: 81: 79: 75: 71: 66: 64: 60: 56: 52: 48: 44: 40: 33: 19: 573: 554: 545: 536: 527: 518: 509: 498: 485: 473:. Retrieved 469:the original 464: 454: 439: 426: 420: 408:. Retrieved 399: 393: 382: 374: 370: 361: 352: 343: 334: 299: 250: 239: 233: 206: 196: 192: 152: 148: 146: 128: 127:might use a 120: 110: 87:systems and 82: 67: 50: 46: 42: 36: 70:object file 55:object file 18:BSS segment 601:Categories 410:18 October 291:References 320:CiteSeerX 234:constants 213:constants 165:assembler 85:Unix-like 570:(1992). 311:(1986). 264:See also 203:BSS in C 111:On some 475:Feb 22, 253:Fortran 230:keyword 169:IBM 704 155:) is a 104:before 89:Windows 586:  322:  257:64-bit 226:static 195:, for 161:UA-SAP 151:(from 135:Origin 115:, the 106:main() 72:. The 41:, the 431:(PDF) 404:(PDF) 316:(PDF) 189:words 78:.data 584:ISBN 477:2014 412:2017 129:tbss 121:sbss 95:and 47:.bss 251:In 207:In 193:BES 181:IBM 159:in 149:BSS 97:C++ 51:bss 49:or 37:In 603:: 578:. 553:. 535:. 517:. 463:. 360:. 342:. 307:; 592:. 557:. 539:. 521:. 479:. 414:. 364:. 346:. 328:. 219:( 209:C 93:C 34:. 20:)

Index

BSS segment
Service set (802.11 network) § Basic service sets (BSSs)
computer programming
object file
assembly language
statically allocated variables
object file
program loader
.data
Unix-like
Windows
C
C++
run-time system
computer architectures
application binary interface
thread-local storage

pseudo-operation
UA-SAP
assembler
IBM 704
United Aircraft Corporation
FORTRAN Assembly Program
IBM
709 and 7090/94
words
C
constants
static local variables

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑