Hello 정복득,

thanks for reporting. I gave both issues a go.

On Tue, Jul 10, 2012 at 11:57:51AM +0000, 정복득 wrote:
> I have two problems with compiling my program. One is that I cannot
> get correct output with Genode::printf or sprintf for (unsigend)
> long long values.

I could not reproduce this with current Genode master. The code [1]
produces the expected output:

  [init -> test-ll_var] result of test_buf:1234567801234
  [init -> test-ll_var] llu_var:1234567801234

Could you please test again with my test branch/the attached patch?

> Another one is that I get compilation errors as below:
> 
> error message:
> /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o):
>  In function '__cxa_begin_catch':
> (.text.__cxa_begin_catch+0xc0): undefined reference to '__Unwind_Complete'
> /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o):
>  In function '__cxa_end_catch':
> (.text.__cxa_end_catch+0x30): undefined reference to 
> '__Unwind_DeleteException'
> /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o):
>  In function '__cxa_end_catch':
> (.text.__cxa_end_catch+0xdc): undefined reference to 
> '__Unwind_DeleteException'
> collect2: ld returned 1 exit status
> make[2]: *** [mytest] Error 1

This indeed seems to be a bug in Genode and I opened a new issue
https://github.com/genodelabs/genode/issues/275 using this code [2].
We will investigate this further and report here.

[1] https://github.com/chelmuth/genode/tree/test-ll_var  or
    attachment test-ll_var.patch
[2] https://github.com/chelmuth/genode/tree/test-sstream  or
    attachment test-sstream.patch

Regards
-- 
Christian Helmuth
Genode Labs

http://www.genode-labs.com/ · http://genode.org/ · /ˈdʒiː.nəʊd/

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
commit 35ba6a38a65f7435b219045e8e7863b89d397586 (HEAD, chelmuth/test-ll_var, test-ll_var)
Author: Christian Helmuth <[email protected]>
Date:   Tue Jul 10 21:03:17 2012 +0200

    Testing long long sprintf/printf on foc_pbxa9

diff --git a/libports/run/ll_var.run b/libports/run/ll_var.run
new file mode 100644
index 0000000..eeaa037
--- /dev/null
+++ b/libports/run/ll_var.run
@@ -0,0 +1,26 @@
+build "core init test/ll_var"
+
+create_boot_directory
+
+install_config {
+	<config>
+		<parent-provides>
+			<service name="ROM"/>
+			<service name="LOG"/>
+			<service name="RM" />
+		</parent-provides>
+		<default-route>
+			<any-service> <parent/> </any-service>
+		</default-route>
+		<start name="test-ll_var">
+			<resource name="RAM" quantum="1M"/>
+		</start>
+	</config>
+}
+
+build_boot_image "core init test-ll_var libc.lib.so ld.lib.so"
+
+append qemu_args "-nographic -m 64"
+
+run_genode_until forever
+
diff --git a/libports/src/test/ll_var/main.cc b/libports/src/test/ll_var/main.cc
new file mode 100644
index 0000000..4981c0d
--- /dev/null
+++ b/libports/src/test/ll_var/main.cc
@@ -0,0 +1,14 @@
+#include <base/printf.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+
+
+int main()
+{
+	char test_buf[24];
+	uint64_t llu_var = 1234567801234ULL;
+	sprintf(test_buf, "%llu", llu_var);
+	Genode::printf("result of test_buf:%s\n", test_buf);
+	Genode::printf("llu_var:%llu\n", llu_var);
+}
diff --git a/libports/src/test/ll_var/target.mk b/libports/src/test/ll_var/target.mk
new file mode 100644
index 0000000..88e81e8
--- /dev/null
+++ b/libports/src/test/ll_var/target.mk
@@ -0,0 +1,3 @@
+TARGET   = test-ll_var
+SRC_CC   = main.cc
+LIBS    += env cxx libc
commit 5fa4f0743652cc2772b8ffcfbbd90e1ac4b4d72d (HEAD, chelmuth/test-sstream, test-sstream)
Author: Christian Helmuth <[email protected]>
Date:   Tue Jul 10 21:24:00 2012 +0200

    stdcxx: linker errors with <sstream>, issue #275

diff --git a/libports/run/sstream.run b/libports/run/sstream.run
new file mode 100644
index 0000000..831cef3
--- /dev/null
+++ b/libports/run/sstream.run
@@ -0,0 +1,26 @@
+build "core init test/sstream"
+
+create_boot_directory
+
+install_config {
+	<config>
+		<parent-provides>
+			<service name="ROM"/>
+			<service name="LOG"/>
+			<service name="RM" />
+		</parent-provides>
+		<default-route>
+			<any-service> <parent/> </any-service>
+		</default-route>
+		<start name="test-sstream">
+			<resource name="RAM" quantum="1M"/>
+		</start>
+	</config>
+}
+
+build_boot_image "core init test-sstream libc.lib.so ld.lib.so"
+
+append qemu_args "-nographic -m 64"
+
+run_genode_until forever
+
diff --git a/libports/src/test/sstream/main.cc b/libports/src/test/sstream/main.cc
new file mode 100644
index 0000000..cac5a1d
--- /dev/null
+++ b/libports/src/test/sstream/main.cc
@@ -0,0 +1,25 @@
+#include <base/printf.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+#include <sstream>
+
+using namespace std;
+
+template <typename T>
+inline string to_string(const T& t)
+{
+	stringstream ss;
+	ss << t;
+	return ss.str();
+}
+
+
+int main()
+{
+	int64_t value = 1023456LL;
+	Genode::printf("sstream value:%lld, to_string:%s\n", value, to_string(value).c_str());
+	return 0;
+}
+
diff --git a/libports/src/test/sstream/target.mk b/libports/src/test/sstream/target.mk
new file mode 100644
index 0000000..51739ae
--- /dev/null
+++ b/libports/src/test/sstream/target.mk
@@ -0,0 +1,5 @@
+TARGET = test-sstream
+SRC_CC = main.cc
+LIBS   = stdcxx libc
+
+CC_OPT = -D_GLIBCXX_HAVE_MBSTATE_T
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Genode-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to