Skip to contentSkip to conversation

leveldb: fix compile errors for mips with DEFAULTTUNE mips

PATCH In review [email protected] 3 participants 9 messages Mar 6, 2019 – Mar 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 leveldb: fix compile errors for mips with DEFAULTTUNE mips

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:
mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
mips1 (mips1) `sync'
| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
 ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
 meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +43 -0
new file mode 100644
index 000000000..fc7743030
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+ 
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
++//inline void MemoryBarrier() {
++//  __asm__ __volatile__("sync" : : : "memory");
++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+ 
+ #endif
+ 
meta-oe/recipes-dbs/leveldb/leveldb_git.bb +1 -0
index 8fec89c6f..10988726a 100644
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/google/${BPN}.git \
            file://0001-build_detect_platform-Check-for-__SSE4_2__.patch \
            file://0002-makefile-build-SHARED_MEMENVLIB.patch \
            file://0001-Makefile-Fix-parallel-build.patch \
+           file://do-not-define-function-MemoryBarrier-for-mips.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.20.0
#1 lore raw
Quoted 60 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

   mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
   mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
  ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
  meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
  2 files changed, 44 insertions(+)

create mode 100644 meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +31 -0
new file mode 100644
index 000000000..fc7743030
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch line 41

Quoted 10 lines
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +10 -0
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
++//inline void MemoryBarrier() {
++//  __asm__ __volatile__("sync" : : : "memory");
++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

Quoted 15 lines
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +2 -0
+ #endif
+
meta-oe/recipes-dbs/leveldb/leveldb_git.bb +1 -0
index 8fec89c6f..10988726a 100644
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/google/${BPN}.git \
             file://0001-build_detect_platform-Check-for-__SSE4_2__.patch \
             file://0002-makefile-build-SHARED_MEMENVLIB.patch \
             file://0001-Makefile-Fix-parallel-build.patch \
+           file://do-not-define-function-MemoryBarrier-for-mips.patch \
             "
 
  S = "${WORKDIR}/git"
author
#2 lore raw
Quoted 70 lines · Khem Raj
Quoted 67 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:
   mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
   mips1 (mips1) `sync'
| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
  ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++ meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +

  2 files changed, 44 insertions(+)

  create mode 100644 meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch +0 -0

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this 

processor:
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch +27 -0
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
+-#define LEVELDB_HAVE_MEMORY_BARRIER
Quoted 8 lines
Quoted 6 lines

++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++//  __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

python ()  {

    if d.getVar('DEFAULTTUNE') == 'mips':

        d.appendVar('SRC_URI', ' file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

Regards,
Kai

Quoted 16 lines
Quoted 15 lines

+ #endif

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch +1 -0
+
meta-oe/recipes-dbs/leveldb/leveldb_git.bb +1 -0
index 8fec89c6f..10988726a 100644
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/google/${BPN}.git \
 file://0001-build_detect_platform-Check-for-__SSE4_2__.patch \
              file://0002-makefile-build-SHARED_MEMENVLIB.patch \
              file://0001-Makefile-Fix-parallel-build.patch \
+ file://do-not-define-function-MemoryBarrier-for-mips.patch \

             "
    S = "${WORKDIR}/git"

Signature · 1 line
Kai Kang
#3 lore raw
Quoted 87 lines · Kang Kai
Quoted 73 lines · Khem Raj
Quoted 70 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

   mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
   mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
  ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
  meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
  2 files changed, 44 insertions(+)

create mode 100644
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this

processor:

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +29 -0
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
+-#define LEVELDB_HAVE_MEMORY_BARRIER
Quoted 8 lines
Quoted 6 lines

++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++// __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

Quoted 8 lines

python () {

     if d.getVar('DEFAULTTUNE') == 'mips':

         d.appendVar('SRC_URI', '

file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

None of these are as good as first patch. Ideally you should change the defaulttune

author
#4 lore raw
Quoted 88 lines · Khem Raj
Quoted 87 lines · Kang Kai
Quoted 71 lines · Khem Raj
Quoted 69 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

    mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
    mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
   ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
   meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
   2 files changed, 44 insertions(+)

create mode 100644
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this

processor:

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +28 -0
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
Quoted 8 lines
Quoted 7 lines

+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++// __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

python () {

      if d.getVar('DEFAULTTUNE') == 'mips':
Quoted 7 lines
Quoted 4 lines
          d.appendVar('SRC_URI', '

file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

None of these are as good as first patch. Ideally you should change the defaulttune

But defaulttune could be overridden by user configure. Even could configure qemumips64 with defaulttune 'mips'. I'll try to fix it from oe side based on first patch.

Kai

Quoted 1 line
Signature · 1 line
Kai Kang
#5 lore raw

If we assume we do not really have "sync" for the failing case here, lib32-leveldb, shouldn't we apply the no-sync patch with something like

SRC_URI_pn-lib32-leveldb_mipsarcho32 += "..."

Joe
________________________________________
From: [email protected] [[email protected]] on behalf of Kang Kai [[email protected]]
Sent: Tuesday, March 05, 2019 9:44 PM
To: Khem Raj
Cc: openembeded-devel
Subject: Re: [oe] [meta-oe][PATCH v2] leveldb: fix compile errors for mips with DEFAULTTUNE mips

Quoted 88 lines · Khem Raj
Quoted 87 lines · Kang Kai
Quoted 71 lines · Khem Raj
Quoted 69 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

    mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
    mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
   ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
   meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
   2 files changed, 44 insertions(+)

create mode 100644
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this

processor:

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +28 -0
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
Quoted 8 lines
Quoted 7 lines

+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++// __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

python () {

      if d.getVar('DEFAULTTUNE') == 'mips':
Quoted 7 lines
Quoted 4 lines
          d.appendVar('SRC_URI', '

file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

None of these are as good as first patch. Ideally you should change the defaulttune

But defaulttune could be overridden by user configure. Even could configure qemumips64 with defaulttune 'mips'.
I'll try to fix it from oe side based on first patch.

Kai

Quoted 1 line

--
Kai Kang

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#6 lore raw
Quoted 5 lines · Joseph

If we assume we do not really have "sync" for the failing case here, lib32-leveldb, shouldn't we apply the no-sync patch with something like

SRC_URI_pn-lib32-leveldb_mipsarcho32 += "..."

my problem is that we have mips32r2 which is also mipsarcho32 and does have sync, I would rather suggest that you switch the defaulttune for multilib to use mips32r2 since thats more or less whats out there

Quoted 123 lines

Joe
________________________________________
From: [email protected] [[email protected]] on behalf of Kang Kai [[email protected]]
Sent: Tuesday, March 05, 2019 9:44 PM
To: Khem Raj
Cc: openembeded-devel
Subject: Re: [oe] [meta-oe][PATCH v2] leveldb: fix compile errors for mips with DEFAULTTUNE mips

Quoted 88 lines · Khem Raj
Quoted 87 lines · Kang Kai
Quoted 71 lines · Khem Raj
Quoted 69 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

    mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
    mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
   ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
   meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
   2 files changed, 44 insertions(+)

create mode 100644
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this

processor:

meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch new file +28 -0
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
Quoted 8 lines
Quoted 7 lines

+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++// __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

python () {

      if d.getVar('DEFAULTTUNE') == 'mips':
Quoted 7 lines
Quoted 4 lines
          d.appendVar('SRC_URI', '

file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

None of these are as good as first patch. Ideally you should change the defaulttune

But defaulttune could be overridden by user configure. Even could configure qemumips64 with defaulttune 'mips'.
I'll try to fix it from oe side based on first patch.

Kai

Quoted 1 line

--
Kai Kang

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#7 lore raw

The particular failure we see might be a Wind River thing. For our distro's we set the DEFAULTTUNE's in an include file under layers/wrlinux/wrlinux-distro and the multilib bbclass forces it to that. It should probably be mips32r2 instead of mips32.

Joe
________________________________________
From: Khem Raj [[email protected]]
Sent: Wednesday, March 06, 2019 9:21 AM
To: Slater, Joseph
Cc: Kang, Kai; openembeded-devel
Subject: Re: [oe] [meta-oe][PATCH v2] leveldb: fix compile errors for mips with DEFAULTTUNE mips

Quoted 5 lines · Joseph

If we assume we do not really have "sync" for the failing case here, lib32-leveldb, shouldn't we apply the no-sync patch with something like

SRC_URI_pn-lib32-leveldb_mipsarcho32 += "..."

my problem is that we have mips32r2 which is also mipsarcho32 and does have sync, I would rather suggest that you switch the defaulttune for multilib to use mips32r2 since thats more or less whats out there

Quoted 123 lines

Joe
________________________________________
From: [email protected] [[email protected]] on behalf of Kang Kai [[email protected]]
Sent: Tuesday, March 05, 2019 9:44 PM
To: Khem Raj
Cc: openembeded-devel
Subject: Re: [oe] [meta-oe][PATCH v2] leveldb: fix compile errors for mips with DEFAULTTUNE mips

Quoted 88 lines · Khem Raj
Quoted 87 lines · Kang Kai
Quoted 71 lines · Khem Raj
Quoted 69 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

    mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
    mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
   ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
   meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
   2 files changed, 44 insertions(+)

create mode 100644
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

(quoted diff) +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this

processor:

(quoted diff) +28 -0
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
Quoted 8 lines
Quoted 7 lines

+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++// __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

python () {

      if d.getVar('DEFAULTTUNE') == 'mips':
Quoted 7 lines
Quoted 4 lines
          d.appendVar('SRC_URI', '

file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

None of these are as good as first patch. Ideally you should change the defaulttune

But defaulttune could be overridden by user configure. Even could configure qemumips64 with defaulttune 'mips'.
I'll try to fix it from oe side based on first patch.

Kai

Quoted 1 line

--
Kai Kang

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#8 lore raw
Quoted 2 lines · Joseph

The particular failure we see might be a Wind River thing. For our distro's we set the DEFAULTTUNE's in an include file under layers/wrlinux/wrlinux-distro and the multilib bbclass forces it to that. It should probably be mips32r2 instead of mips32.

right, thats what I am suggesting, it might be better for your to switch to mips32r2 internally.

Quoted 144 lines

Joe
________________________________________
From: Khem Raj [[email protected]]
Sent: Wednesday, March 06, 2019 9:21 AM
To: Slater, Joseph
Cc: Kang, Kai; openembeded-devel
Subject: Re: [oe] [meta-oe][PATCH v2] leveldb: fix compile errors for mips with DEFAULTTUNE mips

Quoted 5 lines · Joseph

If we assume we do not really have "sync" for the failing case here, lib32-leveldb, shouldn't we apply the no-sync patch with something like

SRC_URI_pn-lib32-leveldb_mipsarcho32 += "..."

my problem is that we have mips32r2 which is also mipsarcho32 and does have sync, I would rather suggest that you switch the defaulttune for multilib to use mips32r2 since thats more or less whats out there

Quoted 123 lines

Joe
________________________________________
From: [email protected] [[email protected]] on behalf of Kang Kai [[email protected]]
Sent: Tuesday, March 05, 2019 9:44 PM
To: Khem Raj
Cc: openembeded-devel
Subject: Re: [oe] [meta-oe][PATCH v2] leveldb: fix compile errors for mips with DEFAULTTUNE mips

Quoted 88 lines · Khem Raj
Quoted 87 lines · Kang Kai
Quoted 71 lines · Khem Raj
Quoted 69 lines · On 3/5/19 7:39 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

It fails to compile leveldb for qemumips with DEFAULTTUNE 'mips':

| {standard input}: Assembler messages:
| {standard input}:8004: Error: opcode not supported on this processor:

    mips1 (mips1) `sync'
| {standard input}:10296: Error: opcode not supported on this processor:
    mips1 (mips1) `sync'

| make: *** [out-shared/db/db_bench.o] Error 1

Asm instruction 'sync' is called in platform-specific function MemoryBarrier() which is used by AtomicPointer(). Comment out the definition of MemoryBarrier() for mips to avoid the errors. And turn to use AtomicPointer() based on C++11 <atomc>.

---
   ...fine-function-MemoryBarrier-for-mips.patch | 43 +++++++++++++++++++
   meta-oe/recipes-dbs/leveldb/leveldb_git.bb    |  1 +
   2 files changed, 44 insertions(+)

create mode 100644
meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

new file mode 100644
index 000000000..fc7743030
--- /dev/null
+++
b/meta-oe/recipes-dbs/leveldb/leveldb/do-not-define-function-MemoryBarrier-for-mips.patch

(quoted diff) +6 -0
@@ -0,0 +1,43 @@
+It fails to compile leveldb for qemumips with default tune 'mips':
+
+| {standard input}: Assembler messages:
+| {standard input}:8004: Error: opcode not supported on this processor:
+  mips1 (mips1) `sync'
+| {standard input}:10296: Error: opcode not supported on this

processor:

(quoted diff) +28 -0
+  mips1 (mips1) `sync'
+| make: *** [out-shared/db/db_bench.o] Error 1
+
+Asm instruction 'sync' is called in platform-specific function
+MemoryBarrier() which is used by AtomicPointer(). Comment out the
+definition of MemoryBarrier() for mips to avoid the errors. And turn to
+use AtomicPointer() based on C++11 <atomic>.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Kai Kang <[email protected]>
+
+---
+ port/atomic_pointer.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
+index 1c4c7aa..7025ac3 100644
+--- a/port/atomic_pointer.h
++++ b/port/atomic_pointer.h
+@@ -113,11 +113,11 @@ inline void MemoryBarrier() {
+ #define LEVELDB_HAVE_MEMORY_BARRIER
+
+ // MIPS
+-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__)
+-inline void MemoryBarrier() {
+-  __asm__ __volatile__("sync" : : : "memory");
+-}
Quoted 8 lines
Quoted 7 lines

+-#define LEVELDB_HAVE_MEMORY_BARRIER
++//#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(__GNUC__) ++//inline void MemoryBarrier() {
++// __asm__ __volatile__("sync" : : : "memory"); ++//}
++//#define LEVELDB_HAVE_MEMORY_BARRIER
+

this is punishing all mips o32 variants.

How about only apply the patch when DEFAULTTUNE is 'mips', such as something looks like:

python () {

      if d.getVar('DEFAULTTUNE') == 'mips':
Quoted 7 lines
Quoted 4 lines
          d.appendVar('SRC_URI', '

file://do-not-define-function-MemoryBarrier-for-mips.patch')

}

None of these are as good as first patch. Ideally you should change the defaulttune

But defaulttune could be overridden by user configure. Even could configure qemumips64 with defaulttune 'mips'.
I'll try to fix it from oe side based on first patch.

Kai

Quoted 1 line

--
Kai Kang

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel