Re: [PATCH 1/2] sh: align .bss section padding to 8-byte boundary
Geert Uytterhoeven <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <CAMuHMdXaw117mimN_7UgwbfbG9grVg09WfjKa2Lz4eGqM24EvA@mail.gmail.com> |
Hi Uros, On Wed, 12 Mar 2025 at 09:32, Uros Bizjak <[email protected]> wrote: > On Wed, Mar 12, 2025 at 9:22 AM John Paul Adrian Glaubitz > <[email protected]> wrote: > > > In the original BSS_SECTION(0, PAGE_SIZE, 4), the last argument inserts > > > a 4 byte padding after the closing brace of .bss section definition, > > > causing the __bss_stop symbol offset to grow, but not the .bss section > > > itself: > > > > > > #define BSS_SECTION(sbss_align, bss_align, stop_align) \ > > > . = ALIGN(sbss_align); \ > > > __bss_start = .; \ > > > SBSS(sbss_align) \ > > > BSS(bss_align) \ > > > . = ALIGN(stop_align); \ > > > __bss_stop = .; > > > > OK, that's really odd. So, the __bss_stop would be moved to the desired > > position but the section itself still remains small? What exactly does the > > linker fill the region with? Sounds very strange. > > > > > TurtleBoard loader is only concerned with the .bss section size - it > > > doesn't care about any symbol offsets - and hence this seemingly cryptic > > > change (you can display the section size information with > > > readelf -t kernel_image). > > > > Looking at the actual kernel image with readelf is a very good suggestion! > > > > > The rest of the changes are simply to "inline" the BSS() macro (as I > > > needed to access that closing brace), and the former sbss_align, > > > bss_align (that's your PAGE_SIZE) and stop_align arguments are passed > > > accordingly, the same way they used to be passed before. The only > > > visible effect should be the move of ALIGN(stop_align) inside of .bss > > > section definition, and the change of stop_align value from 4 to 8. > > > > OK. FWIW, do you understand what SBSS is for? I couldn't find any explanation > > for it. > > Small BSS section. The compiler can put data objects under a certain > size threshold to the .sbss section. Looking at GCC sh config, sh does > not use this section. Hence the moment gcc (or clang) starts using that section, the TurtleBoard loader is broken again... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds