Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#17748 closed defect (duplicate)

apr-1.3.3: 4-way universal build: duplicate case value and bad 64-32 bit switch logic

Reported by: eborisch@… Owned by: danielluke (Daniel J. Luke)
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: universal Cc:
Port: apr

Description

Ticket #15523 is still true; please fix.

How to fix: as noted on http://sarth.thallos.org/2008/10/apr-and-32-bit64-bit-universal-binary.html - patch include/apr.h from

typedef long apr_int64_t;
typedef unsigned long apr_uint64_t;

to

typedef long long apr_int64_t;
typedef unsigned long long apr_uint64_t;

Also, atomic/unix/ia32.c needs to have the two if clauses at the end changed to something like this:

#if !(defined(__LP64__) )
    asm volatile ("lock; cmpxchgl %2, %1"
                  : "=a" (prev), "=m" (*mem)
                  : "r" (with), "m" (*mem), "0" (cmp));
#else
    asm volatile ("lock; cmpxchgq %q2, %1"
                  : "=a" (prev), "=m" (*mem)
                  : "r" ((unsigned long)with), "m" (*mem),
                    "0" ((unsigned long)cmp));
#endif
    return prev;
}

APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
{
    void *prev;
#if !(defined(__LP64__) )
    asm volatile ("xchgl %2, %1"
                  : "=a" (prev), "+m" (*mem)
                  : "0" (with));
#else
   asm volatile ("xchgq %q2, %1"
                  : "=a" (prev), "+m" (*mem)
                  : "r" ((unsigned long)with));
#endif
    return prev;
}

These are both issues with doing the 32-bit and 64-bit builds concurrently.

Change History (4)

comment:1 Changed 16 years ago by dbevans (David B. Evans)

Cc: dluke@… removed
Keywords: apr removed
Owner: changed from macports-tickets@… to dluke@…

Assigning to maintainer.

comment:2 Changed 16 years ago by eborisch@…

A better patch may be to change apr.h as above, but to also put this in:

#ifdef __LP64__
#define APR_SIZEOF_VOIDP 8
#else
#define APR_SIZEOF_VOIDP 4
#endif

replacing the existing "#define APR_SIZEOF_VOIDP 8" that exists after configure... With this, no change is needed to atomic/unix/ia32.c

comment:3 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: duplicate
Status: newclosed

Duplicate of #17090.

comment:4 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.