Skip to contentSkip to conversation

bsd-user: Fix linking/dependency issues

PATCH In review Sean Bruno 5 participants 12 messages Jun 15, 2014 – Jun 16, 2014

lore
Share & tools
lore

Sean Bruno

author
#0 lore raw

v2 cover bsd-user: Fix linking/dependency issues

v2
Correct email address for Ed Maste

Recent changes to master caused complete failures to build bsd-user.

Sean Bruno (3):
bsd-user: Revert part of c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e
bsd-user: Add patches to fix AES_* link errors
bsd-user: Implement strace support for getcwd syscall

 bsd-user/freebsd/strace.list | 1 +
 include/qemu/aes.h           | 9 +++++++++
 rules.mak                    | 3 ++-
 3 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH v2 1/3 bsd-user: Revert part of update to rules.mk

In c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e rules.mk change was causing complete failure on bsd-user when not using --disable-curl

---
 rules.mak | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
rules.mak +2 -1
index dde8e00..4a33c27 100644
@@ -22,7 +22,8 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 # Same as -I$(SRC_PATH) -I., but for the nested source/object directories
 QEMU_INCLUDES += -I$(<D) -I$(@D)
 
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))))
+extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))) \
+                  $(foreach o,$(call expand-objs,$1),$($o-libs)))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
                   $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                   $(filter-out %.o %.mo,$1))
Signature · 1 line
1.9.3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Quoted 13 lines · Sean Bruno

In c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e rules.mk change was causing complete failure on bsd-user when not using --disable-curl

---
 rules.mak | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
rules.mak +0 -0
index dde8e00..4a33c27 100644

rules.mak QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d · line 29

Quoted 9 lines
rules.mak +2 -1
@@ -22,7 +22,8 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 # Same as -I$(SRC_PATH) -I., but for the nested source/object directories
 QEMU_INCLUDES += -I$(<D) -I$(@D)
 
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))))
+extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))) \
+                  $(foreach o,$(call expand-objs,$1),$($o-libs)))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
                   $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                   $(filter-out %.o %.mo,$1))

Fam, Paolo: looks like this extract-libs rune is stil causing problems :-(

thanks
-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Quoted 17 lines · Peter Maydell
Quoted 16 lines · Sean Bruno

In c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e rules.mk change was causing complete failure on bsd-user when not using --disable-curl

---
 rules.mak | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
rules.mak +0 -0
index dde8e00..4a33c27 100644
@@ -22,7 +22,8 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 # Same as -I$(SRC_PATH) -I., but for the nested source/object directories
 QEMU_INCLUDES += -I$(<D) -I$(@D)
 
Quoted 9 lines

rules.mak QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d · line 29

Quoted 6 lines
rules.mak +2 -1
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))))
+extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))) \
+                  $(foreach o,$(call expand-objs,$1),$($o-libs)))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
                   $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                   $(filter-out %.o %.mo,$1))

Fam, Paolo: looks like this extract-libs rune is stil causing problems :-(

Sean, could you show the configure command line?

Thanks,
Fam

#4 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Il 16/06/2014 11:12, Fam Zheng ha scritto:

Quoted 28 lines · Peter Maydell
Quoted 17 lines · Sean Bruno
Quoted 16 lines

In c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e rules.mk change was causing complete failure on bsd-user when not using --disable-curl

---
 rules.mak | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
rules.mak +0 -0
index dde8e00..4a33c27 100644
@@ -22,7 +22,8 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 # Same as -I$(SRC_PATH) -I., but for the nested source/object directories
 QEMU_INCLUDES += -I$(<D) -I$(@D)
 
Quoted 9 lines

rules.mak QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d · line 29

Quoted 6 lines
rules.mak +2 -1
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))))
+extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))) \
+                  $(foreach o,$(call expand-objs,$1),$($o-libs)))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
                   $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                   $(filter-out %.o %.mo,$1))

Fam, Paolo: looks like this extract-libs rune is stil causing problems :-(

Quoted 1 line

Sean, could you show the configure command line?

Also please attach the "make V=1" output and config-host.mak file.

Paolo

#5 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Quoted 7 lines
Quoted 1 line

Sean, could you show the configure command line?

Also please attach the "make V=1" output and config-host.mak file.

Paolo

I'm using:

./configure --static --target-list="i386-bsd-user sparc-bsd-user
sparc64-bsd-user x86_64-bsd-user"

Log:
http://people.freebsd.org/~sbruno/qemu_build_fail.txt

sean

#6 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Quoted 10 lines · Sean Bruno
Quoted 7 lines
Quoted 1 line

Sean, could you show the configure command line?

Also please attach the "make V=1" output and config-host.mak file.

Paolo

I'm using:

Quoted 9 lines

./configure --static --target-list="i386-bsd-user sparc-bsd-user
sparc64-bsd-user x86_64-bsd-user"

Log:
http://people.freebsd.org/~sbruno/qemu_build_fail.txt

sean

Also, configure output

http://people.freebsd.org/~sbruno/qemu_user_configure.txt

sean

#7 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Il 16/06/2014 15:58, Sean Bruno ha scritto:

Quoted 17 lines · Sean Bruno
Quoted 16 lines
Quoted 7 lines
Quoted 1 line

Sean, could you show the configure command line?

Also please attach the "make V=1" output and config-host.mak file.

Paolo

I'm using:

./configure --static --target-list="i386-bsd-user sparc-bsd-user
sparc64-bsd-user x86_64-bsd-user"

Log:
http://people.freebsd.org/~sbruno/qemu_build_fail.txt

Quoted 7 lines
Quoted 3 lines

sean

Also, configure output

http://people.freebsd.org/~sbruno/qemu_user_configure.txt

So this is happening because the $(sort) removes the ordering between libraries and breaks static linking. Your patch likely does nothing except adding more copies of the libraries, which lets the linker work.

The executable that breaks is qemu-nbd, which I suspect you couldn't care less about.

The bug remains, and ought to be fixed, probably like this:

rules.mak +1 -1
index dde8e00..50b305e 100644
@@ -22,7 +22,7 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 # Same as -I$(SRC_PATH) -I., but for the nested source/object directories
 QEMU_INCLUDES += -I$(<D) -I$(@D)
 
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))))
+extract-libs = $(foreach o,$1,$($o-libs))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
                   $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                   $(filter-out %.o %.mo,$1))

but the other question is: do we care about static linking of anything except the user-mode emulators? Should --static automatically imply --disable-tools --disable-system?

Paolo

#8 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

Quoted 49 lines · Paolo Bonzini

Il 16/06/2014 15:58, Sean Bruno ha scritto:

Quoted 17 lines · Sean Bruno
Quoted 16 lines
Quoted 7 lines
Quoted 1 line

Sean, could you show the configure command line?

Also please attach the "make V=1" output and config-host.mak file.

Paolo

I'm using:

./configure --static --target-list="i386-bsd-user sparc-bsd-user
sparc64-bsd-user x86_64-bsd-user"

Log:
http://people.freebsd.org/~sbruno/qemu_build_fail.txt

Quoted 7 lines
Quoted 3 lines

sean

Also, configure output

http://people.freebsd.org/~sbruno/qemu_user_configure.txt

So this is happening because the $(sort) removes the ordering between libraries and breaks static linking. Your patch likely does nothing except adding more copies of the libraries, which lets the linker work.

The executable that breaks is qemu-nbd, which I suspect you couldn't care less about.

The bug remains, and ought to be fixed, probably like this:

rules.mak +1 -1
index dde8e00..50b305e 100644
@@ -22,7 +22,7 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
  # Same as -I$(SRC_PATH) -I., but for the nested source/object directories
  QEMU_INCLUDES += -I$(<D) -I$(@D)
 
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))))
+extract-libs = $(foreach o,$1,$($o-libs))
  expand-objs = $(strip $(sort $(filter %.o,$1)) \
                    $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                    $(filter-out %.o %.mo,$1))
Quoted 5 lines

but the other question is: do we care about static linking of anything except the user-mode emulators? Should --static automatically imply --disable-tools --disable-system?

Paolo

Seems like this works for me on FreeBSD with my test case.

sean

#9 lore raw

Re: [Qemu-devel] [PATCH 1/3 v2] bsd-user: Revert part of update to rules.mk

In reply to Paolo Bonzini
Quoted 3 lines · Paolo Bonzini

but the other question is: do we care about static linking of anything except the user-mode emulators? Should --static automatically imply --disable-tools --disable-system?

It's certainly tempting. No doubt somebody somewhere is using the statically linked config, of course...

thanks
-- PMM

author
#10 lore raw

PATCH v2 2/3 bsd-user: Add patches to fix AES_* link errors

In reply to Sean Bruno

Redefine functions as QEMU_AES_* to avoid conflicts with AES_* in -lcrypto needed (at least) by -lcurl.

Take from emulators/qemu-devel/files/patch-include-qemu-aes.h

---
 include/qemu/aes.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/qemu/aes.h +9 -0
index e79c707..d310411 100644
@@ -10,6 +10,15 @@ struct aes_key_st {
 };
 typedef struct aes_key_st AES_KEY;
 
+/* FreeBSD has it's own AES_set_decrypt_key in -lcrypto, avoid conflicts */
+#ifdef __FreeBSD__
+#define AES_set_encrypt_key QEMU_AES_set_encrypt_key
+#define AES_set_decrypt_key QEMU_AES_set_decrypt_key
+#define AES_encrypt QEMU_AES_encrypt
+#define AES_decrypt QEMU_AES_decrypt
+#define AES_cbc_encrypt QEMU_AES_cbc_encrypt
+#endif
+
 int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
 	AES_KEY *key);
 int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
Signature · 1 line
1.9.3
author
#11 lore raw

PATCH v2 3/3 bsd-user: Implement strace support for getcwd syscall

In reply to Sean Bruno
---
 bsd-user/freebsd/strace.list | 1 +
 1 file changed, 1 insertion(+)
bsd-user/freebsd/strace.list +1 -0
index 2800a2d..f10caaa 100644
@@ -28,6 +28,7 @@
 { TARGET_FREEBSD_NR___acl_set_fd, "__acl_set_fd", "%s(%d, %d, %#x)", NULL, NULL },
 { TARGET_FREEBSD_NR___acl_set_file, "__acl_set_file", "%s(\"%s\", %d, %#x)", NULL, NULL },
 { TARGET_FREEBSD_NR___acl_set_link, "__acl_set_link", "%s(\"%s\", %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___getcwd, "__getcwd", NULL, NULL, NULL },
 { TARGET_FREEBSD_NR___semctl, "__semctl", NULL, NULL, NULL },
 { TARGET_FREEBSD_NR___syscall, "__syscall", NULL, NULL, NULL },
 { TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, print_sysctl, NULL },
Signature · 1 line
1.9.3