mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH v2] add powerpc64 port
Date: Thu, 14 Apr 2016 01:05:07 +0200	[thread overview]
Message-ID: <20160413230506.GE22574@port70.net> (raw)
In-Reply-To: <1459747571-9123-1-git-send-email-koorogi@koorogi.info>

* Bobby Bingham <koorogi@koorogi.info> [2016-04-04 00:26:11 -0500]:
> +++ b/arch/powerpc64/bits/setjmp.h
> @@ -0,0 +1 @@
> +typedef unsigned long long __jmp_buf[66];

hm glibc seems to use long[64] with 16byte alignment,
is the size diff because of alignment?

> +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +#define MINSIGSTKSZ 2048
> +#define SIGSTKSZ    8192
> +#endif

i think these should be bigger, e.g. follow ppc 4k, 10k

> +typedef struct {
> +	unsigned long vrregs[32][2];
> +	unsigned _pad[3];
> +	unsigned vrsave;
> +	unsigned vscr;
> +	unsigned _pad2[3];
> +} vrregset_t;

it seems this type should be 16 byte aligned like elf_vrreg_t

(aarch64 has a similar issue i plan to fix: there we use
128bit long double to get correct alignment, but kernel
and glibc uses __int128 which is visible in public headers.
in powerpc64 at least __vector128 is not exposed in glibc,
only 16byte aligned structs.)

> +++ b/arch/powerpc64/bits/syscall.h
> @@ -0,0 +1,718 @@
> +#define __NR_restart_syscall          0
> +#define __NR_exit                     1
> +#define __NR_fork                     2
...
> +#define SYS_restart_syscall __NR_restart_syscall
> +#define SYS_exit __NR_exit
> +#define SYS_fork __NR_fork

i prefer SYS_ to use numbers too (easier to update for me),
but it should be probably fixed together across archs.

> +++ b/arch/powerpc64/reloc.h
> @@ -0,0 +1,32 @@
> +#include <endian.h>
> +
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#define ENDIAN_SUFFIX "le"
> +#else
> +#define ENDIAN_SUFFIX ""
> +#endif
> +
> +#define LDSO_ARCH "powerpc64" ENDIAN_SUFFIX
> +

gcc also has -sf, i'm not sure if we should care about
ppc64 soft-float

> +#define TPOFF_K (-0x7000)
> +
> +#define REL_SYMBOLIC    R_PPC64_ADDR64
> +#define REL_GOT         R_PPC64_GLOB_DAT
> +#define REL_PLT         R_PPC64_JMP_SLOT
> +#define REL_RELATIVE    R_PPC64_RELATIVE
> +#define REL_COPY        R_PPC64_COPY
> +#define REL_DTPMOD      R_PPC64_DTPMOD64
> +#define REL_DTPOFF      R_PPC64_DTPREL64
> +#define REL_TPOFF       R_PPC64_TPREL64

this reminds me that ppc(64) now has a tls optimization
if the module is tagged with DT_PPC(64)_OPT, we don't
need to implement it yet, but eventually elf.h should
be updated.

> +++ b/src/fenv/powerpc64/fenv.c
> @@ -0,0 +1,68 @@
> +#define _GNU_SOURCE
> +#include <fenv.h>
> +
> +static inline double get_fpscr_f(void)
> +{
> +	double d;
> +	__asm__ __volatile__("mffs %0" : "=d"(d));
> +	return d;
> +}
> +
> +static inline long get_fpscr(void)
> +{
> +	return (union {double f; long i;}) {get_fpscr_f()}.i;
> +}
> +
> +static inline void set_fpscr_f(double fpscr)
> +{
> +	__asm__ __volatile__("mtfsf 255, %0" : : "d"(fpscr));
> +}
> +
> +static void set_fpscr(long fpscr)
> +{
> +	set_fpscr_f((union {long i; double f;}) {fpscr}.f);
> +}
> +

yes now that .c is allowed under arch/ dirs, it
makes sense to do fenv with such set/get_fpscr

otherwise the patch looked good.


  reply	other threads:[~2016-04-13 23:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04  5:26 Bobby Bingham
2016-04-13 23:05 ` Szabolcs Nagy [this message]
2016-04-13 23:13   ` Rich Felker
2016-04-14  0:58     ` Szabolcs Nagy
2016-04-14  8:01   ` Bobby Bingham
2016-04-14 13:42     ` Szabolcs Nagy
2016-04-15 20:38       ` Szabolcs Nagy
2016-04-16 17:09         ` Rich Felker
2016-04-28  1:38           ` Bobby Bingham
2016-04-28  2:07             ` Rich Felker
2016-04-30 20:15               ` Bobby Bingham
2016-04-14 19:14     ` Rich Felker
2016-04-15  0:55       ` Bobby Bingham
2016-04-15  2:08         ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160413230506.GE22574@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).