From: "Shi, Steven" <steven.shi@intel.com>
To: 'Bruce Cran' <bruce@cran.org.uk>,
'Michael Zimmermann' <sigmaepsilon92@gmail.com>
Cc: 'edk2-devel-01' <edk2-devel@lists.01.org>
Subject: Re: OVMF not booting when built with GCC5 toolset?
Date: Tue, 23 Aug 2016 08:10:04 +0000 [thread overview]
Message-ID: <06C8AB66E78EE34A949939824ABE2B3103393385@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <06C8AB66E78EE34A949939824ABE2B310339057F@shsmsx102.ccr.corp.intel.com>
Hi Cran,
This issue might be a GCC6 LTO regression bug, and I've filed a bug to GCC community as below. Please don't use the GCC6 with edk2 GCC5 toolchain for now, the GCC5 (gcc-5) should works.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77341
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50818
GCC6.10 lto fails to support below MS ABI buildin of va list, but GCC5 works. This is a regression bug for GCC6. I suspect current GCC trunk also has this regression bug.
__builtin_ms_va_list ap;
__builtin_ms_va_start (ap, n);
__builtin_ms_va_end (ap);
Below is my testcase:
$cat test2.c
#include <stdio.h>
int
__attribute__((ms_abi))
foo (int n, ...)
{
__builtin_ms_va_list ap;
int sum = 0;
__builtin_ms_va_start (ap, n);
while (n--) {
sum += __builtin_va_arg (ap, int);
printf("sum = %d\n", sum);
}
__builtin_ms_va_end (ap);
return sum;
}
int main ()
{
int res = foo (10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
if (res != 55)
__builtin_abort ();
return 0;
}
$ gcc --version
gcc (GCC) 6.1.0
$ gcc -flto -Os test2.c
$ ./a.out
Segmentation fault (core dumped)
$ gcc-5 -flto -Os test2.c
$ ./a.out
sum = 1
sum = 3
sum = 6
sum = 10
sum = 15
sum = 21
sum = 28
sum = 36
sum = 45
sum = 55
Steven Shi
Intel\SSG\STO\UEFI Firmware
Tel: +86 021-61166522
iNet: 821-6522
next prev parent reply other threads:[~2016-08-23 8:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 16:15 OVMF not booting when built with GCC5 toolset? Bruce Cran
2016-08-18 16:57 ` Michael Zimmermann
2016-08-18 16:59 ` Bruce Cran
2016-08-19 2:08 ` Shi, Steven
2016-08-19 14:35 ` Bruce Cran
2016-08-19 14:46 ` Bruce Cran
2016-08-22 6:50 ` Shi, Steven
2016-08-23 8:10 ` Shi, Steven [this message]
2016-08-23 10:49 ` Shi, Steven
2016-08-29 6:45 ` Shi, Steven
2016-08-29 16:53 ` Bruce Cran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06C8AB66E78EE34A949939824ABE2B3103393385@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox