* [PATCH] ltp: set -fomit-frame-pointer explicitly
@ 2018-06-14 9:35 mingli.yu
2018-06-14 16:38 ` Khem Raj
0 siblings, 1 reply; 4+ messages in thread
From: mingli.yu @ 2018-06-14 9:35 UTC (permalink / raw)
To: openembedded-core
From: Mingli Yu <Mingli.Yu@windriver.com>
When build ltp with -fno-omit-frame-pointer,
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 for compiler
to fix the above build error.
Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
meta/recipes-extended/ltp/ltp_20180515.bb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
index b07c1b9..5ec25ed 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -19,6 +19,10 @@ LIC_FILES_CHKSUM = "\
DEPENDS = "attr libaio libcap acl openssl zip-native"
DEPENDS_append_libc-musl = " fts "
EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
+
+# -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 = " ${@bb.utils.contains('SELECTED_OPTIMIZATION', '-fno-omit-frame-pointer', '-fomit-frame-pointer', '', d)}"
CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ltp: set -fomit-frame-pointer explicitly
2018-06-14 9:35 [PATCH] ltp: set -fomit-frame-pointer explicitly mingli.yu
@ 2018-06-14 16:38 ` Khem Raj
2018-06-14 19:20 ` Andre McCurdy
0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2018-06-14 16:38 UTC (permalink / raw)
To: mingli.yu, openembedded-core
[-- Attachment #1.1: Type: text/plain, Size: 1736 bytes --]
On 6/14/18 2:35 AM, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
>
> When build ltp with -fno-omit-frame-pointer,
> 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 for compiler
> to fix the above build error.
>
> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> ---
> meta/recipes-extended/ltp/ltp_20180515.bb | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
> index b07c1b9..5ec25ed 100644
> --- a/meta/recipes-extended/ltp/ltp_20180515.bb
> +++ b/meta/recipes-extended/ltp/ltp_20180515.bb
> @@ -19,6 +19,10 @@ LIC_FILES_CHKSUM = "\
> DEPENDS = "attr libaio libcap acl openssl zip-native"
> DEPENDS_append_libc-musl = " fts "
> EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
> +
> +# -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 = " ${@bb.utils.contains('SELECTED_OPTIMIZATION', '-fno-omit-frame-pointer', '-fomit-frame-pointer', '', d)}"
may be just append it unconditionally, what do we lose ?
CFLAGS += "-fomit-frame-pointer"
> CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
> CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
> SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ltp: set -fomit-frame-pointer explicitly
2018-06-14 16:38 ` Khem Raj
@ 2018-06-14 19:20 ` Andre McCurdy
2018-06-15 8:07 ` Yu, Mingli
0 siblings, 1 reply; 4+ messages in thread
From: Andre McCurdy @ 2018-06-14 19:20 UTC (permalink / raw)
To: OE Core mailing list
On Thu, Jun 14, 2018 at 9:38 AM, Khem Raj <raj.khem@gmail.com> wrote:
> On 6/14/18 2:35 AM, mingli.yu@windriver.com wrote:
>> From: Mingli Yu <Mingli.Yu@windriver.com>
>>
>> When build ltp with -fno-omit-frame-pointer,
>> 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 for compiler
>> to fix the above build error.
>>
>> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
>> ---
>> meta/recipes-extended/ltp/ltp_20180515.bb | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
>> index b07c1b9..5ec25ed 100644
>> --- a/meta/recipes-extended/ltp/ltp_20180515.bb
>> +++ b/meta/recipes-extended/ltp/ltp_20180515.bb
>> @@ -19,6 +19,10 @@ LIC_FILES_CHKSUM = "\
>> DEPENDS = "attr libaio libcap acl openssl zip-native"
>> DEPENDS_append_libc-musl = " fts "
>> EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
>> +
>> +# -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 = " ${@bb.utils.contains('SELECTED_OPTIMIZATION', '-fno-omit-frame-pointer', '-fomit-frame-pointer', '', d)}"
This doesn't cover all cases - there may be times when the compiler
chooses to enable frame pointers without being called with
-fno-omit-frame-pointer.
You could make the append conditional on x86 though (based on the
error message, it's the x86 frame pointer register which is being used
by inline assembler).
> may be just append it unconditionally, what do we lose ?
> CFLAGS += "-fomit-frame-pointer"
>
>> CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
>> CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
>> SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"
>>
>
>
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ltp: set -fomit-frame-pointer explicitly
2018-06-14 19:20 ` Andre McCurdy
@ 2018-06-15 8:07 ` Yu, Mingli
0 siblings, 0 replies; 4+ messages in thread
From: Yu, Mingli @ 2018-06-15 8:07 UTC (permalink / raw)
To: Andre McCurdy, OE Core mailing list
On 2018年06月15日 03:20, Andre McCurdy wrote:
> On Thu, Jun 14, 2018 at 9:38 AM, Khem Raj <raj.khem@gmail.com> wrote:
>> On 6/14/18 2:35 AM, mingli.yu@windriver.com wrote:
>>> From: Mingli Yu <Mingli.Yu@windriver.com>
>>>
>>> When build ltp with -fno-omit-frame-pointer,
>>> 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 for compiler
>>> to fix the above build error.
>>>
>>> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
>>> ---
>>> meta/recipes-extended/ltp/ltp_20180515.bb | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
>>> index b07c1b9..5ec25ed 100644
>>> --- a/meta/recipes-extended/ltp/ltp_20180515.bb
>>> +++ b/meta/recipes-extended/ltp/ltp_20180515.bb
>>> @@ -19,6 +19,10 @@ LIC_FILES_CHKSUM = "\
>>> DEPENDS = "attr libaio libcap acl openssl zip-native"
>>> DEPENDS_append_libc-musl = " fts "
>>> EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
>>> +
>>> +# -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 = " ${@bb.utils.contains('SELECTED_OPTIMIZATION', '-fno-omit-frame-pointer', '-fomit-frame-pointer', '', d)}"
>
> This doesn't cover all cases - there may be times when the compiler
> chooses to enable frame pointers without being called with
> -fno-omit-frame-pointer.
>
> You could make the append conditional on x86 though (based on the
> error message, it's the x86 frame pointer register which is being used
> by inline assembler).
Thanks Khem and Andre!
Considering it's x86-64 specific(x86 actually not affected), I will
update the logic unconditionally in V2 as below only for x86-64 to cover
some cases when the compiler enables frame pointers without being called
with -fno-omit-frame-pointer.
CFLAGS_append_x86-64 = " -fomit-frame-pointer"
Thanks,
>
>> may be just append it unconditionally, what do we lose ?
>> CFLAGS += "-fomit-frame-pointer"
>>
>>> CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
>>> CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
>>> SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27"
>>>
>>
>>
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-15 8:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-14 9:35 [PATCH] ltp: set -fomit-frame-pointer explicitly mingli.yu
2018-06-14 16:38 ` Khem Raj
2018-06-14 19:20 ` Andre McCurdy
2018-06-15 8:07 ` Yu, Mingli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox