diff mbox

[1/2] libc/musl: Remove 1.0.3 and 1.1.3. Add 1.0.4.

Message ID 1409512897-24596-1-git-send-email-bryanhundven@gmail.com
State Accepted
Headers show

Commit Message

Bryan Hundven Aug. 31, 2014, 7:21 p.m. UTC
This change removes 1.0.3 and 1.1.3 and linker regession patches for
those versions.

We add 1.0.4, and a patch needed for gcc-4.9.x which defines
`max_align_t'.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
---
 config/libc/musl.in                                |  12 +-
 .../musl/1.0.3/0001-fix_linker_regression.patch    |  64 ---------
 .../1.0.3/0002-fix_mips_linker_regression.patch    |  88 ------------
 patches/musl/1.0.4/0001-max_align_t.patch          | 118 ++++++++++++++++
 .../musl/1.1.3/0001-fix_linker_regression.patch    |  64 ---------
 .../1.1.3/0002-fix_mips_linker_regression.patch    |  88 ------------
 patches/musl/1.1.4/0001-max_align_t.patch          | 153 +++++++++++++++++++++
 7 files changed, 274 insertions(+), 313 deletions(-)
 delete mode 100644 patches/musl/1.0.3/0001-fix_linker_regression.patch
 delete mode 100644 patches/musl/1.0.3/0002-fix_mips_linker_regression.patch
 create mode 100644 patches/musl/1.0.4/0001-max_align_t.patch
 delete mode 100644 patches/musl/1.1.3/0001-fix_linker_regression.patch
 delete mode 100644 patches/musl/1.1.3/0002-fix_mips_linker_regression.patch
 create mode 100644 patches/musl/1.1.4/0001-max_align_t.patch

Comments

Yann E. MORIN Aug. 31, 2014, 8:58 p.m. UTC | #1
Bryan, All,

On 2014-08-31 12:21 -0700, Bryan Hundven spake thusly:
> This change removes 1.0.3 and 1.1.3 and linker regession patches for
> those versions.
> 
> We add 1.0.4, and a patch needed for gcc-4.9.x which defines
> `max_align_t'.
> 
> Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> ---
>  config/libc/musl.in                                |  12 +-
>  .../musl/1.0.3/0001-fix_linker_regression.patch    |  64 ---------
>  .../1.0.3/0002-fix_mips_linker_regression.patch    |  88 ------------
>  patches/musl/1.0.4/0001-max_align_t.patch          | 118 ++++++++++++++++

As discussed on IRC, this patch was missing the commit log from
upstream. I added it back,

Committed. :-)

Regards,
Yann E. MORIN.

