Skip to contentSkip to conversation

ltp: set -fomit-frame-pointer explicitly for x86-64

PATCH Superseded [email protected] 2 participants 3 messages Jun 15, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ltp: set -fomit-frame-pointer explicitly for x86-64

From: Mingli Yu <[email protected]>

When build ltp with -fno-omit-frame-pointer on x86-64, it will trigger below error:
| cve-2015-3290.c: In function 'child_thread':
| cve-2015-3290.c:416:1: error: bp cannot be used in asm here

And there is also some comment as below in the source file ltp/20180515-r0/git/testcases/cve/cve-2015-3290.c
* Build with -O2. Don't use -fno-omit-frame-pointer.

So explicitly set -fomit-frame-pointer on x86-64 for compiler to fix the above build error.

---
 meta/recipes-extended/ltp/ltp_20180515.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-extended/ltp/ltp_20180515.bb +5 -0
index b07c1b9..7fd8565 100644
@@ -19,6 +19,11 @@ LIC_FILES_CHKSUM = "\
 DEPENDS = "attr libaio libcap acl openssl zip-native"
 DEPENDS_append_libc-musl = " fts "
 EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
+
+# set -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame
+# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.
+CFLAGS_append_x86-64 = " -fomit-frame-pointer"
+
 CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
 CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
 SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"
Signature · 1 line
2.7.4
#1 lore raw
Quoted 33 lines · On Fri, 2018-06-15 at 17:01 +0800, [email protected] wrote:

From: Mingli Yu <[email protected]>

When build ltp with -fno-omit-frame-pointer on
x86-64, it will trigger below error:

Quoted 2 lines

cve-2015-3290.c: In function 'child_thread':
cve-2015-3290.c:416:1: error: bp cannot be used in asm here

And there is also some comment as below in the source file ltp/20180515-r0/git/testcases/cve/cve-2015-3290.c
* Build with -O2. Don't use -fno-omit-frame-pointer.

So explicitly set -fomit-frame-pointer on x86-64 for compiler to fix the above build error.

---
 meta/recipes-extended/ltp/ltp_20180515.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-extended/ltp/ltp_20180515.bb +2 -0
index b07c1b9..7fd8565 100644
@@ -19,6 +19,11 @@ LIC_FILES_CHKSUM = "\
 DEPENDS = "attr libaio libcap acl openssl zip-native"
 DEPENDS_append_libc-musl = " fts "
 EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
+
+# set -fomit-frame-pointer to handle cases where optimisation is set

to -O0 or frame
+# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.

meta/recipes-extended/ltp/ltp_20180515.bb LIC_FILES_CHKSUM = "\ · line 29

Quoted 5 lines
meta/recipes-extended/ltp/ltp_20180515.bb +2 -0
+CFLAGS_append_x86-64 = " -fomit-frame-pointer"
+
 CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
 CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
 SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"

Can you extend the comment to include:

"since ltp contains x86-64 assembler which uses the frame-pointer register"

so that the comment doesn't just say what you're doing but why its necessary only for x86-64

Cheers,

Richard

author
#2 lore raw
Quoted 42 lines · Richard Purdie
Quoted 33 lines · On Fri, 2018-06-15 at 17:01 +0800, [email protected] wrote:

From: Mingli Yu <[email protected]>

When build ltp with -fno-omit-frame-pointer on
x86-64, it will trigger below error:

Quoted 2 lines

cve-2015-3290.c: In function 'child_thread':
cve-2015-3290.c:416:1: error: bp cannot be used in asm here

And there is also some comment as below in the source file ltp/20180515-r0/git/testcases/cve/cve-2015-3290.c
* Build with -O2. Don't use -fno-omit-frame-pointer.

So explicitly set -fomit-frame-pointer on x86-64 for compiler to fix the above build error.

---
  meta/recipes-extended/ltp/ltp_20180515.bb | 5 +++++
  1 file changed, 5 insertions(+)
meta/recipes-extended/ltp/ltp_20180515.bb +2 -0
index b07c1b9..7fd8565 100644
@@ -19,6 +19,11 @@ LIC_FILES_CHKSUM = "\
  DEPENDS = "attr libaio libcap acl openssl zip-native"
  DEPENDS_append_libc-musl = " fts "
  EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
+
+# set -fomit-frame-pointer to handle cases where optimisation is set

to -O0 or frame
+# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.

meta/recipes-extended/ltp/ltp_20180515.bb LIC_FILES_CHKSUM = "\ · line 29

Quoted 5 lines
meta/recipes-extended/ltp/ltp_20180515.bb +2 -0
+CFLAGS_append_x86-64 = " -fomit-frame-pointer"
+
  CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
  CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
  SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"

Can you extend the comment to include:

Quoted 5 lines

"since ltp contains x86-64 assembler which uses the frame-pointer register"

so that the comment doesn't just say what you're doing but why its necessary only for x86-64

Thanks Richard!

It makes sense, will send out V3 to explain more why it's only necessary only for x86-64.

Thanks,

Quoted 7 lines

Cheers,

Richard