All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Fwd: [Qemu-commits] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality
       [not found] <616D744F-F31E-4E96-9A23-1664C78313FD@web.de>
@ 2009-05-30 17:49 ` Andreas Färber
  2009-05-31 10:15   ` Anthony Liguori
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Färber @ 2009-05-30 17:49 UTC (permalink / raw)
  To: qemu-devel

[sent to wrong list]

Anfang der weitergeleiteten E-Mail:

> Von: Andreas Färber <andreas.faerber@web.de>
> Datum: 30. Mai 2009 18:05:18 MESZ
> An: Anthony Liguori <aliguori@us.ibm.com>
> Kopie: qemu-commits@nongnu.org, Ben Taylor  
> <bentaylor.solx86@gmail.com>
> Betreff: Re: [Qemu-commits] [COMMIT 5efa9d5] Convert block  
> infrastructure to use new module init functionality
>
> Hello Anthony,
>
> Am 14.05.2009 um 23:16 schrieb Anthony Liguori:
>
>> From: Anthony Liguori <aliguori@us.ibm.com>
>>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> This commit 5efa9d5a8b18841c9c62208a494d7f519238979a appears to have  
> broken the plain old -hda option (for both raw and qcow2 images) on  
> OpenSolaris.
>
> Starting with this commit, qemu-system-sparc segfaults immediately;  
> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc (Fix  
> segv when passing an unknown protocol) to no longer segfault, now  
> printing "qemu: could not read disk image /path/to/image".
>
> Any ideas?
>
> Andreas
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] Fwd: [Qemu-commits] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality
  2009-05-30 17:49 ` [Qemu-devel] Fwd: [Qemu-commits] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality Andreas Färber
@ 2009-05-31 10:15   ` Anthony Liguori
  2009-05-31 11:26     ` Avi Kivity
  2009-05-31 13:29     ` [Qemu-devel] " Andreas Färber
  0 siblings, 2 replies; 10+ messages in thread
From: Anthony Liguori @ 2009-05-31 10:15 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel




>> Starting with this commit, qemu-system-sparc segfaults immediately;
>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc (Fix
>> segv when passing an unknown protocol) to no longer segfault, now
>> printing "qemu: could not read disk image /path/to/image".

I would assume -z,allextract isn't doing what we would like it to do on
OpenSolaris.  A pointer to an OpenSolaris ld man page would be a good
start to help me track this down.

Regards,

Anthony Liguori

>> Any ideas?
>>
>> Andreas
>>
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] Fwd: [Qemu-commits] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality
  2009-05-31 10:15   ` Anthony Liguori
@ 2009-05-31 11:26     ` Avi Kivity
  2009-05-31 13:29     ` [Qemu-devel] " Andreas Färber
  1 sibling, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-05-31 11:26 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Andreas Färber, qemu-devel

Anthony Liguori wrote:
>>> Starting with this commit, qemu-system-sparc segfaults immediately;
>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc (Fix
>>> segv when passing an unknown protocol) to no longer segfault, now
>>> printing "qemu: could not read disk image /path/to/image".
>>>       
>
> I would assume -z,allextract isn't doing what we would like it to do on
> OpenSolaris.  A pointer to an OpenSolaris ld man page would be a good
> start to help me track this down.
>   

I suggest dropping the linker hacks and including all the objects 
explicitly.

-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality
  2009-05-31 10:15   ` Anthony Liguori
  2009-05-31 11:26     ` Avi Kivity
@ 2009-05-31 13:29     ` Andreas Färber
  2009-06-13 20:40       ` Andreas Färber
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Färber @ 2009-05-31 13:29 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel


Am 31.05.2009 um 12:15 schrieb Anthony Liguori:

>
>>> Starting with this commit, qemu-system-sparc segfaults immediately;
>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc (Fix
>>> segv when passing an unknown protocol) to no longer segfault, now
>>> printing "qemu: could not read disk image /path/to/image".
>
> I would assume -z,allextract isn't doing what we would like it to do  
> on
> OpenSolaris.

It's actually using -Wl,--whole-archive (GNU ld version 2.15 on  
OpenSolaris 2009.06 snv_111b).

`qemu-img` correctly lists all the formats, which I thought was a test  
case for the linker option.

Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality
  2009-05-31 13:29     ` [Qemu-devel] " Andreas Färber
@ 2009-06-13 20:40       ` Andreas Färber
  2009-06-13 22:15         ` [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality) Andreas Färber
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Färber @ 2009-06-13 20:40 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 3868 bytes --]


Am 31.05.2009 um 15:29 schrieb Andreas Färber:

>
> Am 31.05.2009 um 12:15 schrieb Anthony Liguori:
>
>>
>>>> Starting with this commit, qemu-system-sparc segfaults immediately;
>>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc (Fix
>>>> segv when passing an unknown protocol) to no longer segfault, now
>>>> printing "qemu: could not read disk image /path/to/image".
>>
>> I would assume -z,allextract isn't doing what we would like it to  
>> do on
>> OpenSolaris.
>
> It's actually using -Wl,--whole-archive (GNU ld version 2.15 on  
> OpenSolaris 2009.06 snv_111b).

Sorry, your assumption was actually right.

The above version string is from `ld` (/usr/gnu/bin/ld), but gcc is  
configured to use /usr/ccs/bin/ld instead, the usual suspect.
Sun documents it to support both --whole-archive and -z allextract,  
which explains the detection and use of --Wl,--whole-archive.

Reordering the checks, so that -Wl,-z,allextract is preferred, does  
not help.

> `qemu-img` correctly lists all the formats, which I thought was a  
> test case for the linker option.

`qemu -drive format=?` appears to better mirror the actual block  
format support.

Trying to use `ld` directly for the LINK rule didn't work due to  
architectural mismatches - it kept the output format as i386 despite  
any -A or -b elf64-x86-64 flags I set (-m64 didn't seem to be valid).

If I manually link ../block/raw-posix.o into i386-softmmu's $ 
(QEMU_PROG), then instead of the original error message I get "qemu:  
hardware error: Unknown device 'smbus-eeprom'" followed by a segfault.  
I assume this is due to libqemuhw64.a.
With upstream qemu, the Supported formats list is empty, with ../block/ 
raw-posix.o linked in, it reads "host_device raw".

So it seems linking object files works while linking static libraries  
does not.

Architecturally the problem appears to be that the set of objects to  
link is determined in Makefile and Makefile.hw but is unknown to  
Makefile.target, where the problematic linking happens.
As a workaround, I've written the respective set of $(OBJS) to a file  
when linking and appending them to the LINK command. Except for two  
warnings (../aio.h and ../cache-utils.o linked twice) this works fine  
and makes BeOS boot up again.

Most likely someone will have a more efficient idea how to get the  
list of objects to Makefile.target and how to make the list unique to  
avoid warnings.

Andreas


diff --git a/Makefile b/Makefile
index 3177616..8fca061 100644
--- a/Makefile
+++ b/Makefile
@@ -229,6 +229,8 @@ curses.o: curses.c keymaps.h curses_keys.h
  bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)

  libqemu_common.a: $(OBJS)
+	rm libqemu_common.mak
+	for o in $(OBJS); do echo ../$$o >> libqemu_common.mak; done

   
#######################################################################
  # USER_OBJS is code used by qemu userspace emulation
diff --git a/Makefile.hw b/Makefile.hw
index 6accb3b..9555a86 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -33,6 +33,8 @@ all: $(HWLIB)
  	@true

  $(HWLIB): $(OBJS)
+	-rm -f $(HWLIB).list
+	for o in $(OBJS); do echo ../libhw64/$$o >> $(HWLIB).list; done

  clean:
  	rm -f *.o *.d *.a *~
diff --git a/Makefile.target b/Makefile.target
index 27de4b9..8b86b62 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -735,9 +735,9 @@ vl.o: qemu-options.h
  monitor.o: qemu-monitor.h

  $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $ 
