All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP]  [PATCH] ldd01: using 'ppc' to check powerpc arch
@ 2014-09-11  2:27 Han Pingtian
  2014-09-11 11:23 ` Poornima Nayak
  2014-09-11 14:41 ` Jan Stancek
  0 siblings, 2 replies; 6+ messages in thread
From: Han Pingtian @ 2014-09-11  2:27 UTC (permalink / raw)
  To: ltp-list

Hello,
The ldd01 always failed on some powerpc systems of ours. I have figured
out a patch. Please take a look. Thanks in advance.


On some powerpc system, the 'uname -a' doesn't show 'powerpc' but will
show 'ppc'. So we need using it to check the powerpc arch.

Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
 testcases/commands/ade/ldd/ldd01 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/ade/ldd/ldd01
index c60d3ac..569902e 100755
--- a/testcases/commands/ade/ldd/ldd01
+++ b/testcases/commands/ade/ldd/ldd01
@@ -47,7 +47,7 @@ do_setup()
 	mkdir $TCtmp
 
 	# Check for ppc64 architecture or x86_64 architecture
-	if uname -a | grep -iq powerpc; then
+	if uname -a | grep -iq 'ppc\|powerpc'; then
 		file lddfile1.obj | grep 64-bit >/dev/null 2>&1
 		if [ $? -eq 0 ]; then
 			CFLAGS="-m64"
