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

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


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Edwin Torok <edwin.torok@xxxxxxxxxx>
  • Date: Mon, 9 Mar 2026 14:36:55 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OMn9meAwVwU60QdOvQPVGX3C2BUIMnIRG9tYAyWqk3Y=; b=Cbutw7C/zwXUyfD8hgKat7VXiJ7CRV0mU8GgTU68SmzwFoL78cuJTs0rWuPJFFGfdcHY5UsnQ36aQzNespF1UDTkns6d68zTHU6FMW+O8waNYzQ/+sXvvmSS/KgcNA6Wc5vcP9mHlPXdmit/0CdHjxYzFa1BzuUOf6CNhTB6XW2Qo01rJ3HdJg2qMMgoZ1gG2OWUiR4Sy1UQGCcKIwUvl1NDCEUEeMLIuqBCv/K3MLqL65OKnxUATeOoP3Z0k60WjglujnYIQIF4RpBDms7e7DUEqWfHuXW+DPuG831qgS/iy5c/TQ3rkkZEFYJIBPoLyrnsrYlRAqWHiLpS2nT/3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O7biId/RZDq2zRT2MEMUxGAbRn1zhiREYSmSZQfSQbK5VtB2s0LUeNXPKxMBgesm53hLs2ZWT4PYhV/SrgEhYJTgYfCKTTGppLY0XMq4Ipt/hEyEpShWktDJjO7YLO+5+16+AnUWJy2JbhtLLH7ZhsO0YWGuGmA5tpDJAwXbqqGVJHQ5R3YYOGgAS2PCyytc7rRmN50BiIMYz3nejjc28rJjDaZObIC4QGIj/a0e4ECLA8y1yXWOK8P58yiDX/DUGFbP9W+2uyySUsfR4gWQ2LwoS4N259pIN4nmxJdIhbVOnVADAcSdoF7QNsaJ2wd7GyKqCdv7+FRJYPPuWf8tzQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Mon, 09 Mar 2026 14:37:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcr7FQiijdIWu12E6i9XJI47BDXrWmPvcAgAAF8wA=
  • Thread-topic: [PATCH v4] tools/tests/x86_emulator: avoid duplicate symbol error with clang: use -O0


> On 9 Mar 2026, at 14:15, Roger Pau Monne <roger.pau@xxxxxxxxxx> wrote:
> 
> On Mon, Mar 09, 2026 at 10:41:35AM +0000, Edwin Török wrote:
>> clang would duplicate the loop body and end up with a double definition
>> of the symbol:
>> ```
>> /tmp/test_x86_emulator-0f3576.s:27823: Error: symbol `vmovsh_to_mem' is 
>> already defined
>> /tmp/test_x86_emulator-0f3576.s:27825: Error: symbol `.Lvmovsh_to_mem_end' 
>> is already defined
>> ```
>> 
>> Until a better solution is found: reduce optimizations in the test runner.
>> 
>> Using -Os might also work, but we can't rely on the size optimization
>> always avoiding the duplication of asm blocks.
>> This is test code, not performance critical code, and -O0 is more future
>> proof.
>> However for debugging -Og is recommended over -O0, and this still
>> avoids the duplicate label problem.
>> 
>> Signed-off-by: Edwin Török <edwin.torok@xxxxxxxxxx>
> 
> Building the x86 emulator test harness is currently gated on:
> 
> ifneq ($(clang),y)
> SUBDIRS-$(CONFIG_X86) += x86_emulator
> endif

Good point, I haven’t spotted that.
Although I don’t think that flag is set if you set CC=clang/HOSTCC=clang 
instead of using clang=y.
(I only discovered clang=y after I started fixing some clang build failures).

> 
> So I think there should be a further patch (or done here) that removed
> this check.
>  And then we should also run the test harness from one of
> the LLVM FreeBSD builds ideally.


Running with clang would currently fail.
See 
https://lore.kernel.org/xen-devel/10B1B7D9-352F-4203-AC30-88EF674114F5@xxxxxxxxxx/
Until a (better) solution is found for that, if I remove the gate then I assume 
the CI would fail?

I think it’d be useful to enable build-testing with clang though, so I could 
remove the SUBDIRS gate,
and introduce a gate on the tests/x86_emulator/Makefile:run rule instead?

> 
> Have you tested with a full LLVM based toolchain (so also using LLVM
> linker?)

No, the clang I’m using is configured to use the binutils linker by default.

Best regards,
—Edwin

 


Rackspace

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