[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/1] tools/tests/x86_emulator: avoid duplicate symbol error with clang: use -O0


  • To: Edwin Torok <edwin.torok@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 9 Mar 2026 11:20:07 +0100
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 09 Mar 2026 10:20:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.03.2026 10:49, Edwin Torok wrote:
>> On 9 Mar 2026, at 07:47, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> There's
>> one other question though: Isn't -O0 the default? Where would any other
>> optimization setting come from in HOSTCFLAGS? Ah, I see ./Config.mk does
>> this, for an unclear to me reason.
> 
> One possible reason I’d enable optimisations (even for non-performance 
> critical code) is to get better warnings.
> I looked this up, and I see it is actually documented in the GCC manual:
> "The effectiveness of some warnings depends on optimizations also being 
> enabled.
> For example, -Wsuggest-final-types is more effective with link-time 
> optimization. 
> Some other warnings may not be issued at all unless optimization is enabled.
> While optimization in general improves the efficacy of warnings about control 
> and data-flow problems,
> in some cases it may also cause false positives.”
> 
> In fact warnings rely on optimisations even more than I thought, didn’t know 
> about link time optimisations having an effect
> (from the example that warning is only relevant for C++ for now)
> 
> I can see why in general a compiler would decide to implement it that way (if 
> you run an analysis to get more accurate
> information for showing warnings then you might as well use it to emit better 
> code), but I wish that wasn’t the case. 
> E.g. you may want to use a low optimisation level to get better debugging, 
> without giving up on the better warnings.
> The only way to do that currently is to build it twice (or rely on a CI that 
> builds with different flags).
> 
> If you want to change it I’d suggest setting it at least to -Og, which is 
> recommended over O0:
> "In contrast to -O0, this enables -fvar-tracking-assignments and 
> -fvar-tracking which handle debug information in the prologue and epilogue of 
> functions better than -O0."

And did you check that -Og works for the purposes here? I'd indeed prefer to
use that, if we can.

>> Perhaps that would want mentioning
>> here then as well.
> 
> How about:
> 
> # The default HOSTCFLAGS from $(XEN_ROOT)/Config.mk would set
> # a non-zero optimisation level
> 
> I’d avoid mentioning -O2, in case that changes.

Of course.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.