* [PATCH v1] Fix build break when LTO is enabled
@ 2025-10-09 7:00 Chenxi Mao
2025-10-09 13:32 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Chenxi Mao @ 2025-10-09 7:00 UTC (permalink / raw)
To: Kevin Wolf, Hanna Reitz, Viktor Prutyanov
Cc: Akihiko Odaki, qemu-block, qemu-devel, Chenxi Mao
QEMU build fails when LTO is enabled:
../configure --target-list=riscv64-softmmu --enable-lto
make
Several errors occur due to incorrect curl_easy_setopt usage:
../contrib/elf2dmp/download.c:30:16: error: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Werror=attribute-warning]
30 | || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK
| ^
lto1: all warnings being treated as errors
../block/curl.c: In function ‘curl_open’:
../block/curl.c:806:9: error: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Werror=attribute-warning]
806 | if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) ||
| ^
lto1: all warnings being treated as errors
The third parameter of curl_easy_setopt should be of long type.
Change integer constants to long by adding 'L' suffix.
After this change, build passes and runs without errors.
Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn>
---
block/curl.c | 12 ++++++------
contrib/elf2dmp/download.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/block/curl.c b/block/curl.c
index e0f98e035a..d7d93d967f 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -471,11 +471,11 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
(void *)curl_read_cb) ||
curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state) ||
curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state) ||
- curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) ||
- curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1) ||
- curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1) ||
+ curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1L) ||
+ curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1L) ||
+ curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1L) ||
curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg) ||
- curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1)) {
+ curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1L)) {
goto err;
}
if (s->username) {
@@ -524,7 +524,7 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
#endif
#ifdef DEBUG_VERBOSE
- if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1)) {
+ if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1L)) {
goto err;
}
#endif
@@ -800,7 +800,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
}
s->accept_range = false;
- if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) ||
+ if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1L) ||
curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb) ||
curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s)) {
pstrcpy(state->errmsg, CURL_ERROR_SIZE,
diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c
index 21306b3fd4..fa8da0f9a2 100644
--- a/contrib/elf2dmp/download.c
+++ b/contrib/elf2dmp/download.c
@@ -27,8 +27,8 @@ bool download_url(const char *name, const char *url)
if (curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK
|| curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL) != CURLE_OK
|| curl_easy_setopt(curl, CURLOPT_WRITEDATA, file) != CURLE_OK
- || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK
- || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0) != CURLE_OK
+ || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) != CURLE_OK
+ || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L) != CURLE_OK
|| curl_easy_perform(curl) != CURLE_OK) {
unlink(name);
fclose(file);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] Fix build break when LTO is enabled
2025-10-09 7:00 [PATCH v1] Fix build break when LTO is enabled Chenxi Mao
@ 2025-10-09 13:32 ` Peter Maydell
2025-10-09 14:05 ` Richard W.M. Jones
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2025-10-09 13:32 UTC (permalink / raw)
To: Chenxi Mao
Cc: Kevin Wolf, Hanna Reitz, Viktor Prutyanov, Akihiko Odaki,
qemu-block, qemu-devel, Richard W.M. Jones
On Thu, 9 Oct 2025 at 14:15, Chenxi Mao <maochenxi@bosc.ac.cn> wrote:
>
> QEMU build fails when LTO is enabled:
> ../configure --target-list=riscv64-softmmu --enable-lto
> make
>
> Several errors occur due to incorrect curl_easy_setopt usage:
>
> ../contrib/elf2dmp/download.c:30:16: error: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Werror=attribute-warning]
> 30 | || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK
> | ^
> lto1: all warnings being treated as errors
> ../block/curl.c: In function ‘curl_open’:
> ../block/curl.c:806:9: error: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Werror=attribute-warning]
> 806 | if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) ||
> | ^
> lto1: all warnings being treated as errors
>
> The third parameter of curl_easy_setopt should be of long type.
> Change integer constants to long by adding 'L' suffix.
>
> After this change, build passes and runs without errors.
>
> Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn>
Hi; there's already a patch on list for this:
https://patchew.org/QEMU/20251001124055.2743244-1-rjones@redhat.com/
Looks like that missed the elf2dmp usage though:
> diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c
> index 21306b3fd4..fa8da0f9a2 100644
> --- a/contrib/elf2dmp/download.c
> +++ b/contrib/elf2dmp/download.c
> @@ -27,8 +27,8 @@ bool download_url(const char *name, const char *url)
> if (curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK
> || curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL) != CURLE_OK
> || curl_easy_setopt(curl, CURLOPT_WRITEDATA, file) != CURLE_OK
> - || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK
> - || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0) != CURLE_OK
> + || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) != CURLE_OK
> + || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L) != CURLE_OK
> || curl_easy_perform(curl) != CURLE_OK) {
> unlink(name);
> fclose(file);
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] Fix build break when LTO is enabled
2025-10-09 13:32 ` Peter Maydell
@ 2025-10-09 14:05 ` Richard W.M. Jones
0 siblings, 0 replies; 3+ messages in thread
From: Richard W.M. Jones @ 2025-10-09 14:05 UTC (permalink / raw)
To: Peter Maydell
Cc: Chenxi Mao, Kevin Wolf, Hanna Reitz, Viktor Prutyanov,
Akihiko Odaki, qemu-block, qemu-devel
On Thu, Oct 09, 2025 at 02:32:00PM +0100, Peter Maydell wrote:
> On Thu, 9 Oct 2025 at 14:15, Chenxi Mao <maochenxi@bosc.ac.cn> wrote:
> >
> > QEMU build fails when LTO is enabled:
> > ../configure --target-list=riscv64-softmmu --enable-lto
> > make
...
> Hi; there's already a patch on list for this:
>
> https://patchew.org/QEMU/20251001124055.2743244-1-rjones@redhat.com/
And it's nothing to do with LTO. This is caused by an update in curl
which fixed some (already crazy) compiler macros to detect this stuff:
https://github.com/curl/curl/commit/79b4e56b3f30dc1ac28a81128a07d27338e5219e
> Looks like that missed the elf2dmp usage though:
I'll post an update with Chenxi Mao's S-O-B attached, in a minute.
Rich.
> > diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c
> > index 21306b3fd4..fa8da0f9a2 100644
> > --- a/contrib/elf2dmp/download.c
> > +++ b/contrib/elf2dmp/download.c
> > @@ -27,8 +27,8 @@ bool download_url(const char *name, const char *url)
> > if (curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK
> > || curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL) != CURLE_OK
> > || curl_easy_setopt(curl, CURLOPT_WRITEDATA, file) != CURLE_OK
> > - || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK
> > - || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0) != CURLE_OK
> > + || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) != CURLE_OK
> > + || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L) != CURLE_OK
> > || curl_easy_perform(curl) != CURLE_OK) {
> > unlink(name);
> > fclose(file);
>
>
> thanks
> -- PMM
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-09 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 7:00 [PATCH v1] Fix build break when LTO is enabled Chenxi Mao
2025-10-09 13:32 ` Peter Maydell
2025-10-09 14:05 ` Richard W.M. Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).