libbsd: Branch 'master'

Guillem Jover guillem at kemper.freedesktop.org
Sun Jun 25 00:13:48 UTC 2017


 test/nlist.c |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 3b2b7938f7b6ddb2ff042b974e30311893113f3a
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sun Jun 25 01:51:30 2017 +0200

    test: Fix nlist() unit test on IA64 and PowerPC 64-bit ELFv1
    
    At least on IA64 and PowerPC 64-bit ELFv1, the functions are stored in
    the .text sections but they are accessed through a function descriptor
    stored in a data section, for example for PowerPC 64-bit ELFv1 that
    section is called .opd.
    
    We should take this into account when checking the n_type for the
    functions we have requested information from nlist().
    
    Rationale-by: James Clarke <jrtc27 at jrtc27.com>

diff --git a/test/nlist.c b/test/nlist.c
index 096d4ae..893176e 100644
--- a/test/nlist.c
+++ b/test/nlist.c
@@ -69,8 +69,17 @@ main(int argc, char **argv)
 	rc = nlist(argv[0], nl);
 	assert(rc == 0);
 
+#if defined(__ia64__) || (defined(__powerpc64__) && _CALL_ELF == 1)
+	/* On IA64 and PowerPC 64-bit ELFv1, the functions are stored in
+	 * the .text sections but they are accessed through a function
+	 * descriptor stored in a data section, for example for PowerPC
+	 * 64-bit that section is called .opd. */
+	assert(nl[0].n_type == (N_DATA | N_EXT));
+	assert(nl[1].n_type == (N_DATA | N_EXT));
+#else
 	assert(nl[0].n_type == (N_TEXT | N_EXT));
 	assert(nl[1].n_type == (N_TEXT | N_EXT));
+#endif
 	assert(nl[2].n_type == (N_BSS | N_EXT));
 	assert(nl[3].n_type == (N_DATA | N_EXT));
 	assert(nl[4].n_type == (N_DATA));


More information about the libbsd mailing list