Re: atomic ops on i386

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sun, 13 Apr 2014 12:38:46 -0600

On 04/13/2014 06:36 AM, Stuart Henderson wrote:

> I'm just trying to build 3.5-HEAD on OpenBSD/i386 (i.e. 32-bit mode) for
> the first time. It fails due to use of 64-bit atomic ops:
>
> MemStore.o(.text+0xc90): In function `MemStore::anchorEntry(StoreEntry&, int, Ipc::StoreMapAnchor const&)':
> : undefined reference to `__sync_fetch_and_add_8'
> MemStore.o(.text+0x3aa3): In function `MemStore::copyFromShm(StoreEntry&, int, Ipc::StoreMapAnchor const&)':
> : undefined reference to `__sync_fetch_and_add_8'
> MemStore.o(.text+0x3cce): In function `MemStore::copyFromShm(StoreEntry&, int, Ipc::StoreMapAnchor const&)':
> : undefined reference to `__sync_fetch_and_add_8'
> MemStore.o(.text+0x4040): In function `MemStore::copyFromShm(StoreEntry&, int, Ipc::StoreMapAnchor const&)':
> : undefined reference to `__sync_fetch_and_add_8'
> MemStore.o(.text+0x435f): In function `MemStore::copyFromShm(StoreEntry&, int, Ipc::StoreMapAnchor const&)':
> : undefined reference to `__sync_fetch_and_add_8'
> MemStore.o(.text+0x473d): more undefined references to `__sync_fetch_and_add_8' follow
> collect2: error: ld returned 1 exit status

I am not an expert on this, but googling suggests building with
-march=i586 or a similar GCC option may solve your problem. More
possibly relevant details at

  http://www.squid-cache.org/mail-archive/squid-dev/201308/0103.html

> (cmpxchg8b isn't used on OpenBSD/i386 as binaries are supposed to work
> on old CPUs too; 64 bit ops are of course OK on 64-bit architectures).
>
> The autoconf test for atomic ops support is working, but it only checks
> for int-sized atomic ops (which work OK here) - since the "Initial Large
> Rock and Collapsed Forwarding support" commit (bzr rev 13201), Squid
> started requiring 64-bit atomic ops too.
>
> Should the autoconf test be changed to check for working 64-bit ops, or
> is something more involved wanted?

Filing a bug report may be a good idea, especially if you cannot make
this work.

HTH,

Alex.
Received on Sun Apr 13 2014 - 18:39:06 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 14 2014 - 12:00:12 MDT