All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Ayrton Leyssens <aleyssens@idtech.be>
Cc: "buildroot@buildroot.org" <buildroot@buildroot.org>,
	Gilles Fouarge <gfouarge@idtech.be>
Subject: Re: [Buildroot] [PATCH 1/1] package/libnss fix buildtype
Date: Sat, 17 May 2025 17:18:31 +0200	[thread overview]
Message-ID: <20250517171831.7fddcaa6@windsurf> (raw)
In-Reply-To: <VI1PR06MB8926D3F9BF282F9072C81811AD852@VI1PR06MB8926.eurprd06.prod.outlook.com>

Hello Ayrton,

Thanks for the feedback. More questions/comments below.

On Thu, 24 Apr 2025 06:11:27 +0000
Ayrton Leyssens <aleyssens@idtech.be> wrote:

> The issue presented when we were debugging Certmonger (which I still have to send in correctful).
> Same Cermonger version as a Yocto based reference build.
> So, we looked at the dependencies.
> When checking versions with 'strings libnss.a | grep -i version' we saw version = 3.108 (debug) (while the reference has not).
> Going through the docs of LibNSS, I noticed that the make target of LibNSS is not using the default passed make arguments (like -O2).

Reading the code of nss, I see:

ifdef BUILD_OPT
ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
	OPTIMIZER = -Os
else
	OPTIMIZER = -O2
endif

So when BUILD_OPT is 0, no flag is added. And as reported in my
previous e-mail, Buildroot passed CFLAGS -O2 and -g0 are taken into
account.

> When passed no additional arguments as defined (https://firefox-source-docs.mozilla.org/security/nss/build.html ), it is all 0 by default.
> So goes for the BUILD_OPT:
> 0: Build a debug (non-optimized) version of NSS. This is the default.
> 1: Build an optimized (non-debug) version of NSS.
> 
> -O2 disables the production of debug symbols, but the BUILD_OPT var has implications on the source itself.

No -O2 does not disable the production of debug symbols. The -g0 does it.

Could you clarify which implications BUILD_OPT has on the source files?
I went through the nss code base, grepped for BUILD_OPT everywhere, and
couldn't spot how this was having an impact on the source code.

> When in the so called 'debug' build, LibNSS discards all variables / sets them to NULL if not all arguments are passed to some functions.

Could you provide some pointers to the actual code? Also I guess you
meant these are discarded in the optimized build, not the debug build,
right?

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2025-05-17 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 14:01 [Buildroot] [PATCH 1/1] package/libnss fix buildtype Ayrton Leyssens
2025-04-23 21:48 ` Thomas Petazzoni via buildroot
2025-04-24  6:11   ` Ayrton Leyssens
2025-05-17 15:18     ` Thomas Petazzoni via buildroot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250517171831.7fddcaa6@windsurf \
    --to=buildroot@buildroot.org \
    --cc=aleyssens@idtech.be \
    --cc=gfouarge@idtech.be \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.