-- 
1.9.3


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
  2014-09-11  2:27 [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch Han Pingtian
@ 2014-09-11 11:23 ` Poornima Nayak
  2014-09-11 14:41 ` Jan Stancek
  1 sibling, 0 replies; 6+ messages in thread
From: Poornima Nayak @ 2014-09-11 11:23 UTC (permalink / raw)
  To: Han Pingtian; +Cc: ltp-list


[-- Attachment #1.1: Type: text/plain, Size: 1773 bytes --]

Han Pingtian <hanpt@linux.vnet.ibm.com> wrote on 09/11/2014 07:57:09 AM:

> Han Pingtian <hanpt@linux.vnet.ibm.com> 
> 09/11/2014 07:57 AM
> 
> To
> 
> ltp-list@lists.sourceforge.net
> 
> cc
> 
> Subject
> 
> [LTP]  [PATCH] ldd01: using 'ppc' to check powerpc arch
> 
> Hello,
> The ldd01 always failed on some powerpc systems of ours. I have figured
> out a patch. Please take a look. Thanks in advance.
> 
> 
> On some powerpc system, the 'uname -a' doesn't show 'powerpc' but will
> show 'ppc'. So we need using it to check the powerpc arch.
> 
> Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
> ---
>  testcases/commands/ade/ldd/ldd01 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/
> ade/ldd/ldd01
> index c60d3ac..569902e 100755
> --- a/testcases/commands/ade/ldd/ldd01
> +++ b/testcases/commands/ade/ldd/ldd01
> @@ -47,7 +47,7 @@ do_setup()
>     mkdir $TCtmp
> 
>     # Check for ppc64 architecture or x86_64 architecture
> -   if uname -a | grep -iq powerpc; then
> +   if uname -a | grep -iq 'ppc\|powerpc'; then
>        file lddfile1.obj | grep 64-bit >/dev/null 2>&1
>        if [ $? -eq 0 ]; then
>           CFLAGS="-m64"
> -- 
> 1.9.3
> 
Verified on PPC machine this fix helps
> 
> 
------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> 
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk

> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

[-- Attachment #1.2: Type: text/html, Size: 2870 bytes --]

[-- Attachment #2: Type: text/plain, Size: 306 bytes --]

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk

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

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
  2014-09-11  2:27 [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch Han Pingtian
  2014-09-11 11:23 ` Poornima Nayak
@ 2014-09-11 14:41 ` Jan Stancek
  2014-09-12  7:28   ` Han Pingtian
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Stancek @ 2014-09-11 14:41 UTC (permalink / raw)
  To: ltp-list, Han Pingtian

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

On 09/11/2014 04:27 AM, Han Pingtian wrote:
> Hello,
> The ldd01 always failed on some powerpc systems of ours. I have figured
> out a patch. Please take a look. Thanks in advance.
> 
> 
> On some powerpc system, the 'uname -a' doesn't show 'powerpc' but will
> show 'ppc'. So we need using it to check the powerpc arch.
> 
> Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
> ---
>  testcases/commands/ade/ldd/ldd01 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/ade/ldd/ldd01
> index c60d3ac..569902e 100755
> --- a/testcases/commands/ade/ldd/ldd01
> +++ b/testcases/commands/ade/ldd/ldd01
> @@ -47,7 +47,7 @@ do_setup()
>  	mkdir $TCtmp
>  
>  	# Check for ppc64 architecture or x86_64 architecture
> -	if uname -a | grep -iq powerpc; then
> +	if uname -a | grep -iq 'ppc\|powerpc'; then
>  		file lddfile1.obj | grep 64-bit >/dev/null 2>&1
>  		if [ $? -eq 0 ]; then
>  			CFLAGS="-m64"


Hi,

what is the purpose of those -m32/-m64 flags in this test?
Can't we just compile it with LTP makefiles using whatever CFLAGS
were passed to configure?

Would you be willing to try attached patch, which moves the build
of .so and a.out into Makefile? I have tested it on x86 with and
without -m32 and it worked fine. Or alternatively, can you describe
the ppc system where this is failing, so I could try to reproduce
it myself?

Regards,
Jan





[-- Attachment #2: 0001-v1.patch --]
[-- Type: text/x-patch, Size: 4998 bytes --]

From 1ea966268e7a55f21d9254b62462d4adb40c7a0a Mon Sep 17 00:00:00 2001
Message-Id: <1ea966268e7a55f21d9254b62462d4adb40c7a0a.1410445852.git.jstancek@redhat.com>
From: Jan Stancek <jstancek@redhat.com>
Date: Thu, 11 Sep 2014 14:57:37 +0200
Subject: [PATCH] v1

---
 testcases/commands/ade/ldd/Makefile   |   13 +++++++++++--
 testcases/commands/ade/ldd/ldd01      |   28 ++++------------------------
 testcases/commands/ade/ldd/lddfile1.c |    2 +-
 testcases/commands/ade/ldd/lddfile2.c |    2 +-
 testcases/commands/ade/ldd/lddfile3.c |    2 +-
 testcases/commands/ade/ldd/lddfile4.c |    2 +-
 testcases/commands/ade/ldd/lddfile5.c |    2 +-
 7 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/testcases/commands/ade/ldd/Makefile b/testcases/commands/ade/ldd/Makefile
index eae06cd..7119290 100644
--- a/testcases/commands/ade/ldd/Makefile
+++ b/testcases/commands/ade/ldd/Makefile
@@ -28,9 +28,18 @@ CPPFLAGS		+= -fpic
 
 INSTALL_TARGETS		:= ldd01
 
-MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%.obj,$(wildcard $(abs_srcdir)/*.c))
+LDD_C_FILES		:= $(wildcard $(abs_srcdir)/lddfile*.c)
+LDD_SO_FILES		:= $(patsubst $(abs_srcdir)/%.c,%.obj.so,$(LDD_C_FILES))
+MAKE_TARGETS		:= $(LDD_SO_FILES) lddfile.out
+CLEAN_TARGETS		+= *.obj
 
-$(MAKE_TARGETS): %.obj: %.o
+%.obj: %.o
 	mv $^ $@
 
+%.obj.so: %.obj
+	$(CC) $(CFLAGS) -shared -o $@ $^
+
+lddfile.out: main.obj $(LDD_SO_FILES)
+	$(CC) $(CFLAGS) -O -o $@ $(LDD_SO_FILES) main.obj
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/ade/ldd/ldd01
index c60d3ac..54188f7 100755
--- a/testcases/commands/ade/ldd/ldd01
+++ b/testcases/commands/ade/ldd/ldd01
@@ -35,42 +35,22 @@ $trace_logic
 CC=${CC:=gcc}
 LDD=${LDD:=ldd}
 TCdat=${TCdat:-`pwd`}
-TCtmp=${TCtmp:-/tmp/ldd01-$$}
 
 do_cleanup()
 {
-	rm -rf $TCtmp
+	:
 }
 
 do_setup()
 {
-	mkdir $TCtmp
-
-	# Check for ppc64 architecture or x86_64 architecture
-	if uname -a | grep -iq powerpc; then
-		file lddfile1.obj | grep 64-bit >/dev/null 2>&1
-		if [ $? -eq 0 ]; then
-			CFLAGS="-m64"
-		fi
-	elif uname -a | grep -iq x86_64; then
-		file lddfile1.obj | grep 32-bit >/dev/null 2>&1
-		if [ $? -eq 0 ]; then
-			CFLAGS="-m32"
-		fi
-	fi
-	$CC $CFLAGS -shared -o $TCtmp/lddfile1.obj.so $TCdat/lddfile1.obj
-	$CC $CFLAGS -shared -o $TCtmp/lddfile2.obj.so $TCdat/lddfile2.obj
-	$CC $CFLAGS -shared -o $TCtmp/lddfile3.obj.so $TCdat/lddfile3.obj
-	$CC $CFLAGS -shared -o $TCtmp/lddfile4.obj.so $TCdat/lddfile4.obj
-	$CC $CFLAGS -shared -o $TCtmp/lddfile5.obj.so $TCdat/lddfile5.obj
-	$CC $CFLAGS -O -o $TCtmp/a.out $TCtmp/lddfile*.obj.so $TCdat/main.obj
+	:
 }
 
 do_test()
 {
 	echo "  ASSERTION 1  "
 
-	$LDD $TCtmp/a.out | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
+	$LDD lddfile.out | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
 	if [ $? -eq 0 ]; then
 		echo "ASSERTION #1 PASS"
 	else
@@ -81,7 +61,7 @@ do_test()
 
 	echo " ASSERTION 2  "
 
-	$LDD -v $TCtmp/a.out | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
+	$LDD -v lddfile.out | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
 	if [ $? -eq 0 ]; then
 		echo "ASSERTION #2 PASS"
 	else
diff --git a/testcases/commands/ade/ldd/lddfile1.c b/testcases/commands/ade/ldd/lddfile1.c
index 377f7a3..ccb5786 100644
--- a/testcases/commands/ade/ldd/lddfile1.c
+++ b/testcases/commands/ade/ldd/lddfile1.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-void file1()
+void file1(void)
 {
 	printf("Control in function %s\n", __func__);
 }
diff --git a/testcases/commands/ade/ldd/lddfile2.c b/testcases/commands/ade/ldd/lddfile2.c
index 5fd2b4b..20aede3 100644
--- a/testcases/commands/ade/ldd/lddfile2.c
+++ b/testcases/commands/ade/ldd/lddfile2.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-void file2()
+void file2(void)
 {
 	printf("Control in function %s\n", __func__);
 }
diff --git a/testcases/commands/ade/ldd/lddfile3.c b/testcases/commands/ade/ldd/lddfile3.c
index d6b4cc9..a4529f7 100644
--- a/testcases/commands/ade/ldd/lddfile3.c
+++ b/testcases/commands/ade/ldd/lddfile3.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-void file3()
+void file3(void)
 {
 	printf("Control in function %s\n", __func__);
 }
diff --git a/testcases/commands/ade/ldd/lddfile4.c b/testcases/commands/ade/ldd/lddfile4.c
index 1db89bb..9dc339d 100644
--- a/testcases/commands/ade/ldd/lddfile4.c
+++ b/testcases/commands/ade/ldd/lddfile4.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-void file4()
+void file4(void)
 {
 	printf("Control in function %s\n", __func__);
 }
diff --git a/testcases/commands/ade/ldd/lddfile5.c b/testcases/commands/ade/ldd/lddfile5.c
index 2f46cdb..3fbb7f6 100644
--- a/testcases/commands/ade/ldd/lddfile5.c
+++ b/testcases/commands/ade/ldd/lddfile5.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-void file5()
+void file5(void)
 {
 	printf("Control in function %s\n", __func__);
 }
-- 
1.7.1


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

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
  2014-09-11 14:41 ` Jan Stancek
@ 2014-09-12  7:28   ` Han Pingtian
  2014-09-12  8:15     ` Jan Stancek
  0 siblings, 1 reply; 6+ messages in thread
From: Han Pingtian @ 2014-09-12  7:28 UTC (permalink / raw)
  To: ltp-list

On Thu, Sep 11, 2014 at 04:41:29PM +0200, Jan Stancek wrote:
> Would you be willing to try attached patch, which moves the build
> of .so and a.out into Makefile? 
I have tested your patch but ldd cannot find the lib files:

% sudo ./ldd01 
  ASSERTION 1  
        lddfile1.obj.so => not found
        lddfile2.obj.so => not found
        lddfile3.obj.so => not found
        lddfile4.obj.so => not found
        lddfile5.obj.so => not found
ASSERTION #1 PASS
 ASSERTION 2  
        lddfile1.obj.so => not found
        lddfile2.obj.so => not found
        lddfile3.obj.so => not found
        lddfile4.obj.so => not found
        lddfile5.obj.so => not found
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
                ld64.so.1 (GLIBC_PRIVATE) => /lib64/ld64.so.1
                ld64.so.1 (GLIBC_2.3) => /lib64/ld64.so.1
ASSERTION #2 PASS
TEST PASSES

on the contray, with my patch lib files can be found:

% ./ldd01
  ASSERTION 1  
        /tmp/ldd01-9497/lddfile1.obj.so (0x00000fffad800000)
        /tmp/ldd01-9497/lddfile2.obj.so (0x00000fffad7e0000)
        /tmp/ldd01-9497/lddfile3.obj.so (0x00000fffad7c0000)
        /tmp/ldd01-9497/lddfile4.obj.so (0x00000fffad7a0000)
        /tmp/ldd01-9497/lddfile5.obj.so (0x00000fffad780000)
ASSERTION #1 PASS
 ASSERTION 2  
        /tmp/ldd01-9497/lddfile1.obj.so (0x00000fffb1d20000)
        /tmp/ldd01-9497/lddfile2.obj.so (0x00000fffb1d00000)
        /tmp/ldd01-9497/lddfile3.obj.so (0x00000fffb1ce0000)
        /tmp/ldd01-9497/lddfile4.obj.so (0x00000fffb1cc0000)
        /tmp/ldd01-9497/lddfile5.obj.so (0x00000fffb1ca0000)
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
        /tmp/ldd01-9497/lddfile1.obj.so:
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
        /tmp/ldd01-9497/lddfile2.obj.so:
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
        /tmp/ldd01-9497/lddfile3.obj.so:
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
        /tmp/ldd01-9497/lddfile4.obj.so:
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
        /tmp/ldd01-9497/lddfile5.obj.so:
                libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
                ld64.so.1 (GLIBC_PRIVATE) => /lib64/ld64.so.1
                ld64.so.1 (GLIBC_2.3) => /lib64/ld64.so.1
ASSERTION #2 PASS
TEST PASSES


> Or alternatively, can you describe
> the ppc system where this is failing, so I could try to reproduce
> it myself?
This is a power 6 system, which running a beta version rhel5.11. Without
my patch, it failed with those messages:

% ./ldd01
/usr/bin/ld: warning: powerpc:common64 architecture of input file `/testcases/ltp/testcases/commands/ade/ldd/lddfile1.obj' is incompatible with powerpc:common output
/usr/bin/ld: warning: powerpc:common64 architecture of input file `/testcases/ltp/testcases/commands/ade/ldd/lddfile2.obj' is incompatible with powerpc:common output
/usr/bin/ld: warning: powerpc:common64 architecture of input file `/testcases/ltp/testcases/commands/ade/ldd/lddfile3.obj' is incompatible with powerpc:common output
/usr/bin/ld: warning: powerpc:common64 architecture of input file `/testcases/ltp/testcases/commands/ade/ldd/lddfile4.obj' is incompatible with powerpc:common output
/usr/bin/ld: warning: powerpc:common64 architecture of input file `/testcases/ltp/testcases/commands/ade/ldd/lddfile5.obj' is incompatible with powerpc:common output
/usr/bin/ld: warning: powerpc:common64 architecture of input file `/testcases/ltp/testcases/commands/ade/ldd/main.obj' is incompatible with powerpc:common output
/testcases/ltp/testcases/commands/ade/ldd/main.obj: In function `main':
/home/hpt/ltp-full-20130503.64b/testcases/commands/ade/ldd/main.c:11: relocation truncated to fit: R_PPC64_REL24 against `file1'
/home/hpt/ltp-full-20130503.64b/testcases/commands/ade/ldd/main.c:12: relocation truncated to fit: R_PPC64_REL24 against `file2'
/home/hpt/ltp-full-20130503.64b/testcases/commands/ade/ldd/main.c:13: relocation truncated to fit: R_PPC64_REL24 against `file3'
/home/hpt/ltp-full-20130503.64b/testcases/commands/ade/ldd/main.c:14: relocation truncated to fit: R_PPC64_REL24 against `file4'
/home/hpt/ltp-full-20130503.64b/testcases/commands/ade/ldd/main.c:15: relocation truncated to fit: R_PPC64_REL24 against `file5'
/home/hpt/ltp-full-20130503.64b/testcases/commands/ade/ldd/main.c:16: relocation truncated to fit: R_PPC64_REL24 against `puts'
collect2: ld returned 1 exit status
  ASSERTION 1  
ldd: /tmp/ldd01-14133/a.out: No such file or directory
ASSERTION #1 FAIL

> >From 1ea966268e7a55f21d9254b62462d4adb40c7a0a Mon Sep 17 00:00:00 2001
> Message-Id: <1ea966268e7a55f21d9254b62462d4adb40c7a0a.1410445852.git.jstancek@redhat.com>
> From: Jan Stancek <jstancek@redhat.com>
> Date: Thu, 11 Sep 2014 14:57:37 +0200
> Subject: [PATCH] v1
> 
> ---
>  testcases/commands/ade/ldd/Makefile   |   13 +++++++++++--
>  testcases/commands/ade/ldd/ldd01      |   28 ++++------------------------
>  testcases/commands/ade/ldd/lddfile1.c |    2 +-
>  testcases/commands/ade/ldd/lddfile2.c |    2 +-
>  testcases/commands/ade/ldd/lddfile3.c |    2 +-
>  testcases/commands/ade/ldd/lddfile4.c |    2 +-
>  testcases/commands/ade/ldd/lddfile5.c |    2 +-
>  7 files changed, 20 insertions(+), 31 deletions(-)
> 
> diff --git a/testcases/commands/ade/ldd/Makefile b/testcases/commands/ade/ldd/Makefile
> index eae06cd..7119290 100644
> --- a/testcases/commands/ade/ldd/Makefile
> +++ b/testcases/commands/ade/ldd/Makefile
> @@ -28,9 +28,18 @@ CPPFLAGS		+= -fpic
> 
>  INSTALL_TARGETS		:= ldd01
> 
> -MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%.obj,$(wildcard $(abs_srcdir)/*.c))
> +LDD_C_FILES		:= $(wildcard $(abs_srcdir)/lddfile*.c)
> +LDD_SO_FILES		:= $(patsubst $(abs_srcdir)/%.c,%.obj.so,$(LDD_C_FILES))
> +MAKE_TARGETS		:= $(LDD_SO_FILES) lddfile.out
> +CLEAN_TARGETS		+= *.obj
> 
> -$(MAKE_TARGETS): %.obj: %.o
> +%.obj: %.o
>  	mv $^ $@
> 
> +%.obj.so: %.obj
> +	$(CC) $(CFLAGS) -shared -o $@ $^
> +
> +lddfile.out: main.obj $(LDD_SO_FILES)
> +	$(CC) $(CFLAGS) -O -o $@ $(LDD_SO_FILES) main.obj
> +
>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/ade/ldd/ldd01
> index c60d3ac..54188f7 100755
> --- a/testcases/commands/ade/ldd/ldd01
> +++ b/testcases/commands/ade/ldd/ldd01
> @@ -35,42 +35,22 @@ $trace_logic
>  CC=${CC:=gcc}
>  LDD=${LDD:=ldd}
>  TCdat=${TCdat:-`pwd`}
> -TCtmp=${TCtmp:-/tmp/ldd01-$$}
> 
>  do_cleanup()
>  {
> -	rm -rf $TCtmp
> +	:
>  }
> 
>  do_setup()
>  {
> -	mkdir $TCtmp
> -
> -	# Check for ppc64 architecture or x86_64 architecture
> -	if uname -a | grep -iq powerpc; then
> -		file lddfile1.obj | grep 64-bit >/dev/null 2>&1
> -		if [ $? -eq 0 ]; then
> -			CFLAGS="-m64"
> -		fi
> -	elif uname -a | grep -iq x86_64; then
> -		file lddfile1.obj | grep 32-bit >/dev/null 2>&1
> -		if [ $? -eq 0 ]; then
> -			CFLAGS="-m32"
> -		fi
> -	fi
> -	$CC $CFLAGS -shared -o $TCtmp/lddfile1.obj.so $TCdat/lddfile1.obj
> -	$CC $CFLAGS -shared -o $TCtmp/lddfile2.obj.so $TCdat/lddfile2.obj
> -	$CC $CFLAGS -shared -o $TCtmp/lddfile3.obj.so $TCdat/lddfile3.obj
> -	$CC $CFLAGS -shared -o $TCtmp/lddfile4.obj.so $TCdat/lddfile4.obj
> -	$CC $CFLAGS -shared -o $TCtmp/lddfile5.obj.so $TCdat/lddfile5.obj
> -	$CC $CFLAGS -O -o $TCtmp/a.out $TCtmp/lddfile*.obj.so $TCdat/main.obj
> +	:
>  }
> 
>  do_test()
>  {
>  	echo "  ASSERTION 1  "
> 
> -	$LDD $TCtmp/a.out | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
> +	$LDD lddfile.out | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
>  	if [ $? -eq 0 ]; then
>  		echo "ASSERTION #1 PASS"
>  	else
> @@ -81,7 +61,7 @@ do_test()
> 
>  	echo " ASSERTION 2  "
> 
> -	$LDD -v $TCtmp/a.out | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
> +	$LDD -v lddfile.out | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
>  	if [ $? -eq 0 ]; then
>  		echo "ASSERTION #2 PASS"
>  	else
> diff --git a/testcases/commands/ade/ldd/lddfile1.c b/testcases/commands/ade/ldd/lddfile1.c
> index 377f7a3..ccb5786 100644
> --- a/testcases/commands/ade/ldd/lddfile1.c
> +++ b/testcases/commands/ade/ldd/lddfile1.c
> @@ -1,5 +1,5 @@
>  #include <stdio.h>
> -void file1()
> +void file1(void)
>  {
>  	printf("Control in function %s\n", __func__);
>  }
> diff --git a/testcases/commands/ade/ldd/lddfile2.c b/testcases/commands/ade/ldd/lddfile2.c
> index 5fd2b4b..20aede3 100644
> --- a/testcases/commands/ade/ldd/lddfile2.c
> +++ b/testcases/commands/ade/ldd/lddfile2.c
> @@ -1,5 +1,5 @@
>  #include <stdio.h>
> -void file2()
> +void file2(void)
>  {
>  	printf("Control in function %s\n", __func__);
>  }
> diff --git a/testcases/commands/ade/ldd/lddfile3.c b/testcases/commands/ade/ldd/lddfile3.c
> index d6b4cc9..a4529f7 100644
> --- a/testcases/commands/ade/ldd/lddfile3.c
> +++ b/testcases/commands/ade/ldd/lddfile3.c
> @@ -1,5 +1,5 @@
>  #include <stdio.h>
> -void file3()
> +void file3(void)
>  {
>  	printf("Control in function %s\n", __func__);
>  }
> diff --git a/testcases/commands/ade/ldd/lddfile4.c b/testcases/commands/ade/ldd/lddfile4.c
> index 1db89bb..9dc339d 100644
> --- a/testcases/commands/ade/ldd/lddfile4.c
> +++ b/testcases/commands/ade/ldd/lddfile4.c
> @@ -1,5 +1,5 @@
>  #include <stdio.h>
> -void file4()
> +void file4(void)
>  {
>  	printf("Control in function %s\n", __func__);
>  }
> diff --git a/testcases/commands/ade/ldd/lddfile5.c b/testcases/commands/ade/ldd/lddfile5.c
> index 2f46cdb..3fbb7f6 100644
> --- a/testcases/commands/ade/ldd/lddfile5.c
> +++ b/testcases/commands/ade/ldd/lddfile5.c
> @@ -1,5 +1,5 @@
>  #include <stdio.h>
> -void file5()
> +void file5(void)
>  {
>  	printf("Control in function %s\n", __func__);
>  }
> -- 
> 1.7.1
> 


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
  2014-09-12  7:28   ` Han Pingtian
@ 2014-09-12  8:15     ` Jan Stancek
  2014-09-13  2:24       ` Han Pingtian
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Stancek @ 2014-09-12  8:15 UTC (permalink / raw)
  To: Han Pingtian; +Cc: ltp-list




----- Original Message -----
> From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Friday, 12 September, 2014 9:28:45 AM
> Subject: Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
> 
> On Thu, Sep 11, 2014 at 04:41:29PM +0200, Jan Stancek wrote:
> > Would you be willing to try attached patch, which moves the build
> > of .so and a.out into Makefile?
> I have tested your patch but ldd cannot find the lib files:
> 

That's only matter of setting correct LD_LIBRARY_PATH:

$ env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./ldd01 
  ASSERTION 1  
	lddfile1.obj.so => ./lddfile1.obj.so (0x00007f06504db000)
	lddfile2.obj.so => ./lddfile2.obj.so (0x00007f06502d9000)
	lddfile3.obj.so => ./lddfile3.obj.so (0x00007f06500d8000)
	lddfile4.obj.so => ./lddfile4.obj.so (0x00007f064fed7000)
	lddfile5.obj.so => ./lddfile5.obj.so (0x00007f064fcd5000)
ASSERTION #1 PASS
 ASSERTION 2  
	lddfile1.obj.so => ./lddfile1.obj.so (0x00007ffe913e9000)
	lddfile2.obj.so => ./lddfile2.obj.so (0x00007ffe911e7000)
	lddfile3.obj.so => ./lddfile3.obj.so (0x00007ffe90fe6000)
	lddfile4.obj.so => ./lddfile4.obj.so (0x00007ffe90de5000)
	lddfile5.obj.so => ./lddfile5.obj.so (0x00007ffe90be3000)
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
	./lddfile1.obj.so:
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
	./lddfile2.obj.so:
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
	./lddfile3.obj.so:
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
	./lddfile4.obj.so:
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
	./lddfile5.obj.so:
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ASSERTION #2 PASS
TEST PASSES

> 
> > Or alternatively, can you describe
> > the ppc system where this is failing, so I could try to reproduce
> > it myself?
> This is a power 6 system, which running a beta version rhel5.11. Without
> my patch, it failed with those messages:

It also fails (with or without your patch) when built as 32-bit on RHEL7 ppc64:

# ./ldd01 
/usr/bin/ld: powerpc:common architecture of input file `/root/ltp/testcases/commands/ade/ldd/lddfile1.obj' is incompatible with powerpc:common64 output
/root/ltp/testcases/commands/ade/ldd/lddfile1.obj: In function `file1':
/root/ltp/testcases/commands/ade/ldd/lddfile1.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
/root/ltp/testcases/commands/ade/ldd/lddfile1.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
collect2: error: ld returned 1 exit status
/usr/bin/ld: powerpc:common architecture of input file `/root/ltp/testcases/commands/ade/ldd/lddfile2.obj' is incompatible with powerpc:common64 output
/root/ltp/testcases/commands/ade/ldd/lddfile2.obj: In function `file2':
/root/ltp/testcases/commands/ade/ldd/lddfile2.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
/root/ltp/testcases/commands/ade/ldd/lddfile2.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
collect2: error: ld returned 1 exit status
/usr/bin/ld: powerpc:common architecture of input file `/root/ltp/testcases/commands/ade/ldd/lddfile3.obj' is incompatible with powerpc:common64 output
/root/ltp/testcases/commands/ade/ldd/lddfile3.obj: In function `file3':
/root/ltp/testcases/commands/ade/ldd/lddfile3.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
/root/ltp/testcases/commands/ade/ldd/lddfile3.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
collect2: error: ld returned 1 exit status
/usr/bin/ld: powerpc:common architecture of input file `/root/ltp/testcases/commands/ade/ldd/lddfile4.obj' is incompatible with powerpc:common64 output
/root/ltp/testcases/commands/ade/ldd/lddfile4.obj: In function `file4':
/root/ltp/testcases/commands/ade/ldd/lddfile4.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
/root/ltp/testcases/commands/ade/ldd/lddfile4.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
collect2: error: ld returned 1 exit status
/usr/bin/ld: powerpc:common architecture of input file `/root/ltp/testcases/commands/ade/ldd/lddfile5.obj' is incompatible with powerpc:common64 output
/root/ltp/testcases/commands/ade/ldd/lddfile5.obj: In function `file5':
/root/ltp/testcases/commands/ade/ldd/lddfile5.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
/root/ltp/testcases/commands/ade/ldd/lddfile5.c:3: undefined reference to `_GLOBAL_OFFSET_TABLE_'
collect2: error: ld returned 1 exit status
gcc: error: /tmp/ldd01-26565/lddfile*.obj.so: No such file or directory
  ASSERTION 1  
ldd: /tmp/ldd01-26565/a.out: No such file or directory
ASSERTION #1 FAIL

which is why I'd prefer to avoid all that -m32/-m64 logic in ldd01.

Regards,
Jan

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
  2014-09-12  8:15     ` Jan Stancek
@ 2014-09-13  2:24       ` Han Pingtian
  0 siblings, 0 replies; 6+ messages in thread
From: Han Pingtian @ 2014-09-13  2:24 UTC (permalink / raw)
  To: ltp-list

On Fri, Sep 12, 2014 at 04:15:01AM -0400, Jan Stancek wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> > To: ltp-list@lists.sourceforge.net
> > Sent: Friday, 12 September, 2014 9:28:45 AM
> > Subject: Re: [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch
> > 
> > On Thu, Sep 11, 2014 at 04:41:29PM +0200, Jan Stancek wrote:
> > > Would you be willing to try attached patch, which moves the build
> > > of .so and a.out into Makefile?
> > I have tested your patch but ldd cannot find the lib files:
> > 
> 
> That's only matter of setting correct LD_LIBRARY_PATH:
> 
> $ env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./ldd01 
Yes, it works after setting LD_LIBRARY_PATH like this on our systems.
> > 
> > > Or alternatively, can you describe
> > > the ppc system where this is failing, so I could try to reproduce
> > > it myself?
> > This is a power 6 system, which running a beta version rhel5.11. Without
> > my patch, it failed with those messages:
> 
> It also fails (with or without your patch) when built as 32-bit on RHEL7 ppc64:
> 
I have tested your patch with 32bit on the system, it works fine.



------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2014-09-13  2:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11  2:27 [LTP] [PATCH] ldd01: using 'ppc' to check powerpc arch Han Pingtian
2014-09-11 11:23 ` Poornima Nayak
2014-09-11 14:41 ` Jan Stancek
2014-09-12  7:28   ` Han Pingtian
2014-09-12  8:15     ` Jan Stancek
2014-09-13  2:24       ` Han Pingtian

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.