[PATCH 2/2] Makefile: Remove -g from default CFLAGS
Jessica Clarke
jrtc27 at jrtc27.com
Wed Aug 28 08:01:06 PDT 2024
On 28 Aug 2024, at 15:50, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> On Sat, Aug 24, 2024 at 4:22 PM Kele Zhang <1952088712 at qq.com> wrote:
>>
>> Remove `-g` from default CFLAGS as it should not be used in production
>> builds. Adjust optimization level to `-Og` when DEBUG is enabled.
>
> The production build does not use ELF images to program onto the board
> but the plain binary image instead. So `-g`should be fine.
And even for boards that do, -g is the right thing to do. If you don’t
want debugging symbols, strip the binary, but it’s useful to default to
including them; distributions generally do exactly that, stripping the
installed binary but keeping the debug symbols around in a separate
.debug file.
Debug symbols also aren’t loaded into memory, they only exist on disk,
so the only cost is a bit of disk space.
Jess
More information about the opensbi
mailing list