(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
-$(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
+$(QEMU_PROG): ARLIBS=libqemu.a
  $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
-	$(call LINK,$(OBJS))
+	$(call LINK,$(OBJS) `cat ../libqemu_common.mak` `cat $(HWLIB).list`)

  endif # !CONFIG_USER_ONLY



[-- Attachment #2: wholearchive-workaround.diff --]
[-- Type: application/octet-stream, Size: 1309 bytes --]

diff --git a/Makefile b/Makefile
index 3177616..8fca061 100644
--- a/Makefile
+++ b/Makefile
@@ -229,6 +229,8 @@ curses.o: curses.c keymaps.h curses_keys.h
 bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
 
 libqemu_common.a: $(OBJS)
+	rm libqemu_common.mak
+	for o in $(OBJS); do echo ../$$o >> libqemu_common.mak; done
 
 #######################################################################
 # USER_OBJS is code used by qemu userspace emulation
diff --git a/Makefile.hw b/Makefile.hw
index 6accb3b..9555a86 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -33,6 +33,8 @@ all: $(HWLIB)
 	@true
 
 $(HWLIB): $(OBJS)
+	-rm -f $(HWLIB).list
+	for o in $(OBJS); do echo ../libhw64/$$o >> $(HWLIB).list; done
 
 clean:
 	rm -f *.o *.d *.a *~
diff --git a/Makefile.target b/Makefile.target
index 27de4b9..8b86b62 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -735,9 +735,9 @@ vl.o: qemu-options.h
 monitor.o: qemu-monitor.h
 
 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
-$(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
+$(QEMU_PROG): ARLIBS=libqemu.a
 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
-	$(call LINK,$(OBJS))
+	$(call LINK,$(OBJS) `cat ../libqemu_common.mak` `cat $(HWLIB).list`)
 
 endif # !CONFIG_USER_ONLY
 

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality)
  2009-06-13 20:40       ` Andreas Färber
@ 2009-06-13 22:15         ` Andreas Färber
  2009-06-14  9:15           ` [Qemu-devel] [RFC] Avoiding --whole-archive Avi Kivity
  2009-11-29 14:17           ` Andreas Färber
  0 siblings, 2 replies; 10+ messages in thread
From: Andreas Färber @ 2009-06-13 22:15 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]


Am 13.06.2009 um 22:40 schrieb Andreas Färber:

> Am 31.05.2009 um 15:29 schrieb Andreas Färber:
>
>> Am 31.05.2009 um 12:15 schrieb Anthony Liguori:
>>
>>>>> Starting with this commit, qemu-system-sparc segfaults  
>>>>> immediately;
>>>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc  
>>>>> (Fix
>>>>> segv when passing an unknown protocol) to no longer segfault, now
>>>>> printing "qemu: could not read disk image /path/to/image".
>>>
>>> I would assume -z,allextract isn't doing what we would like it to  
>>> do on
>>> OpenSolaris.
[...]
> your assumption was actually right.
[...]
> it seems linking object files works while linking static libraries  
> does not.
>
> Architecturally the problem appears to be that the set of objects to  
> link is determined in Makefile and Makefile.hw but is unknown to  
> Makefile.target, where the problematic linking happens.
> As a workaround, I've written the respective set of $(OBJS) to a  
> file when linking and appending them to the LINK command. Except for  
> two warnings (../aio.h and ../cache-utils.o linked twice) this works  
> fine and makes BeOS boot up again.

I came up with another workaround myself, that is using Makefile  
pseudotargets plus some Makefile magic to fetch the contents of $ 
(OBJS) from Makefile.target. I then misuse the $(sort ) function to  
eliminate duplicates and thus linker warnings.

Linux/sparc and BeOS/i386 still boot okay despite the reordering.

Comments? Better ideas?

Andreas


diff --git a/Makefile b/Makefile
index 3177616..0e7359c 100644
--- a/Makefile
+++ b/Makefile
@@ -230,6 +230,9 @@ bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)

  libqemu_common.a: $(OBJS)

+libqemu_common.a-OBJS:
+	@for o in $(OBJS); do echo ../$$o; done
+
   
#######################################################################
  # USER_OBJS is code used by qemu userspace emulation
  USER_OBJS=cutils.o  cache-utils.o
diff --git a/Makefile.hw b/Makefile.hw
index 6accb3b..a3ba6f7 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -34,6 +34,9 @@ all: $(HWLIB)

  $(HWLIB): $(OBJS)

+$(HWLIB)-OBJS:
+	@for o in $(OBJS); do echo ../$(notdir $(abspath .))/$$o; done
+
  clean:
  	rm -f *.o *.d *.a *~

diff --git a/Makefile.target b/Makefile.target
index 27de4b9..71b6133 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -735,9 +735,9 @@ vl.o: qemu-options.h
  monitor.o: qemu-monitor.h

  $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $ 
(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
-$(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
+$(QEMU_PROG): ARLIBS=libqemu.a
  $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
-	$(call LINK,$(OBJS))
+	$(call LINK,$(sort $(OBJS) $(shell $(MAKE) -C .. --no-print- 
directory libqemu_common.a-OBJS) $(shell $(MAKE) -C $(dir $(HWLIB)) -- 
no-print-directory $(notdir $(HWLIB))-OBJS)))

  endif # !CONFIG_USER_ONLY



[-- Attachment #2: wholearchive-workaround2.diff --]
[-- Type: application/octet-stream, Size: 1376 bytes --]

diff --git a/Makefile b/Makefile
index 3177616..0e7359c 100644
--- a/Makefile
+++ b/Makefile
@@ -230,6 +230,9 @@ bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
 
 libqemu_common.a: $(OBJS)
 
+libqemu_common.a-OBJS:
+	@for o in $(OBJS); do echo ../$$o; done
+
 #######################################################################
 # USER_OBJS is code used by qemu userspace emulation
 USER_OBJS=cutils.o  cache-utils.o
diff --git a/Makefile.hw b/Makefile.hw
index 6accb3b..a3ba6f7 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -34,6 +34,9 @@ all: $(HWLIB)
 
 $(HWLIB): $(OBJS)
 
+$(HWLIB)-OBJS:
+	@for o in $(OBJS); do echo ../$(notdir $(abspath .))/$$o; done
+
 clean:
 	rm -f *.o *.d *.a *~
 
diff --git a/Makefile.target b/Makefile.target
index 27de4b9..71b6133 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -735,9 +735,9 @@ vl.o: qemu-options.h
 monitor.o: qemu-monitor.h
 
 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
-$(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
+$(QEMU_PROG): ARLIBS=libqemu.a
 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
-	$(call LINK,$(OBJS))
+	$(call LINK,$(sort $(OBJS) $(shell $(MAKE) -C .. --no-print-directory libqemu_common.a-OBJS) $(shell $(MAKE) -C $(dir $(HWLIB)) --no-print-directory $(notdir $(HWLIB))-OBJS)))
 
 endif # !CONFIG_USER_ONLY
 

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC] Avoiding --whole-archive
  2009-06-13 22:15         ` [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality) Andreas Färber
@ 2009-06-14  9:15           ` Avi Kivity
  2009-11-29 14:17           ` Andreas Färber
  1 sibling, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-06-14  9:15 UTC (permalink / raw)
  To: Andreas Färber; +Cc: QEMU Developers

Andreas Färber wrote:
>> it seems linking object files works while linking static libraries 
>> does not.
>>
>> Architecturally the problem appears to be that the set of objects to 
>> link is determined in Makefile and Makefile.hw but is unknown to 
>> Makefile.target, where the problematic linking happens.
>> As a workaround, I've written the respective set of $(OBJS) to a file 
>> when linking and appending them to the LINK command. Except for two 
>> warnings (../aio.h and ../cache-utils.o linked twice) this works fine 
>> and makes BeOS boot up again.
>
> I came up with another workaround myself, that is using Makefile 
> pseudotargets plus some Makefile magic to fetch the contents of 
> $(OBJS) from Makefile.target. I then misuse the $(sort ) function to 
> eliminate duplicates and thus linker warnings.
>
> Linux/sparc and BeOS/i386 still boot okay despite the reordering.
>
> Comments? 

Way too clever, IMO.  The danger here is that people will fear to edit 
the makefiles after this.

> Better ideas?
>

Maybe a little bit better:

>
> +libqemu_common.a-OBJS:
> +    @for o in $(OBJS); do echo ../$$o; done
> +

libqemu_common.objlist: $(OBJS)
    echo $(sort $(foreach obj, $^, $(shell readlink -f $(obj)))) > $@



>
>  $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) 
> $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
> -$(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
> +$(QEMU_PROG): ARLIBS=libqemu.a
>  $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
> -    $(call LINK,$(OBJS))
> +    $(call LINK,$(sort $(OBJS) $(shell $(MAKE) -C .. 
> --no-print-directory libqemu_common.a-OBJS) $(shell $(MAKE) -C $(dir 
> $(HWLIB)) --no-print-directory $(notdir $(HWLIB))-OBJS)))
>

Here, depend on libqemu_common.objlist, and link it by including its 
contents in the link command line.

Oh, we could even make .objlist a linker script, except that's probably 
platform specific.

The real fix is building everything from a single makefile.

-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC] Avoiding --whole-archive
  2009-06-13 22:15         ` [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality) Andreas Färber
  2009-06-14  9:15           ` [Qemu-devel] [RFC] Avoiding --whole-archive Avi Kivity
@ 2009-11-29 14:17           ` Andreas Färber
  2009-11-29 18:53             ` Andreas Färber
  2009-11-30  9:00             ` Avi Kivity
  1 sibling, 2 replies; 10+ messages in thread
From: Andreas Färber @ 2009-11-29 14:17 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Avi Kivity, Juan Quintela

Hello,

Am 14.06.2009 um 00:15 schrieb Andreas Färber:

>>> Am 31.05.2009 um 12:15 schrieb Anthony Liguori:
>>>
>>>>>> Starting with this commit, qemu-system-sparc segfaults  
>>>>>> immediately;
>>>>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc  
>>>>>> (Fix
>>>>>> segv when passing an unknown protocol) to no longer segfault, now
>>>>>> printing "qemu: could not read disk image /path/to/image".
>>>>
>>>> I would assume -z,allextract isn't doing what we would like it to  
>>>> do on
>>>> OpenSolaris.

This problem is still around after Juan's Makefile reorganizations.

Before, I had provided two alternative patches:

* The first version wrote the list of libqemu_common.a's and $ 
(HWLIB)'s object files into a text file from Makefile[.hw] that was  
later read in Makefile.target.

* The second version was using dedicated Makefile[.hw] targets for  
printing the object files to stdout for use by Makefile.target,  
avoiding the need to write an intermediate file.

Avi had preferred a variation of the first version for reduced  
complexity.

Other ideas that crossed my mind were:
* using GNU ld directly instead of gcc for linking (broken by -Wl and  
some other LDFLAGS)
* extracting the .a archive to a temporary directory from the target  
Makefile and obtaining the names by `ls *.o` (similar to libtool)

Please decide what a patch should do to be accepted and to finally fix  
this issue.

Thanks,

Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC] Avoiding --whole-archive
  2009-11-29 14:17           ` Andreas Färber
@ 2009-11-29 18:53             ` Andreas Färber
  2009-11-30  9:00             ` Avi Kivity
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2009-11-29 18:53 UTC (permalink / raw)
  To: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 2150 bytes --]


Am 29.11.2009 um 15:17 schrieb Andreas Färber:

> Am 14.06.2009 um 00:15 schrieb Andreas Färber:
>
>>>> Am 31.05.2009 um 12:15 schrieb Anthony Liguori:
>>>>
>>>>>>> Starting with this commit, qemu-system-sparc segfaults  
>>>>>>> immediately;
>>>>>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc  
>>>>>>> (Fix
>>>>>>> segv when passing an unknown protocol) to no longer segfault,  
>>>>>>> now
>>>>>>> printing "qemu: could not read disk image /path/to/image".
>>>>>
>>>>> I would assume -z,allextract isn't doing what we would like it  
>>>>> to do on
>>>>> OpenSolaris.
>
> This problem is still around after Juan's Makefile reorganizations.
>
> Before, I had provided two alternative patches:
>
> * The first version wrote the list of libqemu_common.a's and $ 
> (HWLIB)'s object files into a text file from Makefile[.hw] that was  
> later read in Makefile.target.
>
> * The second version was using dedicated Makefile[.hw] targets for  
> printing the object files to stdout for use by Makefile.target,  
> avoiding the need to write an intermediate file.
>
> Avi had preferred a variation of the first version for reduced  
> complexity.
>
> Other ideas that crossed my mind were:
> * using GNU ld directly instead of gcc for linking (broken by -Wl  
> and some other LDFLAGS)
> * extracting the .a archive to a temporary directory from the target  
> Makefile and obtaining the names by `ls *.o` (similar to libtool)

The attached patches showcase the latter. $(ARLIBS) are extracted  
to .tmpobjs/<libname>/ and their *.o objects are linked individually.  
Filtering to *.o was necessary because on OSX archives contain non-.o  
files that otherwise break compilation.
The extraction showed that libqemu_common.a contains two nbd.o files,  
one from ./nbd.c and one from ./block/nbd.c. The second patch thus  
renames block/nbd.o to distinguish the two and to avoid linker errors.  
A more permanent solution would be to rename the nbd.c file.
With those two patches once again QEMU works on both OpenSolaris and  
Mac OS X, for in-tree and out-of-tree builds.

Andreas

[-- Attachment #2: arlibs-extract.diff --]
[-- Type: application/octet-stream, Size: 1194 bytes --]

diff --git a/rules.mak b/rules.mak
index 59cb185..6bbd292 100644
--- a/rules.mak
+++ b/rules.mak
@@ -23,7 +23,7 @@ QEMU_CFLAGS += -MMD -MP -MT $@
 	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
 #LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS),"  LINK  $(TARGET_DIR)$@")
-LINK = $(call quiet-command,{ rm -rf .tmpobjs;mkdir .tmpobjs$(foreach arlib,$(ARLIBS),;(mkdir .tmpobjs/$(notdir $(arlib));cd .tmpobjs/$(notdir $(arlib)) && ar x ../../$(arlib)));$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(foreach arlib,$(ARLIBS),$(foreach obj,$(shell $(AR) t $(arlib)),.tmpobjs/$(notdir $(arlib))/$(obj))) $(LIBS);},"  LINK  $(TARGET_DIR)$@")
+LINK = $(call quiet-command,{ rm -rf .tmpobjs;mkdir .tmpobjs$(foreach arlib,$(ARLIBS),;(mkdir .tmpobjs/$(notdir $(arlib));cd .tmpobjs/$(notdir $(arlib)) && ar x ../../$(arlib)));$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(foreach arlib,$(ARLIBS),$(foreach obj,$(filter %.o,$(shell $(AR) t $(arlib))),.tmpobjs/$(notdir $(arlib))/$(obj))) $(LIBS);},"  LINK  $(TARGET_DIR)$@")
 
 %$(EXESUF): %.o
 	$(call LINK,$^)

[-- Attachment #3: arlibs-nbd.diff --]
[-- Type: application/octet-stream, Size: 746 bytes --]

diff --git a/Makefile b/Makefile
index 63a7128..69df44c 100644
--- a/Makefile
+++ b/Makefile
@@ -91,11 +91,14 @@ block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
 
 block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
 block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
-block-nested-y += parallels.o nbd.o
+block-nested-y += parallels.o nbd--.o
 block-nested-$(CONFIG_WIN32) += raw-win32.o
 block-nested-$(CONFIG_POSIX) += raw-posix.o
 block-nested-$(CONFIG_CURL) += curl.o
 
+block/nbd--.o: block/nbd.c $(GENERATED_HEADERS)
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
+
 block-obj-y +=  $(addprefix block/, $(block-nested-y))
 
 net-obj-y = net.o

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC] Avoiding --whole-archive
  2009-11-29 14:17           ` Andreas Färber
  2009-11-29 18:53             ` Andreas Färber
@ 2009-11-30  9:00             ` Avi Kivity
  1 sibling, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-11-30  9:00 UTC (permalink / raw)
  To: Andreas Färber; +Cc: QEMU Developers, Juan Quintela

On 11/29/2009 04:17 PM, Andreas Färber wrote:
>
> This problem is still around after Juan's Makefile reorganizations.
>
> Before, I had provided two alternative patches:
>
> * The first version wrote the list of libqemu_common.a's and 
> $(HWLIB)'s object files into a text file from Makefile[.hw] that was 
> later read in Makefile.target.
>
> * The second version was using dedicated Makefile[.hw] targets for 
> printing the object files to stdout for use by Makefile.target, 
> avoiding the need to write an intermediate file.
>
> Avi had preferred a variation of the first version for reduced 
> complexity.
>
> Other ideas that crossed my mind were:
> * using GNU ld directly instead of gcc for linking (broken by -Wl and 
> some other LDFLAGS)

Using ld directly may break link-time optimization when that arrives.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-11-30  9:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616D744F-F31E-4E96-9A23-1664C78313FD@web.de>
2009-05-30 17:49 ` [Qemu-devel] Fwd: [Qemu-commits] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality Andreas Färber
2009-05-31 10:15   ` Anthony Liguori
2009-05-31 11:26     ` Avi Kivity
2009-05-31 13:29     ` [Qemu-devel] " Andreas Färber
2009-06-13 20:40       ` Andreas Färber
2009-06-13 22:15         ` [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality) Andreas Färber
2009-06-14  9:15           ` [Qemu-devel] [RFC] Avoiding --whole-archive Avi Kivity
2009-11-29 14:17           ` Andreas Färber
2009-11-29 18:53             ` Andreas Färber
2009-11-30  9:00             ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.