* make vmlinux .bss PROGBITS @ 2020-10-06 13:17 William Tambe 2020-10-06 18:11 ` Valdis Klētnieks 0 siblings, 1 reply; 4+ messages in thread From: William Tambe @ 2020-10-06 13:17 UTC (permalink / raw) To: Kernel Newbies How can I modify Makefile such that when vmlinux is created, following command is run on vmlinux to make section .bss PROGBITS: objcopy --set-section-flags .bss=alloc,load,contents _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: make vmlinux .bss PROGBITS 2020-10-06 13:17 make vmlinux .bss PROGBITS William Tambe @ 2020-10-06 18:11 ` Valdis Klētnieks 2020-10-06 18:56 ` William Tambe 0 siblings, 1 reply; 4+ messages in thread From: Valdis Klētnieks @ 2020-10-06 18:11 UTC (permalink / raw) To: William Tambe; +Cc: Kernel Newbies [-- Attachment #1.1: Type: text/plain, Size: 514 bytes --] On Tue, 06 Oct 2020 08:17:44 -0500, William Tambe said: > How can I modify Makefile such that when vmlinux is created, following > command is run on vmlinux to make section .bss PROGBITS: > objcopy --set-section-flags .bss=alloc,load,contents Remember - vmlinux isn't going to be loaded by the userspace loader, but rather by a bootstrap loader. So those flags probably don't actually do what you think they do. For that matter, what *do* you think they do, and what problem are you trying to solve with them? [-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: make vmlinux .bss PROGBITS 2020-10-06 18:11 ` Valdis Klētnieks @ 2020-10-06 18:56 ` William Tambe 2020-10-06 23:52 ` Valdis Klētnieks 0 siblings, 1 reply; 4+ messages in thread From: William Tambe @ 2020-10-06 18:56 UTC (permalink / raw) To: Valdis Klētnieks; +Cc: Kernel Newbies On Tue, Oct 6, 2020 at 1:11 PM Valdis Klētnieks <valdis.kletnieks@vt.edu> wrote: > > On Tue, 06 Oct 2020 08:17:44 -0500, William Tambe said: > > How can I modify Makefile such that when vmlinux is created, following > > command is run on vmlinux to make section .bss PROGBITS: > > objcopy --set-section-flags .bss=alloc,load,contents > > Remember - vmlinux isn't going to be loaded by the userspace loader, > but rather by a bootstrap loader. So those flags probably don't actually > do what you think they do. We have a loader that loads vmlinux.bin (created from vmlinux using objcopy -O binary), however if section .bss is not PROGBITS, vmlinux.bin does not include that space, which the loader will not reserve; by allocating that space in vmlinux.bin the loader also reserves that space. To solve the problem we are looking to make section .bss PROBGITS using objcopy --set-section-flags .bss=alloc,load,contents , but it is not trivial how to modify the Linux Makefile to achieve that. > > For that matter, what *do* you think they do, and what problem are you > trying to solve with them? > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: make vmlinux .bss PROGBITS 2020-10-06 18:56 ` William Tambe @ 2020-10-06 23:52 ` Valdis Klētnieks 0 siblings, 0 replies; 4+ messages in thread From: Valdis Klētnieks @ 2020-10-06 23:52 UTC (permalink / raw) To: William Tambe; +Cc: Kernel Newbies [-- Attachment #1.1: Type: text/plain, Size: 1097 bytes --] On Tue, 06 Oct 2020 13:56:11 -0500, William Tambe said: > We have a loader that loads vmlinux.bin (created from vmlinux using > objcopy -O binary), however if section .bss is not PROGBITS, > vmlinux.bin does not include that space, which the loader will not > reserve; by allocating that space in vmlinux.bin the loader also > reserves that space. Sounds like a buggy loader if it can't reserve a .bss segment. I mean, how hard is that to get right? Or are you saying that your linker is buggy, and won't output an entry sizing the.bss unless it's got bits set, at which point your loader never sees a .bss entry and things go pear shaped? > To solve the problem we are looking to make section .bss PROBGITS > using objcopy --set-section-flags .bss=alloc,load,contents , but it is > not trivial how to modify the Linux Makefile to achieve that. So now you have a buggy linker or loader and a custom kernel hack that you'll have to maintain and rework every time you upgrade the kernel. Probably more productive to figure out why you're hitting this issue when pretty much nobody else is... [-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-06 23:53 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-10-06 13:17 make vmlinux .bss PROGBITS William Tambe 2020-10-06 18:11 ` Valdis Klētnieks 2020-10-06 18:56 ` William Tambe 2020-10-06 23:52 ` Valdis Klētnieks
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).