>  .../musl/1.1.3/0001-fix_linker_regression.patch    |  64 ---------
>  .../1.1.3/0002-fix_mips_linker_regression.patch    |  88 ------------
>  patches/musl/1.1.4/0001-max_align_t.patch          | 153 +++++++++++++++++++++
>  7 files changed, 274 insertions(+), 313 deletions(-)
>  delete mode 100644 patches/musl/1.0.3/0001-fix_linker_regression.patch
>  delete mode 100644 patches/musl/1.0.3/0002-fix_mips_linker_regression.patch
>  create mode 100644 patches/musl/1.0.4/0001-max_align_t.patch
>  delete mode 100644 patches/musl/1.1.3/0001-fix_linker_regression.patch
>  delete mode 100644 patches/musl/1.1.3/0002-fix_mips_linker_regression.patch
>  create mode 100644 patches/musl/1.1.4/0001-max_align_t.patch
> 
> diff --git a/config/libc/musl.in b/config/libc/musl.in
> index 7bab480..b3bec26 100644
> --- a/config/libc/musl.in
> +++ b/config/libc/musl.in
> @@ -23,14 +23,9 @@ config LIBC_MUSL_V_1_1_4
>      prompt "1.1.4 (Mainline)"
>      depends on EXPERIMENTAL
>  
> -config LIBC_MUSL_V_1_1_3
> +config LIBC_MUSL_V_1_0_4
>      bool
> -    prompt "1.1.3"
> -    depends on EXPERIMENTAL
> -
> -config LIBC_MUSL_V_1_0_3
> -    bool
> -    prompt "1.0.3 (Stable)"
> +    prompt "1.0.4 (Stable)"
>  
>  config LIBC_MUSL_V_CUSTOM
>      bool
> @@ -44,6 +39,5 @@ config LIBC_VERSION
>  # Don't remove next line
>  # CT_INSERT_VERSION_STRING_BELOW
>      default "1.1.4" if LIBC_MUSL_V_1_1_4
> -    default "1.1.3" if LIBC_MUSL_V_1_1_3
> -    default "1.0.3" if LIBC_MUSL_V_1_0_3
> +    default "1.0.4" if LIBC_MUSL_V_1_0_4
>      default "custom" if LIBC_MUSL_V_CUSTOM
> diff --git a/patches/musl/1.0.3/0001-fix_linker_regression.patch b/patches/musl/1.0.3/0001-fix_linker_regression.patch
> deleted file mode 100644
> index 801cb00..0000000
> --- a/patches/musl/1.0.3/0001-fix_linker_regression.patch
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -From 9a4ad02214a859e93d2c980e4535378a6a74e3a6 Mon Sep 17 00:00:00 2001
> -From: Rich Felker <dalias@aerifal.cx>
> -Date: Mon, 30 Jun 2014 01:52:54 +0000
> -Subject: fix regression in dynamic linker error reporting
> -
> -due to a mistake when refactoring the error printing for the dynamic
> -linker (commit 7c73cacd09a51a87484db5689864743e4984a84d), all messages
> -were suppressed and replaced by blank lines.
> ----
> -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
> -index bc4f2f6..a08300d 100644
> ---- a/src/ldso/dynlink.c
> -+++ b/src/ldso/dynlink.c
> -@@ -290,8 +290,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
> - 		if (!astype) continue;
> - 		type = remap_rel(astype);
> - 		if (!type) {
> --			error(errbuf, sizeof errbuf,
> --				"Error relocating %s: unsupported relocation type %d",
> -+			error("Error relocating %s: unsupported relocation type %d",
> - 				dso->name, astype);
> - 			continue;
> - 		}
> -@@ -304,8 +303,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
> - 			def = find_sym(ctx, name, type==REL_PLT);
> - 			if (!def.sym && (sym->st_shndx != SHN_UNDEF
> - 			    || sym->st_info>>4 != STB_WEAK)) {
> --				error(errbuf, sizeof errbuf,
> --					"Error relocating %s: %s: symbol not found",
> -+				error("Error relocating %s: %s: symbol not found",
> - 					dso->name, name);
> - 				continue;
> - 			}
> -@@ -366,7 +364,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
> - 			if (stride<3) addend = reloc_addr[1];
> - 			if (runtime && def.dso->tls_id >= static_tls_cnt) {
> - 				struct td_index *new = malloc(sizeof *new);
> --				if (!new) error(errbuf, sizeof errbuf,
> -+				if (!new) error(
> - 					"Error relocating %s: cannot allocate TLSDESC for %s",
> - 					dso->name, sym ? name : "(local)" );
> - 				new->next = dso->td_index;
> -@@ -839,8 +837,7 @@ static void load_deps(struct dso *p)
> - 			if (p->dynv[i] != DT_NEEDED) continue;
> - 			dep = load_library(p->strings + p->dynv[i+1], p);
> - 			if (!dep) {
> --				error(errbuf, sizeof errbuf,
> --					"Error loading shared library %s: %m (needed by %s)",
> -+				error("Error loading shared library %s: %m (needed by %s)",
> - 					p->strings + p->dynv[i+1], p->name);
> - 				continue;
> - 			}
> -@@ -890,8 +887,7 @@ static void reloc_all(struct dso *p)
> - 
> - 		if (p->relro_start != p->relro_end &&
> - 		    mprotect(p->base+p->relro_start, p->relro_end-p->relro_start, PROT_READ) < 0) {
> --			error(errbuf, sizeof errbuf,
> --				"Error relocating %s: RELRO protection failed: %m",
> -+			error("Error relocating %s: RELRO protection failed: %m",
> - 				p->name);
> - 		}
> - 
> ---
> -cgit v0.9.0.3-65-g4555
> diff --git a/patches/musl/1.0.3/0002-fix_mips_linker_regression.patch b/patches/musl/1.0.3/0002-fix_mips_linker_regression.patch
> deleted file mode 100644
> index 4891b4f..0000000
> --- a/patches/musl/1.0.3/0002-fix_mips_linker_regression.patch
> +++ /dev/null
> @@ -1,88 +0,0 @@
> -From 2d8cc92a7cb4a3256ed07d86843388ffd8a882b1 Mon Sep 17 00:00:00 2001
> -From: Rich Felker <dalias@aerifal.cx>
> -Date: Mon, 30 Jun 2014 05:18:14 +0000
> -Subject: fix regression in mips dynamic linker
> -
> -this issue caused the address of functions in shared libraries to
> -resolve to their PLT thunks in the main program rather than their
> -correct addresses. it was observed causing crashes, though the
> -mechanism of the crash was not thoroughly investigated. since the
> -issue is very subtle, it calls for some explanation:
> -
> -on all well-behaved archs, GOT entries that belong to the PLT use a
> -special relocation type, typically called JMP_SLOT, so that the
> -dynamic linker can avoid having the jump destinations for the PLT
> -resolve to PLT thunks themselves (they also provide a definition for
> -the symbol, which must be used whenever the address of the function is
> -taken so that all DSOs see the same address).
> -
> -however, the traditional mips PIC ABI lacked such a JMP_SLOT
> -relocation type, presumably because, due to the way PIC works, the
> -address of the PLT thunk was never needed and could always be ignored.
> -
> -prior to commit adf94c19666e687a728bbf398f9a88ea4ea19996, the mips
> -version of reloc.h contained a hack that caused all symbol lookups to
> -be treated like JMP_SLOT, inhibiting undefined symbols from ever being
> -used to resolve symbolic relocations. this hack goes all the way back
> -to commit babf820180368f00742ec65b2050a82380d7c542, when the mips
> -dynamic linker was first made usable.
> -
> -during the recent refactoring to eliminate arch-specific relocation
> -processing (commit adf94c19666e687a728bbf398f9a88ea4ea19996), this
> -hack was overlooked and no equivalent functionality was provided in
> -the new code.
> -
> -fixing the problem is not as simple as adding back an equivalent hack,
> -since there is now also a "non-PIC ABI" that can be used for the main
> -executable, which actually does use a PLT. the closest thing to
> -official documentation I could find for this ABI is nonpic.txt,
> -attached to Message-ID: 20080701202236.GA1534@caradoc.them.org, which
> -can be found in the gcc mailing list archives and elsewhere. per this
> -document, undefined symbols corresponding to PLT thunks have the
> -STO_MIPS_PLT bit set in the symbol's st_other field. thus, I have
> -added an arch-specific rule for mips, applied at the find_sym level
> -rather than the relocation level, to reject undefined symbols with the
> -STO_MIPS_PLT bit clear.
> -
> -the previous hack of treating all mips relocations as JMP_SLOT-like,
> -rather than rejecting the unwanted symbols in find_sym, probably also
> -caused dlsym to wrongly return PLT thunks in place of the correct
> -address of a function under at least some conditions. this should now
> -be fixed, at least for global-scope symbol lookups.
> ----
> -diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
> -index 91fa097..4b81d32 100644
> ---- a/arch/mips/reloc.h
> -+++ b/arch/mips/reloc.h
> -@@ -86,3 +86,4 @@ static void do_arch_relocs(struct dso *this, struct dso *head)
> - 
> - #define NEED_ARCH_RELOCS 1
> - #define DYNAMIC_IS_RO 1
> -+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
> -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
> -index a08300d..55124ff 100644
> ---- a/src/ldso/dynlink.c
> -+++ b/src/ldso/dynlink.c
> -@@ -233,6 +233,10 @@ static Sym *gnu_lookup(const char *s, uint32_t h1, struct dso *dso)
> - #define OK_TYPES (1<<STT_NOTYPE | 1<<STT_OBJECT | 1<<STT_FUNC | 1<<STT_COMMON | 1<<STT_TLS)
> - #define OK_BINDS (1<<STB_GLOBAL | 1<<STB_WEAK | 1<<STB_GNU_UNIQUE)
> - 
> -+#ifndef ARCH_SYM_REJECT_UND
> -+#define ARCH_SYM_REJECT_UND(s) 0
> -+#endif
> -+
> - static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
> - {
> - 	uint32_t h = 0, gh = 0;
> -@@ -249,7 +253,8 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
> - 		}
> - 		if (!sym) continue;
> - 		if (!sym->st_shndx)
> --			if (need_def || (sym->st_info&0xf) == STT_TLS)
> -+			if (need_def || (sym->st_info&0xf) == STT_TLS
> -+			    || ARCH_SYM_REJECT_UND(sym))
> - 				continue;
> - 		if (!sym->st_value)
> - 			if ((sym->st_info&0xf) != STT_TLS)
> ---
> -cgit v0.9.0.3-65-g4555
> diff --git a/patches/musl/1.0.4/0001-max_align_t.patch b/patches/musl/1.0.4/0001-max_align_t.patch
> new file mode 100644
> index 0000000..d723431
> --- /dev/null
> +++ b/patches/musl/1.0.4/0001-max_align_t.patch
> @@ -0,0 +1,118 @@
> +diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
> +index bd23a6a..3482874 100644
> +--- a/arch/arm/bits/alltypes.h.in
> ++++ b/arch/arm/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
> +index efd2c07..8a62c80 100644
> +--- a/arch/i386/bits/alltypes.h.in
> ++++ b/arch/i386/bits/alltypes.h.in
> +@@ -27,6 +27,8 @@ TYPEDEF long double float_t;
> + TYPEDEF long double double_t;
> + #endif
> + 
> ++TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
> +index 6bd7942..27006b0 100644
> +--- a/arch/microblaze/bits/alltypes.h.in
> ++++ b/arch/microblaze/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
> +index 6bd7942..27006b0 100644
> +--- a/arch/mips/bits/alltypes.h.in
> ++++ b/arch/mips/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
> +index e9d8dd8..040157e 100644
> +--- a/arch/powerpc/bits/alltypes.h.in
> ++++ b/arch/powerpc/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in
> +index e9d8dd8..040157e 100644
> +--- a/arch/sh/bits/alltypes.h.in
> ++++ b/arch/sh/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
> +index b077fc9..c98a3d7 100644
> +--- a/arch/x32/bits/alltypes.h.in
> ++++ b/arch/x32/bits/alltypes.h.in
> +@@ -18,6 +18,8 @@ TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + #endif
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long long time_t;
> + TYPEDEF long long suseconds_t;
> + 
> +diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
> +index 277e944..c4898c7 100644
> +--- a/arch/x86_64/bits/alltypes.h.in
> ++++ b/arch/x86_64/bits/alltypes.h.in
> +@@ -18,6 +18,8 @@ TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + #endif
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/include/stddef.h b/include/stddef.h
> +index 0a32919..bd75385 100644
> +--- a/include/stddef.h
> ++++ b/include/stddef.h
> +@@ -10,6 +10,9 @@
> + #define __NEED_ptrdiff_t
> + #define __NEED_size_t
> + #define __NEED_wchar_t
> ++#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
> ++#define __NEED_max_align_t
> ++#endif
> + 
> + #include <bits/alltypes.h>
> + 
> diff --git a/patches/musl/1.1.3/0001-fix_linker_regression.patch b/patches/musl/1.1.3/0001-fix_linker_regression.patch
> deleted file mode 100644
> index 801cb00..0000000
> --- a/patches/musl/1.1.3/0001-fix_linker_regression.patch
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -From 9a4ad02214a859e93d2c980e4535378a6a74e3a6 Mon Sep 17 00:00:00 2001
> -From: Rich Felker <dalias@aerifal.cx>
> -Date: Mon, 30 Jun 2014 01:52:54 +0000
> -Subject: fix regression in dynamic linker error reporting
> -
> -due to a mistake when refactoring the error printing for the dynamic
> -linker (commit 7c73cacd09a51a87484db5689864743e4984a84d), all messages
> -were suppressed and replaced by blank lines.
> ----
> -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
> -index bc4f2f6..a08300d 100644
> ---- a/src/ldso/dynlink.c
> -+++ b/src/ldso/dynlink.c
> -@@ -290,8 +290,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
> - 		if (!astype) continue;
> - 		type = remap_rel(astype);
> - 		if (!type) {
> --			error(errbuf, sizeof errbuf,
> --				"Error relocating %s: unsupported relocation type %d",
> -+			error("Error relocating %s: unsupported relocation type %d",
> - 				dso->name, astype);
> - 			continue;
> - 		}
> -@@ -304,8 +303,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
> - 			def = find_sym(ctx, name, type==REL_PLT);
> - 			if (!def.sym && (sym->st_shndx != SHN_UNDEF
> - 			    || sym->st_info>>4 != STB_WEAK)) {
> --				error(errbuf, sizeof errbuf,
> --					"Error relocating %s: %s: symbol not found",
> -+				error("Error relocating %s: %s: symbol not found",
> - 					dso->name, name);
> - 				continue;
> - 			}
> -@@ -366,7 +364,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
> - 			if (stride<3) addend = reloc_addr[1];
> - 			if (runtime && def.dso->tls_id >= static_tls_cnt) {
> - 				struct td_index *new = malloc(sizeof *new);
> --				if (!new) error(errbuf, sizeof errbuf,
> -+				if (!new) error(
> - 					"Error relocating %s: cannot allocate TLSDESC for %s",
> - 					dso->name, sym ? name : "(local)" );
> - 				new->next = dso->td_index;
> -@@ -839,8 +837,7 @@ static void load_deps(struct dso *p)
> - 			if (p->dynv[i] != DT_NEEDED) continue;
> - 			dep = load_library(p->strings + p->dynv[i+1], p);
> - 			if (!dep) {
> --				error(errbuf, sizeof errbuf,
> --					"Error loading shared library %s: %m (needed by %s)",
> -+				error("Error loading shared library %s: %m (needed by %s)",
> - 					p->strings + p->dynv[i+1], p->name);
> - 				continue;
> - 			}
> -@@ -890,8 +887,7 @@ static void reloc_all(struct dso *p)
> - 
> - 		if (p->relro_start != p->relro_end &&
> - 		    mprotect(p->base+p->relro_start, p->relro_end-p->relro_start, PROT_READ) < 0) {
> --			error(errbuf, sizeof errbuf,
> --				"Error relocating %s: RELRO protection failed: %m",
> -+			error("Error relocating %s: RELRO protection failed: %m",
> - 				p->name);
> - 		}
> - 
> ---
> -cgit v0.9.0.3-65-g4555
> diff --git a/patches/musl/1.1.3/0002-fix_mips_linker_regression.patch b/patches/musl/1.1.3/0002-fix_mips_linker_regression.patch
> deleted file mode 100644
> index 4891b4f..0000000
> --- a/patches/musl/1.1.3/0002-fix_mips_linker_regression.patch
> +++ /dev/null
> @@ -1,88 +0,0 @@
> -From 2d8cc92a7cb4a3256ed07d86843388ffd8a882b1 Mon Sep 17 00:00:00 2001
> -From: Rich Felker <dalias@aerifal.cx>
> -Date: Mon, 30 Jun 2014 05:18:14 +0000
> -Subject: fix regression in mips dynamic linker
> -
> -this issue caused the address of functions in shared libraries to
> -resolve to their PLT thunks in the main program rather than their
> -correct addresses. it was observed causing crashes, though the
> -mechanism of the crash was not thoroughly investigated. since the
> -issue is very subtle, it calls for some explanation:
> -
> -on all well-behaved archs, GOT entries that belong to the PLT use a
> -special relocation type, typically called JMP_SLOT, so that the
> -dynamic linker can avoid having the jump destinations for the PLT
> -resolve to PLT thunks themselves (they also provide a definition for
> -the symbol, which must be used whenever the address of the function is
> -taken so that all DSOs see the same address).
> -
> -however, the traditional mips PIC ABI lacked such a JMP_SLOT
> -relocation type, presumably because, due to the way PIC works, the
> -address of the PLT thunk was never needed and could always be ignored.
> -
> -prior to commit adf94c19666e687a728bbf398f9a88ea4ea19996, the mips
> -version of reloc.h contained a hack that caused all symbol lookups to
> -be treated like JMP_SLOT, inhibiting undefined symbols from ever being
> -used to resolve symbolic relocations. this hack goes all the way back
> -to commit babf820180368f00742ec65b2050a82380d7c542, when the mips
> -dynamic linker was first made usable.
> -
> -during the recent refactoring to eliminate arch-specific relocation
> -processing (commit adf94c19666e687a728bbf398f9a88ea4ea19996), this
> -hack was overlooked and no equivalent functionality was provided in
> -the new code.
> -
> -fixing the problem is not as simple as adding back an equivalent hack,
> -since there is now also a "non-PIC ABI" that can be used for the main
> -executable, which actually does use a PLT. the closest thing to
> -official documentation I could find for this ABI is nonpic.txt,
> -attached to Message-ID: 20080701202236.GA1534@caradoc.them.org, which
> -can be found in the gcc mailing list archives and elsewhere. per this
> -document, undefined symbols corresponding to PLT thunks have the
> -STO_MIPS_PLT bit set in the symbol's st_other field. thus, I have
> -added an arch-specific rule for mips, applied at the find_sym level
> -rather than the relocation level, to reject undefined symbols with the
> -STO_MIPS_PLT bit clear.
> -
> -the previous hack of treating all mips relocations as JMP_SLOT-like,
> -rather than rejecting the unwanted symbols in find_sym, probably also
> -caused dlsym to wrongly return PLT thunks in place of the correct
> -address of a function under at least some conditions. this should now
> -be fixed, at least for global-scope symbol lookups.
> ----
> -diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
> -index 91fa097..4b81d32 100644
> ---- a/arch/mips/reloc.h
> -+++ b/arch/mips/reloc.h
> -@@ -86,3 +86,4 @@ static void do_arch_relocs(struct dso *this, struct dso *head)
> - 
> - #define NEED_ARCH_RELOCS 1
> - #define DYNAMIC_IS_RO 1
> -+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
> -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
> -index a08300d..55124ff 100644
> ---- a/src/ldso/dynlink.c
> -+++ b/src/ldso/dynlink.c
> -@@ -233,6 +233,10 @@ static Sym *gnu_lookup(const char *s, uint32_t h1, struct dso *dso)
> - #define OK_TYPES (1<<STT_NOTYPE | 1<<STT_OBJECT | 1<<STT_FUNC | 1<<STT_COMMON | 1<<STT_TLS)
> - #define OK_BINDS (1<<STB_GLOBAL | 1<<STB_WEAK | 1<<STB_GNU_UNIQUE)
> - 
> -+#ifndef ARCH_SYM_REJECT_UND
> -+#define ARCH_SYM_REJECT_UND(s) 0
> -+#endif
> -+
> - static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
> - {
> - 	uint32_t h = 0, gh = 0;
> -@@ -249,7 +253,8 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
> - 		}
> - 		if (!sym) continue;
> - 		if (!sym->st_shndx)
> --			if (need_def || (sym->st_info&0xf) == STT_TLS)
> -+			if (need_def || (sym->st_info&0xf) == STT_TLS
> -+			    || ARCH_SYM_REJECT_UND(sym))
> - 				continue;
> - 		if (!sym->st_value)
> - 			if ((sym->st_info&0xf) != STT_TLS)
> ---
> -cgit v0.9.0.3-65-g4555
> diff --git a/patches/musl/1.1.4/0001-max_align_t.patch b/patches/musl/1.1.4/0001-max_align_t.patch
> new file mode 100644
> index 0000000..6423337
> --- /dev/null
> +++ b/patches/musl/1.1.4/0001-max_align_t.patch
> @@ -0,0 +1,153 @@
> +From 321f4fa9067185aa6bb47403dfba46e8cfe917d3 Mon Sep 17 00:00:00 2001
> +From: Rich Felker <dalias@aerifal.cx>
> +Date: Wed, 20 Aug 2014 21:20:14 +0000
> +Subject: add max_align_t definition for C11 and C++11
> +
> +unfortunately this needs to be able to vary by arch, because of a huge
> +mess GCC made: the GCC definition, which became the ABI, depends on
> +quirks in GCC's definition of __alignof__, which does not match the
> +formal alignment of the type.
> +
> +GCC's __alignof__ unexpectedly exposes the an implementation detail,
> +its "preferred alignment" for the type, rather than the formal/ABI
> +alignment of the type, which it only actually uses in structures. on
> +most archs the two values are the same, but on some (at least i386)
> +the preferred alignment is greater than the ABI alignment.
> +
> +I considered using _Alignas(8) unconditionally, but on at least one
> +arch (or1k), the alignment of max_align_t with GCC's definition is
> +only 4 (even the "preferred alignment" for these types is only 4).
> +---
> +diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
> +index 0d750cc..183c4c4 100644
> +--- a/arch/arm/bits/alltypes.h.in
> ++++ b/arch/arm/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
> +index 502c882..8ba8f6f 100644
> +--- a/arch/i386/bits/alltypes.h.in
> ++++ b/arch/i386/bits/alltypes.h.in
> +@@ -27,6 +27,8 @@ TYPEDEF long double float_t;
> + TYPEDEF long double double_t;
> + #endif
> + 
> ++TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
> +index 4657d14..a03e1b8 100644
> +--- a/arch/microblaze/bits/alltypes.h.in
> ++++ b/arch/microblaze/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
> +index 4657d14..a03e1b8 100644
> +--- a/arch/mips/bits/alltypes.h.in
> ++++ b/arch/mips/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/or1k/bits/alltypes.h.in b/arch/or1k/bits/alltypes.h.in
> +index 0d750cc..183c4c4 100644
> +--- a/arch/or1k/bits/alltypes.h.in
> ++++ b/arch/or1k/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
> +index 378124c..ee7f137 100644
> +--- a/arch/powerpc/bits/alltypes.h.in
> ++++ b/arch/powerpc/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in
> +index 378124c..ee7f137 100644
> +--- a/arch/sh/bits/alltypes.h.in
> ++++ b/arch/sh/bits/alltypes.h.in
> +@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
> + TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
> +index 8930efa..8e396c9 100644
> +--- a/arch/x32/bits/alltypes.h.in
> ++++ b/arch/x32/bits/alltypes.h.in
> +@@ -18,6 +18,8 @@ TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + #endif
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long long time_t;
> + TYPEDEF long long suseconds_t;
> + 
> +diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
> +index 34b7d6a..7b4f3e7 100644
> +--- a/arch/x86_64/bits/alltypes.h.in
> ++++ b/arch/x86_64/bits/alltypes.h.in
> +@@ -18,6 +18,8 @@ TYPEDEF float float_t;
> + TYPEDEF double double_t;
> + #endif
> + 
> ++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
> ++
> + TYPEDEF long time_t;
> + TYPEDEF long suseconds_t;
> + 
> +diff --git a/include/stddef.h b/include/stddef.h
> +index 0a32919..bd75385 100644
> +--- a/include/stddef.h
> ++++ b/include/stddef.h
> +@@ -10,6 +10,9 @@
> + #define __NEED_ptrdiff_t
> + #define __NEED_size_t
> + #define __NEED_wchar_t
> ++#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
> ++#define __NEED_max_align_t
> ++#endif
> + 
> + #include <bits/alltypes.h>
> + 
> +--
> +cgit v0.9.0.3-65-g4555
> -- 
> 2.1.0
>
diff mbox

Patch

diff --git a/config/libc/musl.in b/config/libc/musl.in
index 7bab480..b3bec26 100644
--- a/config/libc/musl.in
+++ b/config/libc/musl.in
@@ -23,14 +23,9 @@  config LIBC_MUSL_V_1_1_4
     prompt "1.1.4 (Mainline)"
     depends on EXPERIMENTAL
 
-config LIBC_MUSL_V_1_1_3
+config LIBC_MUSL_V_1_0_4
     bool
-    prompt "1.1.3"
-    depends on EXPERIMENTAL
-
-config LIBC_MUSL_V_1_0_3
-    bool
-    prompt "1.0.3 (Stable)"
+    prompt "1.0.4 (Stable)"
 
 config LIBC_MUSL_V_CUSTOM
     bool
@@ -44,6 +39,5 @@  config LIBC_VERSION
 # Don't remove next line
 # CT_INSERT_VERSION_STRING_BELOW
     default "1.1.4" if LIBC_MUSL_V_1_1_4
-    default "1.1.3" if LIBC_MUSL_V_1_1_3
-    default "1.0.3" if LIBC_MUSL_V_1_0_3
+    default "1.0.4" if LIBC_MUSL_V_1_0_4
     default "custom" if LIBC_MUSL_V_CUSTOM
diff --git a/patches/musl/1.0.3/0001-fix_linker_regression.patch b/patches/musl/1.0.3/0001-fix_linker_regression.patch
deleted file mode 100644
index 801cb00..0000000
--- a/patches/musl/1.0.3/0001-fix_linker_regression.patch
+++ /dev/null
@@ -1,64 +0,0 @@ 
-From 9a4ad02214a859e93d2c980e4535378a6a74e3a6 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Mon, 30 Jun 2014 01:52:54 +0000
-Subject: fix regression in dynamic linker error reporting
-
-due to a mistake when refactoring the error printing for the dynamic
-linker (commit 7c73cacd09a51a87484db5689864743e4984a84d), all messages
-were suppressed and replaced by blank lines.
----
-diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
-index bc4f2f6..a08300d 100644
---- a/src/ldso/dynlink.c
-+++ b/src/ldso/dynlink.c
-@@ -290,8 +290,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- 		if (!astype) continue;
- 		type = remap_rel(astype);
- 		if (!type) {
--			error(errbuf, sizeof errbuf,
--				"Error relocating %s: unsupported relocation type %d",
-+			error("Error relocating %s: unsupported relocation type %d",
- 				dso->name, astype);
- 			continue;
- 		}
-@@ -304,8 +303,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- 			def = find_sym(ctx, name, type==REL_PLT);
- 			if (!def.sym && (sym->st_shndx != SHN_UNDEF
- 			    || sym->st_info>>4 != STB_WEAK)) {
--				error(errbuf, sizeof errbuf,
--					"Error relocating %s: %s: symbol not found",
-+				error("Error relocating %s: %s: symbol not found",
- 					dso->name, name);
- 				continue;
- 			}
-@@ -366,7 +364,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- 			if (stride<3) addend = reloc_addr[1];
- 			if (runtime && def.dso->tls_id >= static_tls_cnt) {
- 				struct td_index *new = malloc(sizeof *new);
--				if (!new) error(errbuf, sizeof errbuf,
-+				if (!new) error(
- 					"Error relocating %s: cannot allocate TLSDESC for %s",
- 					dso->name, sym ? name : "(local)" );
- 				new->next = dso->td_index;
-@@ -839,8 +837,7 @@ static void load_deps(struct dso *p)
- 			if (p->dynv[i] != DT_NEEDED) continue;
- 			dep = load_library(p->strings + p->dynv[i+1], p);
- 			if (!dep) {
--				error(errbuf, sizeof errbuf,
--					"Error loading shared library %s: %m (needed by %s)",
-+				error("Error loading shared library %s: %m (needed by %s)",
- 					p->strings + p->dynv[i+1], p->name);
- 				continue;
- 			}
-@@ -890,8 +887,7 @@ static void reloc_all(struct dso *p)
- 
- 		if (p->relro_start != p->relro_end &&
- 		    mprotect(p->base+p->relro_start, p->relro_end-p->relro_start, PROT_READ) < 0) {
--			error(errbuf, sizeof errbuf,
--				"Error relocating %s: RELRO protection failed: %m",
-+			error("Error relocating %s: RELRO protection failed: %m",
- 				p->name);
- 		}
- 
---
-cgit v0.9.0.3-65-g4555
diff --git a/patches/musl/1.0.3/0002-fix_mips_linker_regression.patch b/patches/musl/1.0.3/0002-fix_mips_linker_regression.patch
deleted file mode 100644
index 4891b4f..0000000
--- a/patches/musl/1.0.3/0002-fix_mips_linker_regression.patch
+++ /dev/null
@@ -1,88 +0,0 @@ 
-From 2d8cc92a7cb4a3256ed07d86843388ffd8a882b1 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Mon, 30 Jun 2014 05:18:14 +0000
-Subject: fix regression in mips dynamic linker
-
-this issue caused the address of functions in shared libraries to
-resolve to their PLT thunks in the main program rather than their
-correct addresses. it was observed causing crashes, though the
-mechanism of the crash was not thoroughly investigated. since the
-issue is very subtle, it calls for some explanation:
-
-on all well-behaved archs, GOT entries that belong to the PLT use a
-special relocation type, typically called JMP_SLOT, so that the
-dynamic linker can avoid having the jump destinations for the PLT
-resolve to PLT thunks themselves (they also provide a definition for
-the symbol, which must be used whenever the address of the function is
-taken so that all DSOs see the same address).
-
-however, the traditional mips PIC ABI lacked such a JMP_SLOT
-relocation type, presumably because, due to the way PIC works, the
-address of the PLT thunk was never needed and could always be ignored.
-
-prior to commit adf94c19666e687a728bbf398f9a88ea4ea19996, the mips
-version of reloc.h contained a hack that caused all symbol lookups to
-be treated like JMP_SLOT, inhibiting undefined symbols from ever being
-used to resolve symbolic relocations. this hack goes all the way back
-to commit babf820180368f00742ec65b2050a82380d7c542, when the mips
-dynamic linker was first made usable.
-
-during the recent refactoring to eliminate arch-specific relocation
-processing (commit adf94c19666e687a728bbf398f9a88ea4ea19996), this
-hack was overlooked and no equivalent functionality was provided in
-the new code.
-
-fixing the problem is not as simple as adding back an equivalent hack,
-since there is now also a "non-PIC ABI" that can be used for the main
-executable, which actually does use a PLT. the closest thing to
-official documentation I could find for this ABI is nonpic.txt,
-attached to Message-ID: 20080701202236.GA1534@caradoc.them.org, which
-can be found in the gcc mailing list archives and elsewhere. per this
-document, undefined symbols corresponding to PLT thunks have the
-STO_MIPS_PLT bit set in the symbol's st_other field. thus, I have
-added an arch-specific rule for mips, applied at the find_sym level
-rather than the relocation level, to reject undefined symbols with the
-STO_MIPS_PLT bit clear.
-
-the previous hack of treating all mips relocations as JMP_SLOT-like,
-rather than rejecting the unwanted symbols in find_sym, probably also
-caused dlsym to wrongly return PLT thunks in place of the correct
-address of a function under at least some conditions. this should now
-be fixed, at least for global-scope symbol lookups.
----
-diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
-index 91fa097..4b81d32 100644
---- a/arch/mips/reloc.h
-+++ b/arch/mips/reloc.h
-@@ -86,3 +86,4 @@ static void do_arch_relocs(struct dso *this, struct dso *head)
- 
- #define NEED_ARCH_RELOCS 1
- #define DYNAMIC_IS_RO 1
-+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
-diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
-index a08300d..55124ff 100644
---- a/src/ldso/dynlink.c
-+++ b/src/ldso/dynlink.c
-@@ -233,6 +233,10 @@ static Sym *gnu_lookup(const char *s, uint32_t h1, struct dso *dso)
- #define OK_TYPES (1<<STT_NOTYPE | 1<<STT_OBJECT | 1<<STT_FUNC | 1<<STT_COMMON | 1<<STT_TLS)
- #define OK_BINDS (1<<STB_GLOBAL | 1<<STB_WEAK | 1<<STB_GNU_UNIQUE)
- 
-+#ifndef ARCH_SYM_REJECT_UND
-+#define ARCH_SYM_REJECT_UND(s) 0
-+#endif
-+
- static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
- {
- 	uint32_t h = 0, gh = 0;
-@@ -249,7 +253,8 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
- 		}
- 		if (!sym) continue;
- 		if (!sym->st_shndx)
--			if (need_def || (sym->st_info&0xf) == STT_TLS)
-+			if (need_def || (sym->st_info&0xf) == STT_TLS
-+			    || ARCH_SYM_REJECT_UND(sym))
- 				continue;
- 		if (!sym->st_value)
- 			if ((sym->st_info&0xf) != STT_TLS)
---
-cgit v0.9.0.3-65-g4555
diff --git a/patches/musl/1.0.4/0001-max_align_t.patch b/patches/musl/1.0.4/0001-max_align_t.patch
new file mode 100644
index 0000000..d723431
--- /dev/null
+++ b/patches/musl/1.0.4/0001-max_align_t.patch
@@ -0,0 +1,118 @@ 
+diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
+index bd23a6a..3482874 100644
+--- a/arch/arm/bits/alltypes.h.in
++++ b/arch/arm/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
+index efd2c07..8a62c80 100644
+--- a/arch/i386/bits/alltypes.h.in
++++ b/arch/i386/bits/alltypes.h.in
+@@ -27,6 +27,8 @@ TYPEDEF long double float_t;
+ TYPEDEF long double double_t;
+ #endif
+ 
++TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
+index 6bd7942..27006b0 100644
+--- a/arch/microblaze/bits/alltypes.h.in
++++ b/arch/microblaze/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
+index 6bd7942..27006b0 100644
+--- a/arch/mips/bits/alltypes.h.in
++++ b/arch/mips/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
+index e9d8dd8..040157e 100644
+--- a/arch/powerpc/bits/alltypes.h.in
++++ b/arch/powerpc/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in
+index e9d8dd8..040157e 100644
+--- a/arch/sh/bits/alltypes.h.in
++++ b/arch/sh/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
+index b077fc9..c98a3d7 100644
+--- a/arch/x32/bits/alltypes.h.in
++++ b/arch/x32/bits/alltypes.h.in
+@@ -18,6 +18,8 @@ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ #endif
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long long time_t;
+ TYPEDEF long long suseconds_t;
+ 
+diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
+index 277e944..c4898c7 100644
+--- a/arch/x86_64/bits/alltypes.h.in
++++ b/arch/x86_64/bits/alltypes.h.in
+@@ -18,6 +18,8 @@ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ #endif
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/include/stddef.h b/include/stddef.h
+index 0a32919..bd75385 100644
+--- a/include/stddef.h
++++ b/include/stddef.h
+@@ -10,6 +10,9 @@
+ #define __NEED_ptrdiff_t
+ #define __NEED_size_t
+ #define __NEED_wchar_t
++#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
++#define __NEED_max_align_t
++#endif
+ 
+ #include <bits/alltypes.h>
+ 
diff --git a/patches/musl/1.1.3/0001-fix_linker_regression.patch b/patches/musl/1.1.3/0001-fix_linker_regression.patch
deleted file mode 100644
index 801cb00..0000000
--- a/patches/musl/1.1.3/0001-fix_linker_regression.patch
+++ /dev/null
@@ -1,64 +0,0 @@ 
-From 9a4ad02214a859e93d2c980e4535378a6a74e3a6 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Mon, 30 Jun 2014 01:52:54 +0000
-Subject: fix regression in dynamic linker error reporting
-
-due to a mistake when refactoring the error printing for the dynamic
-linker (commit 7c73cacd09a51a87484db5689864743e4984a84d), all messages
-were suppressed and replaced by blank lines.
----
-diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
-index bc4f2f6..a08300d 100644
---- a/src/ldso/dynlink.c
-+++ b/src/ldso/dynlink.c
-@@ -290,8 +290,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- 		if (!astype) continue;
- 		type = remap_rel(astype);
- 		if (!type) {
--			error(errbuf, sizeof errbuf,
--				"Error relocating %s: unsupported relocation type %d",
-+			error("Error relocating %s: unsupported relocation type %d",
- 				dso->name, astype);
- 			continue;
- 		}
-@@ -304,8 +303,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- 			def = find_sym(ctx, name, type==REL_PLT);
- 			if (!def.sym && (sym->st_shndx != SHN_UNDEF
- 			    || sym->st_info>>4 != STB_WEAK)) {
--				error(errbuf, sizeof errbuf,
--					"Error relocating %s: %s: symbol not found",
-+				error("Error relocating %s: %s: symbol not found",
- 					dso->name, name);
- 				continue;
- 			}
-@@ -366,7 +364,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- 			if (stride<3) addend = reloc_addr[1];
- 			if (runtime && def.dso->tls_id >= static_tls_cnt) {
- 				struct td_index *new = malloc(sizeof *new);
--				if (!new) error(errbuf, sizeof errbuf,
-+				if (!new) error(
- 					"Error relocating %s: cannot allocate TLSDESC for %s",
- 					dso->name, sym ? name : "(local)" );
- 				new->next = dso->td_index;
-@@ -839,8 +837,7 @@ static void load_deps(struct dso *p)
- 			if (p->dynv[i] != DT_NEEDED) continue;
- 			dep = load_library(p->strings + p->dynv[i+1], p);
- 			if (!dep) {
--				error(errbuf, sizeof errbuf,
--					"Error loading shared library %s: %m (needed by %s)",
-+				error("Error loading shared library %s: %m (needed by %s)",
- 					p->strings + p->dynv[i+1], p->name);
- 				continue;
- 			}
-@@ -890,8 +887,7 @@ static void reloc_all(struct dso *p)
- 
- 		if (p->relro_start != p->relro_end &&
- 		    mprotect(p->base+p->relro_start, p->relro_end-p->relro_start, PROT_READ) < 0) {
--			error(errbuf, sizeof errbuf,
--				"Error relocating %s: RELRO protection failed: %m",
-+			error("Error relocating %s: RELRO protection failed: %m",
- 				p->name);
- 		}
- 
---
-cgit v0.9.0.3-65-g4555
diff --git a/patches/musl/1.1.3/0002-fix_mips_linker_regression.patch b/patches/musl/1.1.3/0002-fix_mips_linker_regression.patch
deleted file mode 100644
index 4891b4f..0000000
--- a/patches/musl/1.1.3/0002-fix_mips_linker_regression.patch
+++ /dev/null
@@ -1,88 +0,0 @@ 
-From 2d8cc92a7cb4a3256ed07d86843388ffd8a882b1 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Mon, 30 Jun 2014 05:18:14 +0000
-Subject: fix regression in mips dynamic linker
-
-this issue caused the address of functions in shared libraries to
-resolve to their PLT thunks in the main program rather than their
-correct addresses. it was observed causing crashes, though the
-mechanism of the crash was not thoroughly investigated. since the
-issue is very subtle, it calls for some explanation:
-
-on all well-behaved archs, GOT entries that belong to the PLT use a
-special relocation type, typically called JMP_SLOT, so that the
-dynamic linker can avoid having the jump destinations for the PLT
-resolve to PLT thunks themselves (they also provide a definition for
-the symbol, which must be used whenever the address of the function is
-taken so that all DSOs see the same address).
-
-however, the traditional mips PIC ABI lacked such a JMP_SLOT
-relocation type, presumably because, due to the way PIC works, the
-address of the PLT thunk was never needed and could always be ignored.
-
-prior to commit adf94c19666e687a728bbf398f9a88ea4ea19996, the mips
-version of reloc.h contained a hack that caused all symbol lookups to
-be treated like JMP_SLOT, inhibiting undefined symbols from ever being
-used to resolve symbolic relocations. this hack goes all the way back
-to commit babf820180368f00742ec65b2050a82380d7c542, when the mips
-dynamic linker was first made usable.
-
-during the recent refactoring to eliminate arch-specific relocation
-processing (commit adf94c19666e687a728bbf398f9a88ea4ea19996), this
-hack was overlooked and no equivalent functionality was provided in
-the new code.
-
-fixing the problem is not as simple as adding back an equivalent hack,
-since there is now also a "non-PIC ABI" that can be used for the main
-executable, which actually does use a PLT. the closest thing to
-official documentation I could find for this ABI is nonpic.txt,
-attached to Message-ID: 20080701202236.GA1534@caradoc.them.org, which
-can be found in the gcc mailing list archives and elsewhere. per this
-document, undefined symbols corresponding to PLT thunks have the
-STO_MIPS_PLT bit set in the symbol's st_other field. thus, I have
-added an arch-specific rule for mips, applied at the find_sym level
-rather than the relocation level, to reject undefined symbols with the
-STO_MIPS_PLT bit clear.
-
-the previous hack of treating all mips relocations as JMP_SLOT-like,
-rather than rejecting the unwanted symbols in find_sym, probably also
-caused dlsym to wrongly return PLT thunks in place of the correct
-address of a function under at least some conditions. this should now
-be fixed, at least for global-scope symbol lookups.
----
-diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
-index 91fa097..4b81d32 100644
---- a/arch/mips/reloc.h
-+++ b/arch/mips/reloc.h
-@@ -86,3 +86,4 @@ static void do_arch_relocs(struct dso *this, struct dso *head)
- 
- #define NEED_ARCH_RELOCS 1
- #define DYNAMIC_IS_RO 1
-+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
-diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
-index a08300d..55124ff 100644
---- a/src/ldso/dynlink.c
-+++ b/src/ldso/dynlink.c
-@@ -233,6 +233,10 @@ static Sym *gnu_lookup(const char *s, uint32_t h1, struct dso *dso)
- #define OK_TYPES (1<<STT_NOTYPE | 1<<STT_OBJECT | 1<<STT_FUNC | 1<<STT_COMMON | 1<<STT_TLS)
- #define OK_BINDS (1<<STB_GLOBAL | 1<<STB_WEAK | 1<<STB_GNU_UNIQUE)
- 
-+#ifndef ARCH_SYM_REJECT_UND
-+#define ARCH_SYM_REJECT_UND(s) 0
-+#endif
-+
- static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
- {
- 	uint32_t h = 0, gh = 0;
-@@ -249,7 +253,8 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
- 		}
- 		if (!sym) continue;
- 		if (!sym->st_shndx)
--			if (need_def || (sym->st_info&0xf) == STT_TLS)
-+			if (need_def || (sym->st_info&0xf) == STT_TLS
-+			    || ARCH_SYM_REJECT_UND(sym))
- 				continue;
- 		if (!sym->st_value)
- 			if ((sym->st_info&0xf) != STT_TLS)
---
-cgit v0.9.0.3-65-g4555
diff --git a/patches/musl/1.1.4/0001-max_align_t.patch b/patches/musl/1.1.4/0001-max_align_t.patch
new file mode 100644
index 0000000..6423337
--- /dev/null
+++ b/patches/musl/1.1.4/0001-max_align_t.patch
@@ -0,0 +1,153 @@ 
+From 321f4fa9067185aa6bb47403dfba46e8cfe917d3 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 20 Aug 2014 21:20:14 +0000
+Subject: add max_align_t definition for C11 and C++11
+
+unfortunately this needs to be able to vary by arch, because of a huge
+mess GCC made: the GCC definition, which became the ABI, depends on
+quirks in GCC's definition of __alignof__, which does not match the
+formal alignment of the type.
+
+GCC's __alignof__ unexpectedly exposes the an implementation detail,
+its "preferred alignment" for the type, rather than the formal/ABI
+alignment of the type, which it only actually uses in structures. on
+most archs the two values are the same, but on some (at least i386)
+the preferred alignment is greater than the ABI alignment.
+
+I considered using _Alignas(8) unconditionally, but on at least one
+arch (or1k), the alignment of max_align_t with GCC's definition is
+only 4 (even the "preferred alignment" for these types is only 4).
+---
+diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
+index 0d750cc..183c4c4 100644
+--- a/arch/arm/bits/alltypes.h.in
++++ b/arch/arm/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
+index 502c882..8ba8f6f 100644
+--- a/arch/i386/bits/alltypes.h.in
++++ b/arch/i386/bits/alltypes.h.in
+@@ -27,6 +27,8 @@ TYPEDEF long double float_t;
+ TYPEDEF long double double_t;
+ #endif
+ 
++TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
+index 4657d14..a03e1b8 100644
+--- a/arch/microblaze/bits/alltypes.h.in
++++ b/arch/microblaze/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
+index 4657d14..a03e1b8 100644
+--- a/arch/mips/bits/alltypes.h.in
++++ b/arch/mips/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/or1k/bits/alltypes.h.in b/arch/or1k/bits/alltypes.h.in
+index 0d750cc..183c4c4 100644
+--- a/arch/or1k/bits/alltypes.h.in
++++ b/arch/or1k/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
+index 378124c..ee7f137 100644
+--- a/arch/powerpc/bits/alltypes.h.in
++++ b/arch/powerpc/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in
+index 378124c..ee7f137 100644
+--- a/arch/sh/bits/alltypes.h.in
++++ b/arch/sh/bits/alltypes.h.in
+@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
+ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
+index 8930efa..8e396c9 100644
+--- a/arch/x32/bits/alltypes.h.in
++++ b/arch/x32/bits/alltypes.h.in
+@@ -18,6 +18,8 @@ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ #endif
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long long time_t;
+ TYPEDEF long long suseconds_t;
+ 
+diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
+index 34b7d6a..7b4f3e7 100644
+--- a/arch/x86_64/bits/alltypes.h.in
++++ b/arch/x86_64/bits/alltypes.h.in
+@@ -18,6 +18,8 @@ TYPEDEF float float_t;
+ TYPEDEF double double_t;
+ #endif
+ 
++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
++
+ TYPEDEF long time_t;
+ TYPEDEF long suseconds_t;
+ 
+diff --git a/include/stddef.h b/include/stddef.h
+index 0a32919..bd75385 100644
+--- a/include/stddef.h
++++ b/include/stddef.h
+@@ -10,6 +10,9 @@
+ #define __NEED_ptrdiff_t
+ #define __NEED_size_t
+ #define __NEED_wchar_t
++#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
++#define __NEED_max_align_t
++#endif
+ 
+ #include <bits/alltypes.h>
+ 
+--
+cgit v0.9.0.3-65-g4555