diff options
author | neel <neel@FreeBSD.org> | 2012-11-13 07:39:05 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2012-11-13 07:39:05 +0000 |
commit | 1a164db277254c1198a5923050a4e403737937c3 (patch) | |
tree | 96b9ec5962272d9c843abffb6d4db9b66e04efd3 /lib | |
parent | f146c1921cfde17a6716187a95a05c21f5e46b94 (diff) | |
parent | a841c9341b2afeabcf32a11c8bd91bbe3346177a (diff) | |
download | FreeBSD-src-1a164db277254c1198a5923050a4e403737937c3.zip FreeBSD-src-1a164db277254c1198a5923050a4e403737937c3.tar.gz |
IFC @ r242940
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 5 | ||||
-rw-r--r-- | lib/libc/gen/isnan.c | 7 | ||||
-rw-r--r-- | lib/libc/stdio/printf.3 | 2 | ||||
-rw-r--r-- | lib/libcrypt/tests/Makefile | 10 | ||||
-rw-r--r-- | lib/libcrypt/tests/crypt_tests.c | 54 | ||||
-rw-r--r-- | lib/libproc/proc_bkpt.c | 3 | ||||
-rw-r--r-- | lib/libproc/proc_regs.c | 8 | ||||
-rw-r--r-- | lib/msun/src/k_rem_pio2.c | 2 | ||||
-rw-r--r-- | lib/msun/src/s_isnan.c | 7 |
9 files changed, 93 insertions, 5 deletions
diff --git a/lib/Makefile b/lib/Makefile index d536ee0..d587574 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -212,6 +212,11 @@ _libproc= libproc _librtld_db= librtld_db .endif +.if ${MACHINE_CPUARCH} == "powerpc" +_libproc= libproc +_librtld_db= librtld_db +.endif + .if ${MK_OPENSSL} != "no" _libmp= libmp .endif diff --git a/lib/libc/gen/isnan.c b/lib/libc/gen/isnan.c index ec81362..72c2868 100644 --- a/lib/libc/gen/isnan.c +++ b/lib/libc/gen/isnan.c @@ -33,8 +33,14 @@ /* * XXX These routines belong in libm, but they must remain in libc for * binary compat until we can bump libm's major version number. + * + * Note this only applies to the dynamic versions of libm and libc, so + * for the static and profiled versions we stub out the definitions. + * Otherwise you cannot link statically to libm and libc at the same + * time, when calling both functions. */ +#ifdef PIC __weak_reference(__isnan, isnan); __weak_reference(__isnanf, isnanf); @@ -55,3 +61,4 @@ __isnanf(float f) u.f = f; return (u.bits.exp == 255 && u.bits.man != 0); } +#endif /* PIC */ diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3 index 0d9339e..05c30dc 100644 --- a/lib/libc/stdio/printf.3 +++ b/lib/libc/stdio/printf.3 @@ -267,7 +267,7 @@ number produced by a signed conversion. A .Cm + overrides a space if both are used. -.It Sq Cm ' +.It So "'" Sc (apostrophe) Decimal conversions .Cm ( d , u , or diff --git a/lib/libcrypt/tests/Makefile b/lib/libcrypt/tests/Makefile new file mode 100644 index 0000000..3190dbe --- /dev/null +++ b/lib/libcrypt/tests/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +# exercise libcrypt + +TESTS_C= crypt_tests + +CFLAGS+= -I${.CURDIR:H} +LDADD+= -L${.OBJDIR:H} -lcrypt + +.include <atf.test.mk> diff --git a/lib/libcrypt/tests/crypt_tests.c b/lib/libcrypt/tests/crypt_tests.c new file mode 100644 index 0000000..3331d12 --- /dev/null +++ b/lib/libcrypt/tests/crypt_tests.c @@ -0,0 +1,54 @@ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> +#include <crypt.h> +#include <unistd.h> + +#include <atf-c.h> + +#define LEET "0.s0.l33t" + +ATF_TC(md5); +ATF_TC_HEAD(md5, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Tests the MD5 based password hash"); +} + +ATF_TC_BODY(md5, tc) +{ + const char want[] = "$1$deadbeef$0Huu6KHrKLVWfqa4WljDE0"; + char *pw; + + pw = crypt(LEET, want); + ATF_CHECK_STREQ(pw, want); +} + +ATF_TC(invalid); +ATF_TC_HEAD(invalid, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Tests that invalid password fails"); +} + +ATF_TC_BODY(invalid, tc) +{ + const char want[] = "$1$cafebabe$0Huu6KHrKLVWfqa4WljDE0"; + char *pw; + + pw = crypt(LEET, want); + ATF_CHECK(strcmp(pw, want) != 0); +} + +/* + * This function must not do anything except enumerate + * the test cases, else atf-run is likely to be upset. + */ +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, md5); + ATF_TP_ADD_TC(tp, invalid); + return atf_no_error(); +} diff --git a/lib/libproc/proc_bkpt.c b/lib/libproc/proc_bkpt.c index e16b0fc..c15e53c 100644 --- a/lib/libproc/proc_bkpt.c +++ b/lib/libproc/proc_bkpt.c @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); #elif defined(__mips__) #define BREAKPOINT_INSTR 0xd /* break */ #define BREAKPOINT_INSTR_SZ 4 +#elif defined(__powerpc__) +#define BREAKPOINT_INSTR 0x7fe00008 /* trap */ +#define BREAKPOINT_INSTR_SZ 4 #else #error "Add support for your architecture" #endif diff --git a/lib/libproc/proc_regs.c b/lib/libproc/proc_regs.c index c299b9b..aac0125 100644 --- a/lib/libproc/proc_regs.c +++ b/lib/libproc/proc_regs.c @@ -60,6 +60,8 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, unsigned long *regvalue) *regvalue = regs.r_eip; #elif defined(__mips__) *regvalue = regs.r_regs[PC]; +#elif defined(__powerpc__) + *regvalue = regs.pc; #endif break; case REG_SP: @@ -69,6 +71,8 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, unsigned long *regvalue) *regvalue = regs.r_esp; #elif defined(__mips__) *regvalue = regs.r_regs[SP]; +#elif defined(__powerpc__) + *regvalue = regs.fixreg[1]; #endif break; default: @@ -99,6 +103,8 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, unsigned long regvalue) regs.r_eip = regvalue; #elif defined(__mips__) regs.r_regs[PC] = regvalue; +#elif defined(__powerpc__) + regs.pc = regvalue; #endif break; case REG_SP: @@ -108,6 +114,8 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, unsigned long regvalue) regs.r_esp = regvalue; #elif defined(__mips__) regs.r_regs[PC] = regvalue; +#elif defined(__powerpc__) + regs.fixreg[1] = regvalue; #endif break; default: diff --git a/lib/msun/src/k_rem_pio2.c b/lib/msun/src/k_rem_pio2.c index a2ffca6..3942441 100644 --- a/lib/msun/src/k_rem_pio2.c +++ b/lib/msun/src/k_rem_pio2.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); * z = (z-x[i])*2**24 * * - * y[] ouput result in an array of double precision numbers. + * y[] output result in an array of double precision numbers. * The dimension of y[] is: * 24-bit precision 1 * 53-bit precision 2 diff --git a/lib/msun/src/s_isnan.c b/lib/msun/src/s_isnan.c index 0f544db..a54ded3 100644 --- a/lib/msun/src/s_isnan.c +++ b/lib/msun/src/s_isnan.c @@ -30,8 +30,9 @@ #include "fpmath.h" -/* Provided by libc */ -#if 0 +/* Provided by libc.so */ +#ifndef PIC +#undef isnan int isnan(double d) { @@ -40,7 +41,7 @@ isnan(double d) u.d = d; return (u.bits.exp == 2047 && (u.bits.manl != 0 || u.bits.manh != 0)); } -#endif +#endif /* !PIC */ int __isnanf(float f) |