diff --git a/board/common/cleanups.sh b/board/common/cleanups.sh index 86acbb9488..4e0ebfe97f 100755 --- a/board/common/cleanups.sh +++ b/board/common/cleanups.sh @@ -187,7 +187,10 @@ rm -f $TARGET/etc/init.d/S20urandom rm -f $TARGET/etc/init.d/S80dhcp-relay rm -f $TARGET/etc/init.d/S80dhcp-server rm -f $TARGET/etc/init.d/S91smb +<<<<<<< HEAD rm -f $TARGET/etc/init.d/S99motion +======= +>>>>>>> thingos/master # other unwanted dirs rm -rf $TARGET/data/* diff --git a/board/odroidc1/overlay/etc/os.conf b/board/odroidc1/overlay/etc/os.conf index d3ce9dfd6c..859ab7c415 100644 --- a/board/odroidc1/overlay/etc/os.conf +++ b/board/odroidc1/overlay/etc/os.conf @@ -6,6 +6,10 @@ os_wlan="wlan0" os_ppp="ppp0" os_networkless="false" os_firmware_method="github" +<<<<<<< HEAD os_firmware_repo="ccrisan/motioneyeos" +======= +os_firmware_repo="ccrisan/thingos" +>>>>>>> thingos/master os_firmware_username="" os_firmware_password="" diff --git a/board/odroidc2/overlay/etc/os.conf b/board/odroidc2/overlay/etc/os.conf index d3ce9dfd6c..859ab7c415 100644 --- a/board/odroidc2/overlay/etc/os.conf +++ b/board/odroidc2/overlay/etc/os.conf @@ -6,6 +6,10 @@ os_wlan="wlan0" os_ppp="ppp0" os_networkless="false" os_firmware_method="github" +<<<<<<< HEAD os_firmware_repo="ccrisan/motioneyeos" +======= +os_firmware_repo="ccrisan/thingos" +>>>>>>> thingos/master os_firmware_username="" os_firmware_password="" diff --git a/package/aircrack-ng/0004-fix-musl-build.patch b/package/aircrack-ng/0004-fix-musl-build.patch new file mode 100644 index 0000000000..cc093d38df --- /dev/null +++ b/package/aircrack-ng/0004-fix-musl-build.patch @@ -0,0 +1,53 @@ +From da6e87670ad4639371da056f9e36201a9236dfa2 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Wed, 29 Jul 2015 19:38:46 +0200 +Subject: [PATCH] fix musl build + +aircrack-ng doesn't build with a musl toolchain due to +cdefs.h internal glibc header being used in internal +ethernet.h [1]. + +[1] http://wiki.musl-libc.org/wiki/FAQ + +Signed-off-by: Romain Naour +--- + src/include/ethernet.h | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/src/include/ethernet.h b/src/include/ethernet.h +index 72d5e81..e9d9236 100644 +--- a/src/include/ethernet.h ++++ b/src/include/ethernet.h +@@ -389,18 +389,20 @@ void ether_vlan_mtap(struct bpf_if *, struct mbuf *, + + #else /* _KERNEL */ + +-#include +- + /* + * Ethernet address conversion/parsing routines. + */ +-__BEGIN_DECLS +-struct ether_addr *ether_aton(const char *); +-int ether_hostton(const char *, struct ether_addr *); +-int ether_line(const char *, struct ether_addr *, char *); +-char *ether_ntoa(const struct ether_addr *); +-int ether_ntohost(char *, const struct ether_addr *); +-__END_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif ++ struct ether_addr *ether_aton(const char *); ++ int ether_hostton(const char *, struct ether_addr *); ++ int ether_line(const char *, struct ether_addr *, char *); ++ char *ether_ntoa(const struct ether_addr *); ++ int ether_ntohost(char *, const struct ether_addr *); ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_KERNEL */ + +-- +2.4.3 + diff --git a/package/android-tools/0005-fix-big-endian-build.patch b/package/android-tools/0005-fix-big-endian-build.patch new file mode 100644 index 0000000000..c35fdcb8c4 --- /dev/null +++ b/package/android-tools/0005-fix-big-endian-build.patch @@ -0,0 +1,61 @@ +Fix build on big endian systems + +The usb_linux_client.c file defines cpu_to_le16/32 by using the C +library htole16/32 function calls. However, cpu_to_le16/32 are used +when initializing structures, i.e in a context where a function call +is not allowed. + +It works fine on little endian systems because htole16/32 are defined +by the C library as no-ops. But on big-endian systems, they are +actually doing something, which might involve calling a function, +causing build failures. + +To solve this, we simply open-code cpu_to_le16/32 in a way that allows +them to be used when initializing structures. + +Signed-off-by: Thomas Petazzoni + +Index: b/core/adb/usb_linux_client.c +=================================================================== +--- a/core/adb/usb_linux_client.c ++++ b/core/adb/usb_linux_client.c +@@ -34,8 +34,15 @@ + #define MAX_PACKET_SIZE_FS 64 + #define MAX_PACKET_SIZE_HS 512 + +-#define cpu_to_le16(x) htole16(x) +-#define cpu_to_le32(x) htole32(x) ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# define cpu_to_le16(x) (x) ++# define cpu_to_le32(x) (x) ++#else ++# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) ++# define cpu_to_le32(x) \ ++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ ++ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) ++#endif + + struct usb_handle + { +Index: b/core/adbd/usb_linux_client.c +=================================================================== +--- a/core/adbd/usb_linux_client.c ++++ b/core/adbd/usb_linux_client.c +@@ -34,8 +34,15 @@ + #define MAX_PACKET_SIZE_FS 64 + #define MAX_PACKET_SIZE_HS 512 + +-#define cpu_to_le16(x) htole16(x) +-#define cpu_to_le32(x) htole32(x) ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# define cpu_to_le16(x) (x) ++# define cpu_to_le32(x) (x) ++#else ++# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) ++# define cpu_to_le32(x) \ ++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ ++ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) ++#endif + + struct usb_handle + { diff --git a/package/bash/0031-patchlevel-31.patch b/package/bash/0031-patchlevel-31.patch new file mode 100644 index 0000000000..d285a1f882 --- /dev/null +++ b/package/bash/0031-patchlevel-31.patch @@ -0,0 +1,116 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-031 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-031 + +Bug-Reported-by: lolilolicon +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00139.html + +Bug-Description: + +The new nameref assignment functionality introduced in bash-4.3 did not perform +enough validation on the variable value and would create variables with +invalid names. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/subst.h 2014-01-11 21:02:27.000000000 -0500 +--- b/subst.h 2014-09-01 12:16:56.000000000 -0400 +*************** +*** 48,51 **** +--- 48,52 ---- + #define ASS_MKGLOBAL 0x0008 /* force global assignment */ + #define ASS_NAMEREF 0x0010 /* assigning to nameref variable */ ++ #define ASS_FROMREF 0x0020 /* assigning from value of nameref variable */ + + /* Flags for the string extraction functions. */ +*** a/bash-4.3-patched/variables.c 2014-05-15 08:26:50.000000000 -0400 +--- b/variables.c 2014-09-01 14:37:44.000000000 -0400 +*************** +*** 2504,2511 **** + int hflags, aflags; + { +! char *newval; + SHELL_VAR *entry; + + entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table); + /* Follow the nameref chain here if this is the global variables table */ + if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table) +--- 2566,2590 ---- + int hflags, aflags; + { +! char *newname, *newval; + SHELL_VAR *entry; ++ #if defined (ARRAY_VARS) ++ arrayind_t ind; ++ char *subp; ++ int sublen; ++ #endif + ++ newname = 0; ++ #if defined (ARRAY_VARS) ++ if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name)) ++ { ++ newname = array_variable_name (name, &subp, &sublen); ++ if (newname == 0) ++ return (SHELL_VAR *)NULL; /* XXX */ ++ entry = hash_lookup (newname, table); ++ } ++ else ++ #endif + entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table); ++ + /* Follow the nameref chain here if this is the global variables table */ + if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table) +*************** +*** 2538,2541 **** +--- 2617,2630 ---- + } + } ++ #if defined (ARRAY_VARS) ++ else if (entry == 0 && newname) ++ { ++ entry = make_new_array_variable (newname); /* indexed array by default */ ++ if (entry == 0) ++ return entry; ++ ind = array_expand_index (name, subp, sublen); ++ bind_array_element (entry, ind, value, aflags); ++ } ++ #endif + else if (entry == 0) + { +*************** +*** 2658,2662 **** + if (nameref_cell (nv) == 0) + return (bind_variable_internal (nv->name, value, nvc->table, 0, flags)); +! return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags)); + } + else +--- 2747,2752 ---- + if (nameref_cell (nv) == 0) + return (bind_variable_internal (nv->name, value, nvc->table, 0, flags)); +! /* XXX - bug here with ref=array[index] */ +! return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags|ASS_FROMREF)); + } + else +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 30 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 31 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0032-patchlevel-32.patch b/package/bash/0032-patchlevel-32.patch new file mode 100644 index 0000000000..6cdc0f1e81 --- /dev/null +++ b/package/bash/0032-patchlevel-32.patch @@ -0,0 +1,55 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-032 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-032 + +Bug-Reported-by: crispusfairbairn@gmail.com +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00013.html + +Bug-Description: + +When bash is running in Posix mode, it allows signals -- including SIGCHLD -- +to interrupt the `wait' builtin, as Posix requires. However, the interrupt +causes bash to not run a SIGCHLD trap for all exited children. This patch +fixes the issue and restores the documented behavior in Posix mode. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/jobs.c 2014-05-14 09:20:15.000000000 -0400 +--- b/jobs.c 2014-09-09 11:50:38.000000000 -0400 +*************** +*** 3340,3344 **** + { + interrupt_immediately = 0; +! trap_handler (SIGCHLD); /* set pending_traps[SIGCHLD] */ + wait_signal_received = SIGCHLD; + /* If we're in a signal handler, let CHECK_WAIT_INTR pick it up; +--- 3346,3352 ---- + { + interrupt_immediately = 0; +! /* This was trap_handler (SIGCHLD) but that can lose traps if +! children_exited > 1 */ +! queue_sigchld_trap (children_exited); + wait_signal_received = SIGCHLD; + /* If we're in a signal handler, let CHECK_WAIT_INTR pick it up; +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 31 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 32 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0033-patchlevel-33.patch b/package/bash/0033-patchlevel-33.patch new file mode 100644 index 0000000000..45fb686e33 --- /dev/null +++ b/package/bash/0033-patchlevel-33.patch @@ -0,0 +1,229 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-033 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-033 + +Bug-Reported-by: mickael9@gmail.com, Jan Rome +Bug-Reference-ID: <20140907224046.382ED3610CC@mickael-laptop.localdomain>, + <540D661D.50908@gmail.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00029.html + http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00030.html + +Bug-Description: + +Bash does not clean up the terminal state in all cases where bash or +readline modifies it and bash is subsequently terminated by a fatal signal. +This happens when the `read' builtin modifies the terminal settings, both +when readline is active and when it is not. It occurs most often when a script +installs a trap that exits on a signal without re-sending the signal to itself. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/shell.c 2014-01-14 08:04:32.000000000 -0500 +--- b/shell.c 2014-12-22 10:27:50.000000000 -0500 +*************** +*** 74,77 **** +--- 74,78 ---- + + #if defined (READLINE) ++ # include + # include "bashline.h" + #endif +*************** +*** 910,913 **** +--- 912,923 ---- + fflush (stderr); + ++ /* Clean up the terminal if we are in a state where it's been modified. */ ++ #if defined (READLINE) ++ if (RL_ISSTATE (RL_STATE_TERMPREPPED) && rl_deprep_term_function) ++ (*rl_deprep_term_function) (); ++ #endif ++ if (read_tty_modified ()) ++ read_tty_cleanup (); ++ + /* Do trap[0] if defined. Allow it to override the exit status + passed to us. */ +*** a/bash-4.3-patched/builtins/read.def 2014-10-01 12:57:38.000000000 -0400 +--- b/builtins/read.def 2014-12-22 10:48:54.000000000 -0500 +*************** +*** 141,148 **** + int sigalrm_seen; + +! static int reading; + static SigHandler *old_alrm; + static unsigned char delim; + + /* In all cases, SIGALRM just sets a flag that we check periodically. This + avoids problems with the semi-tricky stuff we do with the xfree of +--- 141,150 ---- + int sigalrm_seen; + +! static int reading, tty_modified; + static SigHandler *old_alrm; + static unsigned char delim; + ++ static struct ttsave termsave; ++ + /* In all cases, SIGALRM just sets a flag that we check periodically. This + avoids problems with the semi-tricky stuff we do with the xfree of +*************** +*** 189,193 **** + SHELL_VAR *var; + TTYSTRUCT ttattrs, ttset; +- struct ttsave termsave; + #if defined (ARRAY_VARS) + WORD_LIST *alist; +--- 191,194 ---- +*************** +*** 222,226 **** + USE_VAR(lastsig); + +! sigalrm_seen = reading = 0; + + i = 0; /* Index into the string that we are reading. */ +--- 223,227 ---- + USE_VAR(lastsig); + +! sigalrm_seen = reading = tty_modified = 0; + + i = 0; /* Index into the string that we are reading. */ +*************** +*** 439,442 **** +--- 440,445 ---- + goto assign_vars; + } ++ if (interactive_shell == 0) ++ initialize_terminating_signals (); + old_alrm = set_signal_handler (SIGALRM, sigalrm); + add_unwind_protect (reset_alarm, (char *)NULL); +*************** +*** 483,487 **** +--- 486,493 ---- + if (i < 0) + sh_ttyerror (1); ++ tty_modified = 1; + add_unwind_protect ((Function *)ttyrestore, (char *)&termsave); ++ if (interactive_shell == 0) ++ initialize_terminating_signals (); + } + } +*************** +*** 498,502 **** +--- 504,511 ---- + sh_ttyerror (1); + ++ tty_modified = 1; + add_unwind_protect ((Function *)ttyrestore, (char *)&termsave); ++ if (interactive_shell == 0) ++ initialize_terminating_signals (); + } + +*************** +*** 589,592 **** +--- 598,603 ---- + else + lastsig = 0; ++ if (terminating_signal && tty_modified) ++ ttyrestore (&termsave); /* fix terminal before exiting */ + CHECK_TERMSIG; + eof = 1; +*************** +*** 979,982 **** +--- 990,1007 ---- + { + ttsetattr (ttp->fd, ttp->attrs); ++ tty_modified = 0; ++ } ++ ++ void ++ read_tty_cleanup () ++ { ++ if (tty_modified) ++ ttyrestore (&termsave); ++ } ++ ++ int ++ read_tty_modified () ++ { ++ return (tty_modified); + } + +*** ./bash-4.3-patched/builtins/common.h 2014-10-01 12:57:47.000000000 -0400 +--- b/builtins/common.h 2014-12-22 10:10:14.000000000 -0500 +*************** +*** 123,126 **** +--- 141,148 ---- + extern void getopts_reset __P((int)); + ++ /* Functions from read.def */ ++ extern void read_tty_cleanup __P((void)); ++ extern int read_tty_modified __P((void)); ++ + /* Functions from set.def */ + extern int minus_o_option_value __P((char *)); +*** a/bash-4.3-patched/bashline.c 2014-05-14 09:22:39.000000000 -0400 +--- b/bashline.c 2014-09-08 11:28:56.000000000 -0400 +*************** +*** 203,206 **** +--- 203,207 ---- + extern int array_needs_making; + extern int posixly_correct, no_symbolic_links; ++ extern int sigalrm_seen; + extern char *current_prompt_string, *ps1_prompt; + extern STRING_INT_ALIST word_token_alist[]; +*************** +*** 4209,4214 **** + /* If we're going to longjmp to top_level, make sure we clean up readline. + check_signals will call QUIT, which will eventually longjmp to top_level, +! calling run_interrupt_trap along the way. */ +! if (interrupt_state) + rl_cleanup_after_signal (); + bashline_reset_event_hook (); +--- 4262,4268 ---- + /* If we're going to longjmp to top_level, make sure we clean up readline. + check_signals will call QUIT, which will eventually longjmp to top_level, +! calling run_interrupt_trap along the way. The check for sigalrm_seen is +! to clean up the read builtin's state. */ +! if (terminating_signal || interrupt_state || sigalrm_seen) + rl_cleanup_after_signal (); + bashline_reset_event_hook (); +*** a/bash-4.3-patched/sig.c 2014-01-10 15:06:06.000000000 -0500 +--- b/sig.c 2014-09-08 11:26:33.000000000 -0400 +*************** +*** 533,538 **** + /* Set the event hook so readline will call it after the signal handlers + finish executing, so if this interrupted character input we can get +! quick response. */ +! if (interactive_shell && interactive && no_line_editing == 0) + bashline_set_event_hook (); + #endif +--- 533,540 ---- + /* Set the event hook so readline will call it after the signal handlers + finish executing, so if this interrupted character input we can get +! quick response. If readline is active or has modified the terminal we +! need to set this no matter what the signal is, though the check for +! RL_STATE_TERMPREPPED is possibly redundant. */ +! if (RL_ISSTATE (RL_STATE_SIGHANDLER) || RL_ISSTATE (RL_STATE_TERMPREPPED)) + bashline_set_event_hook (); + #endif +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 32 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 33 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0034-patchlevel-34.patch b/package/bash/0034-patchlevel-34.patch new file mode 100644 index 0000000000..79c8945c5c --- /dev/null +++ b/package/bash/0034-patchlevel-34.patch @@ -0,0 +1,94 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-034 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-034 + +Bug-Reported-by: Dreamcat4 +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-05/msg00001.html + +Bug-Description: + +If neither the -f nor -v options is supplied to unset, and a name argument is +found to be a function and unset, subsequent name arguments are not treated as +variables before attempting to unset a function by that name. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/builtins/set.def 2013-04-19 07:20:34.000000000 -0400 +--- b/builtins/set.def 2015-05-05 13:25:36.000000000 -0400 +*************** +*** 752,758 **** +--- 797,805 ---- + { + int unset_function, unset_variable, unset_array, opt, nameref, any_failed; ++ int global_unset_func, global_unset_var; + char *name; + + unset_function = unset_variable = unset_array = nameref = any_failed = 0; ++ global_unset_func = global_unset_var = 0; + + reset_internal_getopt (); +*************** +*** 762,769 **** + { + case 'f': +! unset_function = 1; + break; + case 'v': +! unset_variable = 1; + break; + case 'n': +--- 809,816 ---- + { + case 'f': +! global_unset_func = 1; + break; + case 'v': +! global_unset_var = 1; + break; + case 'n': +*************** +*** 778,782 **** + list = loptend; + +! if (unset_function && unset_variable) + { + builtin_error (_("cannot simultaneously unset a function and a variable")); +--- 825,829 ---- + list = loptend; + +! if (global_unset_func && global_unset_var) + { + builtin_error (_("cannot simultaneously unset a function and a variable")); +*************** +*** 796,799 **** +--- 843,849 ---- + name = list->word->word; + ++ unset_function = global_unset_func; ++ unset_variable = global_unset_var; ++ + #if defined (ARRAY_VARS) + unset_array = 0; + +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 33 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 34 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0035-patchlevel-35.patch b/package/bash/0035-patchlevel-35.patch new file mode 100644 index 0000000000..c18b60dc56 --- /dev/null +++ b/package/bash/0035-patchlevel-35.patch @@ -0,0 +1,67 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-035 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-035 + +Bug-Reported-by: +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00045.html + +Bug-Description: + +A locale with a long name can trigger a buffer overflow and core dump. This +applies on systems that do not have locale_charset in libc, are not using +GNU libiconv, and are not using the libintl that ships with bash in lib/intl. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/lib/sh/unicode.c 2014-01-30 16:47:19.000000000 -0500 +--- b/lib/sh/unicode.c 2015-05-01 08:58:30.000000000 -0400 +*************** +*** 79,83 **** + if (s) + { +! strcpy (charsetbuf, s+1); + t = strchr (charsetbuf, '@'); + if (t) +--- 79,84 ---- + if (s) + { +! strncpy (charsetbuf, s+1, sizeof (charsetbuf) - 1); +! charsetbuf[sizeof (charsetbuf) - 1] = '\0'; + t = strchr (charsetbuf, '@'); + if (t) +*************** +*** 85,89 **** + return charsetbuf; + } +! strcpy (charsetbuf, locale); + return charsetbuf; + } +--- 86,91 ---- + return charsetbuf; + } +! strncpy (charsetbuf, locale, sizeof (charsetbuf) - 1); +! charsetbuf[sizeof (charsetbuf) - 1] = '\0'; + return charsetbuf; + } +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 34 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 35 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0036-patchlevel-36.patch b/package/bash/0036-patchlevel-36.patch new file mode 100644 index 0000000000..f35b29b5bd --- /dev/null +++ b/package/bash/0036-patchlevel-36.patch @@ -0,0 +1,61 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-036 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-036 + +Bug-Reported-by: emanuelczirai@cryptolab.net +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00071.html + +Bug-Description: + +When evaluating and setting integer variables, and the assignment fails to +create a variable (for example, when performing an operation on an array +variable with an invalid subscript), bash attempts to dereference a null +pointer, causing a segmentation violation. + +Patch (apply with `patch -p0'): + +*** a/bash-20150206/variables.c 2015-01-23 20:39:27.000000000 -0500 +--- b/variables.c 2015-02-19 13:56:12.000000000 -0500 +*************** +*** 2834,2841 **** + v = bind_variable (lhs, rhs, 0); + +! if (v && isint) +! VSETATTR (v, att_integer); +! +! VUNSETATTR (v, att_invisible); + + return (v); +--- 2834,2843 ---- + v = bind_variable (lhs, rhs, 0); + +! if (v) +! { +! if (isint) +! VSETATTR (v, att_integer); +! VUNSETATTR (v, att_invisible); +! } + + return (v); +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 35 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 36 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0037-patchlevel-37.patch b/package/bash/0037-patchlevel-37.patch new file mode 100644 index 0000000000..5f8aff356c --- /dev/null +++ b/package/bash/0037-patchlevel-37.patch @@ -0,0 +1,47 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-037 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-037 + +Bug-Reported-by: Greg Wooledge +Bug-Reference-ID: <20150204144240.GN13956@eeg.ccf.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00007.html + +Bug-Description: + +If an associative array uses `@' or `*' as a subscript, `declare -p' produces +output that cannot be reused as input. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/assoc.c 2011-11-05 16:39:05.000000000 -0400 +--- b/assoc.c 2015-02-04 15:28:25.000000000 -0500 +*************** +*** 437,440 **** +--- 440,445 ---- + if (sh_contains_shell_metas (tlist->key)) + istr = sh_double_quote (tlist->key); ++ else if (ALL_ELEMENT_SUB (tlist->key[0]) && tlist->key[1] == '\0') ++ istr = sh_double_quote (tlist->key); + else + istr = tlist->key; +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 36 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 37 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0038-patchlevel-38.patch b/package/bash/0038-patchlevel-38.patch new file mode 100644 index 0000000000..09fd9c2ec0 --- /dev/null +++ b/package/bash/0038-patchlevel-38.patch @@ -0,0 +1,92 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-038 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-038 + +Bug-Reported-by: worley@alum.mit.edu (Dale R. Worley) +Bug-Reference-ID: <201406100051.s5A0pCeB014978@hobgoblin.ariadne.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00028.html + +Bug-Description: + +There are a number of instances where `time' is not recognized as a reserved +word when the shell grammar says it should be. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/parse.y 2014-04-07 11:56:12.000000000 -0400 +--- b/parse.y 2014-06-11 10:25:53.000000000 -0400 +*************** +*** 2819,2827 **** + case OR_OR: + case '&': + case DO: + case THEN: + case ELSE: + case '{': /* } */ +! case '(': /* ) */ + case BANG: /* ! time pipeline */ + case TIME: /* time time pipeline */ +--- 2819,2832 ---- + case OR_OR: + case '&': ++ case WHILE: + case DO: ++ case UNTIL: ++ case IF: + case THEN: ++ case ELIF: + case ELSE: + case '{': /* } */ +! case '(': /* )( */ +! case ')': /* only valid in case statement */ + case BANG: /* ! time pipeline */ + case TIME: /* time time pipeline */ +*** a/bash-4.3-patched/y.tab.c 2014-10-05 13:52:50.000000000 -0400 +--- b/y.tab.c 2015-05-19 15:08:43.000000000 -0400 +*************** +*** 5131,5139 **** + case OR_OR: + case '&': + case DO: + case THEN: + case ELSE: + case '{': /* } */ +! case '(': /* ) */ + case BANG: /* ! time pipeline */ + case TIME: /* time time pipeline */ +--- 5131,5144 ---- + case OR_OR: + case '&': ++ case WHILE: + case DO: ++ case UNTIL: ++ case IF: + case THEN: ++ case ELIF: + case ELSE: + case '{': /* } */ +! case '(': /* )( */ +! case ')': /* only valid in case statement */ + case BANG: /* ! time pipeline */ + case TIME: /* time time pipeline */ +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 37 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 38 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0039-patchlevel-39.patch b/package/bash/0039-patchlevel-39.patch new file mode 100644 index 0000000000..2a555b96c1 --- /dev/null +++ b/package/bash/0039-patchlevel-39.patch @@ -0,0 +1,61 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-039 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-039 + +Bug-Reported-by: SN +Bug-Reference-ID: <54E2554C.205@gazeta.pl> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00060.html + +Bug-Description: + +Using the output of `declare -p' when run in a function can result in variables +that are invisible to `declare -p'. This problem occurs when an assignment +builtin such as `declare' receives a quoted compound array assignment as one of +its arguments. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/arrayfunc.c 2014-10-01 13:08:48.000000000 -0400 +--- b/arrayfunc.c 2015-02-19 14:33:05.000000000 -0500 +*************** +*** 405,408 **** +--- 405,411 ---- + else + array_insert (a, i, l->word->word); ++ ++ VUNSETATTR (var, att_invisible); /* no longer invisible */ ++ + return var; + } +*************** +*** 635,638 **** +--- 638,645 ---- + if (nlist) + dispose_words (nlist); ++ ++ if (var) ++ VUNSETATTR (var, att_invisible); /* no longer invisible */ ++ + return (var); + } +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 38 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 39 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0040-patchlevel-40.patch b/package/bash/0040-patchlevel-40.patch new file mode 100644 index 0000000000..2a03c45a92 --- /dev/null +++ b/package/bash/0040-patchlevel-40.patch @@ -0,0 +1,51 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-040 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-040 + +Bug-Reported-by: Jean Delvare +Bug-Reference-ID: <20150609180231.5f463695@endymion.delvare> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00033.html + +Bug-Description: + +There is a memory leak that occurs when bash expands an array reference on +the rhs of an assignment statement. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/subst.c 2014-10-01 12:57:47.000000000 -0400 +--- b/subst.c 2015-06-22 09:16:53.000000000 -0400 +*************** +*** 5783,5787 **** + if (pflags & PF_ASSIGNRHS) + { +! temp = array_variable_name (name, &tt, (int *)0); + if (ALL_ELEMENT_SUB (tt[0]) && tt[1] == ']') + temp = array_value (name, quoted|Q_DOUBLE_QUOTES, 0, &atype, &ind); +--- 5783,5787 ---- + if (pflags & PF_ASSIGNRHS) + { +! var = array_variable_part (name, &tt, (int *)0); + if (ALL_ELEMENT_SUB (tt[0]) && tt[1] == ']') + temp = array_value (name, quoted|Q_DOUBLE_QUOTES, 0, &atype, &ind); +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 39 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 40 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0041-patchlevel-41.patch b/package/bash/0041-patchlevel-41.patch new file mode 100644 index 0000000000..c8ba4b1081 --- /dev/null +++ b/package/bash/0041-patchlevel-41.patch @@ -0,0 +1,76 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-041 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-041 + +Bug-Reported-by: Hanno Böck +Bug-Reference-ID: <20150623131106.6f111da9@pc1>, <20150707004640.0e61d2f9@pc1> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00089.html, + http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00018.html + +Bug-Description: + +There are several out-of-bounds read errors that occur when completing command +lines where assignment statements appear before the command name. The first +two appear only when programmable completion is enabled; the last one only +happens when listing possible completions. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3.40/bashline.c 2014-12-29 14:39:43.000000000 -0500 +--- b/bashline.c 2015-08-12 10:21:58.000000000 -0400 +*************** +*** 1469,1476 **** +--- 1469,1489 ---- + os = start; + n = 0; ++ was_assignment = 0; + s = find_cmd_start (os); + e = find_cmd_end (end); + do + { ++ /* Don't read past the end of rl_line_buffer */ ++ if (s > rl_end) ++ { ++ s1 = s = e1; ++ break; ++ } ++ /* Or past point if point is within an assignment statement */ ++ else if (was_assignment && s > rl_point) ++ { ++ s1 = s = e1; ++ break; ++ } + /* Skip over assignment statements preceding a command name. If we + don't find a command name at all, we can perform command name +*** a/bash-4.3.40/lib/readline/complete.c 2013-10-14 09:27:10.000000000 -0400 +--- b/lib/readline/complete.c 2015-07-31 09:34:39.000000000 -0400 +*************** +*** 690,693 **** +--- 690,695 ---- + if (temp == 0 || *temp == '\0') + return (pathname); ++ else if (temp[1] == 0 && temp == pathname) ++ return (pathname); + /* If the basename is NULL, we might have a pathname like '/usr/src/'. + Look for a previous slash and, if one is found, return the portion +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 40 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 41 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bash/0042-patchlevel-42.patch b/package/bash/0042-patchlevel-42.patch new file mode 100644 index 0000000000..bb3471c63f --- /dev/null +++ b/package/bash/0042-patchlevel-42.patch @@ -0,0 +1,59 @@ +From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-042 + +Signed-off-by: Gustavo Zacarias + + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-042 + +Bug-Reported-by: Nathan Neulinger +Bug-Reference-ID: <558EFDF2.7060402@neulinger.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00096.html + +Bug-Description: + +There is a problem when parsing command substitutions containing `case' +commands within pipelines that causes the parser to not correctly identify +the end of the command substitution. + +Patch (apply with `patch -p0'): + +*** a/bash-4.3-patched/parse.y 2015-05-18 19:27:05.000000000 -0400 +--- b/parse.y 2015-06-29 10:59:27.000000000 -0400 +*************** +*** 3709,3712 **** +--- 3709,3714 ---- + tflags |= LEX_INWORD; + lex_wlen = 0; ++ if (tflags & LEX_RESWDOK) ++ lex_rwlen = 0; + } + } +*** a/bash-4.3-patched/y.tab.c 2015-05-18 19:27:05.000000000 -0400 +--- b/y.tab.c 2015-06-29 10:59:27.000000000 -0400 +*************** +*** 6021,6024 **** +--- 6021,6026 ---- + tflags |= LEX_INWORD; + lex_wlen = 0; ++ if (tflags & LEX_RESWDOK) ++ lex_rwlen = 0; + } + } +*** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500 +--- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 41 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 42 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/package/bcusdk/0001-Do-not-use-the-non-standard-sys-cdefs.h-header.patch b/package/bcusdk/0001-Do-not-use-the-non-standard-sys-cdefs.h-header.patch new file mode 100644 index 0000000000..fc64386ca6 --- /dev/null +++ b/package/bcusdk/0001-Do-not-use-the-non-standard-sys-cdefs.h-header.patch @@ -0,0 +1,48 @@ +From c36db3f798bf576f42d81a0c51198b17d7112e8c Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 8 Aug 2015 17:43:28 +0200 +Subject: [PATCH] Do not use the non-standard header + + is glibc-specific, and should be used only internally by +glibc, not by external libraries/programs. It is not available in all +standard C libraries. + +Submitted upstream: https://sourceforge.net/p/bcusdk/patches/3/ + +Signed-off-by: Thomas Petazzoni +--- + eibd/include/eibclient.h | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/eibd/include/eibclient.h b/eibd/include/eibclient.h +index 2781878..b095a1c 100644 +--- a/eibd/include/eibclient.h ++++ b/eibd/include/eibclient.h +@@ -27,10 +27,11 @@ + #ifndef EIBCLIENT_H + #define EIBCLIENT_H + +-#include + #include + +-__BEGIN_DECLS; ++#ifdef __cplusplus ++extern "C" { ++#endif + + #include "eibloadresult.h" + +@@ -889,5 +890,9 @@ int EIB_Cache_LastUpdates_async (EIBConnection * con, uint16_t start, + uint16_t * end); + + +-__END_DECLS ++ ++#ifdef __cplusplus ++} ++#endif ++ + #endif +-- +2.5.0 + diff --git a/package/bcusdk/0002-fd_set-requires-inclusion-of-sys-select.h.patch b/package/bcusdk/0002-fd_set-requires-inclusion-of-sys-select.h.patch new file mode 100644 index 0000000000..723de5c1a2 --- /dev/null +++ b/package/bcusdk/0002-fd_set-requires-inclusion-of-sys-select.h.patch @@ -0,0 +1,31 @@ +From 2541ee3d709803096b17e45610ccc1404e2e5eee Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 8 Aug 2015 17:46:34 +0200 +Subject: [PATCH] fd_set requires inclusion of + +According to POSIX.1-2001, the definition fd_set and related macros is +in , so it should be included in files using fd_set to +make the code compatible with all standard C libraries. + +Submitted upstream: https://sourceforge.net/p/bcusdk/patches/3/ + +Signed-off-by: Thomas Petazzoni +--- + eibd/examples/common.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/eibd/examples/common.h b/eibd/examples/common.h +index 51fc514..f038da1 100644 +--- a/eibd/examples/common.h ++++ b/eibd/examples/common.h +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include "eibclient.h" + + /** unsigned char*/ +-- +2.5.0 + diff --git a/package/binutils/2.23.2/120-sh-conf.patch b/package/binutils/2.23.2/120-sh-conf.patch new file mode 100644 index 0000000000..ea3d1b6068 --- /dev/null +++ b/package/binutils/2.23.2/120-sh-conf.patch @@ -0,0 +1,29 @@ +r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines + +Likewise, binutils has no idea about any of these new targets either, so we +fix that up too.. now we're able to actually build a real toolchain for +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more +inept targets than that one, really. Go look, I promise). + +--- a/configure ++++ b/configure +@@ -1495,7 +1495,7 @@ + mips*-*-*) + noconfigdirs="$noconfigdirs gprof" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${target}" in + sh*-*-elf) + ;; +--- a/configure.ac ++++ b/configure.ac +@@ -712,7 +712,7 @@ + mips*-*-*) + noconfigdirs="$noconfigdirs gprof" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${target}" in + sh*-*-elf) + ;; diff --git a/package/binutils/2.23.2/300-001_ld_makefile_patch.patch b/package/binutils/2.23.2/300-001_ld_makefile_patch.patch new file mode 100644 index 0000000000..5cb0f614d8 --- /dev/null +++ b/package/binutils/2.23.2/300-001_ld_makefile_patch.patch @@ -0,0 +1,24 @@ +diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am +--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200 ++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200 +@@ -18,7 +18,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in +--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200 ++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200 +@@ -287,7 +287,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/package/binutils/2.23.2/300-012_check_ldrunpath_length.patch b/package/binutils/2.23.2/300-012_check_ldrunpath_length.patch new file mode 100644 index 0000000000..df783109bb --- /dev/null +++ b/package/binutils/2.23.2/300-012_check_ldrunpath_length.patch @@ -0,0 +1,21 @@ +diff -Nura binutils-2.21.orig/ld/emultempl/elf32.em binutils-2.21/ld/emultempl/elf32.em +--- binutils-2.21.orig/ld/emultempl/elf32.em 2010-10-29 09:10:36.000000000 -0300 ++++ binutils-2.21/ld/emultempl/elf32.em 2010-12-10 09:26:56.746102724 -0300 +@@ -1270,6 +1270,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1497,6 +1499,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + + for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) diff --git a/package/binutils/2.23.2/500-sysroot.patch b/package/binutils/2.23.2/500-sysroot.patch new file mode 100644 index 0000000000..e49c795332 --- /dev/null +++ b/package/binutils/2.23.2/500-sysroot.patch @@ -0,0 +1,37 @@ +Signed-off-by: Sven Rebhan + +Always try to prepend the sysroot prefix to absolute filenames first. + +http://bugs.gentoo.org/275666 +http://sourceware.org/bugzilla/show_bug.cgi?id=10340 + +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -308,18 +308,25 @@ + directory first. */ + if (! entry->flags.maybe_archive) + { +- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)) ++ /* For absolute pathnames, try to always open the file in the ++ sysroot first. If this fails, try to open the file at the ++ given location. */ ++ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename); ++ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename) ++ && ld_sysroot) + { + char *name = concat (ld_sysroot, entry->filename, + (const char *) NULL); + if (ldfile_try_open_bfd (name, entry)) + { + entry->filename = name; ++ entry->flags.sysrooted = TRUE; + return TRUE; + } + free (name); + } +- else if (ldfile_try_open_bfd (entry->filename, entry)) ++ ++ if (ldfile_try_open_bfd (entry->filename, entry)) + return TRUE; + + if (IS_ABSOLUTE_PATH (entry->filename)) diff --git a/package/binutils/2.23.2/600-poison-system-directories.patch b/package/binutils/2.23.2/600-poison-system-directories.patch new file mode 100644 index 0000000000..780e48e801 --- /dev/null +++ b/package/binutils/2.23.2/600-poison-system-directories.patch @@ -0,0 +1,279 @@ +Patch adapted to binutils 2.23.2 and extended to use +BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni. + +Signed-off-by: Thomas Petazzoni + +Upstream-Status: Inappropriate [distribution: codesourcery] + +Patch originally created by Mark Hatle, forward-ported to +binutils 2.21 by Scott Garman. + +purpose: warn for uses of system directories when cross linking + +Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 + +2008-07-02 Joseph Myers + + ld/ + * ld.h (args_type): Add error_poison_system_directories. + * ld.texinfo (--error-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.error_poison_system_directories. + * ldmain.c (main): Initialize + command_line.error_poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --error-poison-system-directories. + (parse_args): Handle new option. + +2007-06-13 Joseph Myers + + ld/ + * config.in: Regenerate. + * ld.h (args_type): Add poison_system_directories. + * ld.texinfo (--no-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.poison_system_directories. + * ldmain.c (main): Initialize + command_line.poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_NO_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --no-poison-system-directories. + (parse_args): Handle new option. + +2007-04-20 Joseph Myers + + Merge from Sourcery G++ binutils 2.17: + + 2007-03-20 Joseph Myers + Based on patch by Mark Hatle . + ld/ + * configure.in (--enable-poison-system-directories): New option. + * configure, config.in: Regenerate. + * ldfile.c (ldfile_add_library_path): If + ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib, + /usr/lib, /usr/local/lib or /usr/X11R6/lib. + +Signed-off-by: Mark Hatle +Signed-off-by: Scott Garman + +Index: b/ld/config.in +=================================================================== +--- a/ld/config.in ++++ b/ld/config.in +@@ -11,6 +11,9 @@ + language is requested. */ + #undef ENABLE_NLS + ++/* Define to warn for use of native system library directories */ ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES ++ + /* Additional extension a shared object might have. */ + #undef EXTRA_SHLIB_EXTENSION + +Index: b/ld/configure +=================================================================== +--- a/ld/configure ++++ b/ld/configure +@@ -773,6 +773,7 @@ + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_werror +@@ -1428,6 +1429,8 @@ + (and sometimes confusing) to the casual installer + --enable-targets alternative target configurations + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) ++ --enable-poison-system-directories ++ warn for use of native system library directories + --enable-gold[=ARG] build gold [ARG={default,yes,no}] + --enable-got= GOT handling scheme (target, single, negative, + multigot) +@@ -4338,7 +4341,18 @@ + fi + + ++# Check whether --enable-poison-system-directories was given. ++if test "${enable_poison_system_directories+set}" = set; then : ++ enableval=$enable_poison_system_directories; ++else ++ enable_poison_system_directories=no ++fi ++ ++if test "x${enable_poison_system_directories}" = "xyes"; then + ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h ++ ++fi + + # Check whether --enable-got was given. + if test "${enable_got+set}" = set; then : +Index: b/ld/configure.in +=================================================================== +--- a/ld/configure.in ++++ b/ld/configure.in +@@ -70,6 +70,16 @@ + AC_SUBST(TARGET_SYSTEM_ROOT) + AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) + ++AC_ARG_ENABLE([poison-system-directories], ++ AS_HELP_STRING([--enable-poison-system-directories], ++ [warn for use of native system library directories]),, ++ [enable_poison_system_directories=no]) ++if test "x${enable_poison_system_directories}" = "xyes"; then ++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], ++ [1], ++ [Define to warn for use of native system library directories]) ++fi ++ + dnl Use --enable-gold to decide if this linker should be the default. + dnl "install_as_default" is set to false if gold is the default linker. + dnl "installed_linker" is the installed BFD linker name. +Index: b/ld/ldfile.c +=================================================================== +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -116,6 +116,23 @@ + new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); + else + new_dirs->name = xstrdup (name); ++ ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES ++ if (command_line.poison_system_directories ++ && ((!strncmp (name, "/lib", 4)) ++ || (!strncmp (name, "/usr/lib", 8)) ++ || (!strncmp (name, "/usr/local/lib", 14)) ++ || (!strncmp (name, "/usr/X11R6/lib", 14)))) ++ { ++ if (command_line.error_poison_system_directories) ++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ else ++ einfo (_("%P: warning: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ } ++#endif ++ + } + + /* Try to open a BFD for a lang_input_statement. */ +Index: b/ld/ld.h +=================================================================== +--- a/ld/ld.h ++++ b/ld/ld.h +@@ -203,6 +203,14 @@ + /* If TRUE we'll just print the default output on stdout. */ + bfd_boolean print_output_format; + ++ /* If TRUE (the default) warn for uses of system directories when ++ cross linking. */ ++ bfd_boolean poison_system_directories; ++ ++ /* If TRUE (default FALSE) give an error for uses of system ++ directories when cross linking instead of a warning. */ ++ bfd_boolean error_poison_system_directories; ++ + /* Big or little endian as set on command line. */ + enum endian_enum endian; + +Index: b/ld/ldmain.c +=================================================================== +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -265,6 +265,8 @@ + command_line.warn_search_mismatch = TRUE; + command_line.check_section_addresses = -1; + command_line.disable_target_specific_optimizations = -1; ++ command_line.poison_system_directories = TRUE; ++ command_line.error_poison_system_directories = FALSE; + + /* We initialize DEMANGLING based on the environment variable + COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the +Index: b/ld/ld.texinfo +=================================================================== +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -2154,6 +2154,18 @@ + + Passing @code{none} for @var{style} disables the setting from any + @code{--build-id} options earlier on the command line. ++ ++@kindex --no-poison-system-directories ++@item --no-poison-system-directories ++Do not warn for @option{-L} options using system directories such as ++@file{/usr/lib} when cross linking. This option is intended for use ++in chroot environments when such directories contain the correct ++libraries for the target system rather than the host. ++ ++@kindex --error-poison-system-directories ++@item --error-poison-system-directories ++Give an error instead of a warning for @option{-L} options using ++system directories when cross linking. + @end table + + @c man end +Index: b/ld/lexsup.c +=================================================================== +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -498,6 +498,14 @@ + TWO_DASHES }, + { {"wrap", required_argument, NULL, OPTION_WRAP}, + '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES }, ++ { {"no-poison-system-directories", no_argument, NULL, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Do not warn for -L options using system directories"), ++ TWO_DASHES }, ++ { {"error-poison-system-directories", no_argument, NULL, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Give an error for -L options using system directories"), ++ TWO_DASHES }, + }; + + #define OPTION_COUNT ARRAY_SIZE (ld_options) +@@ -510,6 +518,7 @@ + int ingroup = 0; + char *default_dirlist = NULL; + char *shortopts; ++ char *BR_paranoid_env; + struct option *longopts; + struct option *really_longopts; + int last_optind; +@@ -1427,9 +1436,21 @@ + einfo (_("%P%X: --hash-size needs a numeric argument\n")); + } + break; ++ ++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES: ++ command_line.poison_system_directories = FALSE; ++ break; ++ ++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: ++ command_line.error_poison_system_directories = TRUE; ++ break; + } + } + ++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH"); ++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0) ++ command_line.error_poison_system_directories = TRUE; ++ + while (ingroup) + { + lang_leave_group (); +Index: b/ld/ldlex.h +=================================================================== +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -136,6 +136,8 @@ + #endif /* ENABLE_PLUGINS */ + OPTION_DEFAULT_SCRIPT, + OPTION_PRINT_OUTPUT_FORMAT, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, + }; + + /* The initial parser states. */ diff --git a/package/binutils/2.23.2/900-xtensa-trampolines.patch b/package/binutils/2.23.2/900-xtensa-trampolines.patch new file mode 100644 index 0000000000..b5b934fcab --- /dev/null +++ b/package/binutils/2.23.2/900-xtensa-trampolines.patch @@ -0,0 +1,846 @@ +From a82c7d9030b67a6a76a5403d0e1641f9e42141ac Mon Sep 17 00:00:00 2001 +From: David Weatherford +Date: Fri, 21 Mar 2014 11:53:42 +0000 +Subject: [PATCH] Add support to the Xtensa target for creating trampolines for + out-of-range branches. + + * tc-xtensa.c (xtensa_check_frag_count, xtensa_create_trampoline_frag) + (xtensa_maybe_create_trampoline_frag, init_trampoline_frag) + (find_trampoline_seg, search_trampolines, get_best_trampoline) + (check_and_update_trampolines, add_jump_to_trampoline) + (dump_trampolines): New function. + (md_parse_option): Add cases for --[no-]trampolines options. + (md_assemble, finish_vinsn, xtensa_end): Add call to + xtensa_check_frag_count. + (xg_assemble_vliw_tokens): Add call to + xtensa_maybe_create_trampoline_frag. + (xtensa_relax_frag): Relax fragments with RELAX_TRAMPOLINE state. + (relax_frag_immed): Relax jump instructions that cannot reach its + target. + * tc-xtensa.h (xtensa_relax_statesE::RELAX_TRAMPOLINE): New relax + state. + + * as.texinfo: Document --[no-]trampolines command-line options. + * c-xtensa.texi: Document trampolines relaxation and command line + options. + + * frags.c (get_frag_count, clear_frag_count): New function. + (frag_alloc): Increment totalfrags counter. + * frags.h (get_frag_count, clear_frag_count): New function. + + * all.exp: Add test for trampoline relaxation. + * trampoline.d: Trampoline relaxation expected dump. + * trampoline.s: Trampoline relaxation test source. +--- +Backported from: a82c7d9030b67a6a76a5403d0e1641f9e42141ac +Changes to Changelog files are dropped. + + gas/config/tc-xtensa.c | 558 +++++++++++++++++++++++++++++++++- + gas/config/tc-xtensa.h | 5 + + gas/frags.c | 15 + + gas/frags.h | 3 + + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/trampoline.d | 26 ++ + gas/testsuite/gas/xtensa/trampoline.s | 21 ++ + 11 files changed, 753 insertions(+), 2 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/trampoline.d + create mode 100644 gas/testsuite/gas/xtensa/trampoline.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index fe8ec0f..ea23c96 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -468,6 +468,12 @@ static void xtensa_set_frag_assembly_state (fragS *); + static void finish_vinsn (vliw_insn *); + static bfd_boolean emit_single_op (TInsn *); + static int total_frag_text_expansion (fragS *); ++static bfd_boolean use_trampolines = TRUE; ++static void xtensa_check_frag_count (void); ++static void xtensa_create_trampoline_frag (bfd_boolean); ++static void xtensa_maybe_create_trampoline_frag (void); ++struct trampoline_frag; ++static int init_trampoline_frag (struct trampoline_frag *); + + /* Alignment Functions. */ + +@@ -520,6 +526,7 @@ static void tinsn_from_chars (TInsn *, char *, int); + static void tinsn_immed_from_frag (TInsn *, fragS *, int); + static int get_num_stack_text_bytes (IStack *); + static int get_num_stack_literal_bytes (IStack *); ++static bfd_boolean tinsn_to_slotbuf (xtensa_format, int, TInsn *, xtensa_insnbuf); + + /* vliw_insn functions. */ + +@@ -687,7 +694,10 @@ enum + option_prefer_l32r, + option_prefer_const16, + +- option_target_hardware ++ option_target_hardware, ++ ++ option_trampolines, ++ option_no_trampolines, + }; + + const char *md_shortopts = ""; +@@ -760,6 +770,9 @@ struct option md_longopts[] = + + { "target-hardware", required_argument, NULL, option_target_hardware }, + ++ { "trampolines", no_argument, NULL, option_trampolines }, ++ { "no-trampolines", no_argument, NULL, option_no_trampolines }, ++ + { NULL, no_argument, NULL, 0 } + }; + +@@ -940,6 +953,14 @@ md_parse_option (int c, char *arg) + directive_state[directive_transform] = FALSE; + return 1; + ++ case option_trampolines: ++ use_trampolines = TRUE; ++ return 1; ++ ++ case option_no_trampolines: ++ use_trampolines = FALSE; ++ return 1; ++ + default: + return 0; + } +@@ -963,7 +984,9 @@ Xtensa options:\n\ + flix bundles\n\ + --no-allow-flix neither allow hand-written nor generate\n\ + flix bundles\n\ +- --rename-section old=new Rename section 'old' to 'new'\n", stream); ++ --rename-section old=new Rename section 'old' to 'new'\n\ ++ --[no-]trampolines [Do not] generate trampolines (jumps to jumps)\n\ ++ when jumps do not reach their targets\n", stream); + } + + +@@ -5568,6 +5591,8 @@ md_assemble (char *str) + + /* We've just emitted a new instruction so clear the list of labels. */ + xtensa_clear_insn_labels (); ++ ++ xtensa_check_frag_count (); + } + + +@@ -6372,6 +6397,8 @@ finish_vinsn (vliw_insn *vinsn) + xg_assemble_vliw_tokens (vinsn); + + xg_clear_vinsn (vinsn); ++ ++ xtensa_check_frag_count (); + } + + +@@ -7140,6 +7167,7 @@ xg_assemble_vliw_tokens (vliw_insn *vinsn) + RELAX_UNREACHABLE, + frag_now->fr_symbol, frag_now->fr_offset, NULL); + xtensa_set_frag_assembly_state (frag_now); ++ xtensa_maybe_create_trampoline_frag (); + } + else if (is_branch && do_align_targets ()) + { +@@ -7222,9 +7250,164 @@ xtensa_end (void) + xtensa_sanity_check (); + + xtensa_add_config_info (); ++ ++ xtensa_check_frag_count (); ++} ++ ++ ++struct trampoline_frag ++{ ++ struct trampoline_frag *next; ++ bfd_boolean needs_jump_around; ++ fragS *fragP; ++ fixS *fixP; ++}; ++ ++struct trampoline_seg ++{ ++ struct trampoline_seg *next; ++ asection *seg; ++ struct trampoline_frag trampoline_list; ++}; ++ ++static struct trampoline_seg trampoline_seg_list; ++#define J_RANGE (128 * 1024) ++ ++static int unreachable_count = 0; ++ ++ ++static void ++xtensa_maybe_create_trampoline_frag (void) ++{ ++ if (!use_trampolines) ++ return; ++ ++ /* We create an area for possible trampolines every 10 unreachable frags. ++ These are preferred over the ones not preceded by an unreachable frag, ++ because we don't have to jump around them. This function is called after ++ each RELAX_UNREACHABLE frag is created. */ ++ ++ if (++unreachable_count > 10) ++ { ++ xtensa_create_trampoline_frag (FALSE); ++ clear_frag_count (); ++ unreachable_count = 0; ++ } ++} ++ ++static void ++xtensa_check_frag_count (void) ++{ ++ if (!use_trampolines || frag_now->tc_frag_data.is_no_transform) ++ return; ++ ++ /* We create an area for possible trampolines every 8000 frags or so. This ++ is an estimate based on the max range of a "j" insn (+/-128K) divided ++ by a typical frag byte count (16), minus a few for safety. This function ++ is called after each source line is processed. */ ++ ++ if (get_frag_count () > 8000) ++ { ++ xtensa_create_trampoline_frag (TRUE); ++ clear_frag_count (); ++ unreachable_count = 0; ++ } ++} ++ ++static xtensa_insnbuf trampoline_buf = NULL; ++static xtensa_insnbuf trampoline_slotbuf = NULL; ++ ++#define TRAMPOLINE_FRAG_SIZE 3000 ++ ++static void ++xtensa_create_trampoline_frag (bfd_boolean needs_jump_around) ++{ ++ /* Emit a frag where we can place intermediate jump instructions, ++ in case we need to jump farther than 128K bytes. ++ Each jump instruction takes three bytes. ++ We allocate enough for 1000 trampolines in each frag. ++ If that's not enough, oh well. */ ++ ++ struct trampoline_seg *ts = trampoline_seg_list.next; ++ struct trampoline_frag *tf; ++ char *varP; ++ fragS *fragP; ++ int size = TRAMPOLINE_FRAG_SIZE; ++ ++ for ( ; ts; ts = ts->next) ++ { ++ if (ts->seg == now_seg) ++ break; ++ } ++ ++ if (ts == NULL) ++ { ++ ts = (struct trampoline_seg *)xcalloc(sizeof (struct trampoline_seg), 1); ++ ts->next = trampoline_seg_list.next; ++ trampoline_seg_list.next = ts; ++ ts->seg = now_seg; ++ } ++ ++ frag_wane (frag_now); ++ frag_new (0); ++ xtensa_set_frag_assembly_state (frag_now); ++ varP = frag_var (rs_machine_dependent, size, size, RELAX_TRAMPOLINE, NULL, 0, NULL); ++ fragP = (fragS *)(varP - SIZEOF_STRUCT_FRAG); ++ if (trampoline_buf == NULL) ++ { ++ trampoline_buf = xtensa_insnbuf_alloc (xtensa_default_isa); ++ trampoline_slotbuf = xtensa_insnbuf_alloc (xtensa_default_isa); ++ } ++ tf = (struct trampoline_frag *)xmalloc(sizeof (struct trampoline_frag)); ++ tf->next = ts->trampoline_list.next; ++ ts->trampoline_list.next = tf; ++ tf->needs_jump_around = needs_jump_around; ++ tf->fragP = fragP; ++ tf->fixP = NULL; ++} ++ ++ ++static struct trampoline_seg * ++find_trampoline_seg (asection *seg) ++{ ++ struct trampoline_seg *ts = trampoline_seg_list.next; ++ ++ for ( ; ts; ts = ts->next) ++ { ++ if (ts->seg == seg) ++ return ts; ++ } ++ ++ return NULL; + } + + ++void dump_trampolines (void); ++ ++void ++dump_trampolines (void) ++{ ++ struct trampoline_seg *ts = trampoline_seg_list.next; ++ ++ for ( ; ts; ts = ts->next) ++ { ++ asection *seg = ts->seg; ++ ++ if (seg == NULL) ++ continue; ++ fprintf(stderr, "SECTION %s\n", seg->name); ++ struct trampoline_frag *tf = ts->trampoline_list.next; ++ for ( ; tf; tf = tf->next) ++ { ++ if (tf->fragP == NULL) ++ continue; ++ fprintf(stderr, " 0x%08x: fix=%d, jump_around=%s\n", ++ (int)tf->fragP->fr_address, (int)tf->fragP->fr_fix, ++ tf->needs_jump_around ? "T" : "F"); ++ } ++ } ++} ++ + static void + xtensa_cleanup_align_frags (void) + { +@@ -8708,6 +8891,149 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + new_stretch += relax_frag_for_align (fragP, stretch); + break; + ++ case RELAX_TRAMPOLINE: ++ if (fragP->tc_frag_data.relax_seen) ++ { ++ segment_info_type *seginfo = seg_info (now_seg); ++ fragS *fP; /* The out-of-range jump. */ ++ fixS *fixP; ++ ++ /* Scan for jumps that will not reach. */ ++ for (fixP = seginfo->fix_root; fixP ; fixP = fixP->fx_next) ++ { ++ symbolS *s = fixP->fx_addsy; ++ xtensa_opcode opcode; ++ int target; ++ int addr; ++ int delta; ++ ++ if (fixP->fx_r_type < BFD_RELOC_XTENSA_SLOT0_OP || ++ fixP->fx_r_type > BFD_RELOC_XTENSA_SLOT14_OP) ++ continue; ++ xtensa_insnbuf_from_chars (isa, trampoline_buf, ++ (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where, ++ 0); ++ fmt = xtensa_format_decode (isa, trampoline_buf); ++ gas_assert (fmt != XTENSA_UNDEFINED); ++ slot = fixP->tc_fix_data.slot; ++ xtensa_format_get_slot (isa, fmt, slot, trampoline_buf, trampoline_slotbuf); ++ opcode = xtensa_opcode_decode (isa, fmt, slot, trampoline_slotbuf); ++ if (opcode != xtensa_j_opcode) ++ continue; ++ target = S_GET_VALUE (s); ++ addr = fixP->fx_frag->fr_address; ++ delta = target - addr + stretch; ++ if (delta > J_RANGE || delta < -1 * J_RANGE) ++ { /* Found an out-of-range jump; scan the list of trampolines for the best match. */ ++ struct trampoline_seg *ts = find_trampoline_seg (now_seg); ++ struct trampoline_frag *tf = ts->trampoline_list.next; ++ struct trampoline_frag *prev = &ts->trampoline_list; ++ int lower = (target < addr) ? target : addr; ++ int upper = (target > addr) ? target : addr; ++ int midpoint = lower + (upper - lower) / 2; ++ ++ if ((upper - lower) > 2 * J_RANGE) ++ { ++ /* One trampoline won't suffice; we need multiple jumps. ++ Jump to the trampoline that's farthest, but still in ++ range relative to the original "j" instruction. */ ++ for ( ; tf; prev = tf, tf = tf->next ) ++ { ++ int this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ int next_addr = (tf->next) ? tf->next->fragP->fr_address + tf->next->fragP->fr_fix : 0 ; ++ ++ if (addr == lower) ++ { ++ /* Forward jump. */ ++ if (this_addr - addr < J_RANGE) ++ break; ++ } ++ else ++ { ++ /* Backward jump. */ ++ if (next_addr == 0 || addr - next_addr > J_RANGE) ++ break; ++ } ++ } ++ } ++ else ++ { ++ struct trampoline_frag *best_tf = NULL; ++ int best_delta = 0; ++ ++ for ( ; tf; prev = tf, tf = tf->next ) ++ { ++ int this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ int this_delta = abs (this_addr - midpoint); ++ ++ if (!best_tf || this_delta < best_delta) ++ { ++ best_tf = tf; ++ best_delta = this_delta; ++ } ++ } ++ tf = best_tf; ++ } ++ if (tf->fragP == fragP) ++ { ++ int trampaddr = fragP->fr_address + fragP->fr_fix; ++ ++ if (abs (addr - trampaddr) < J_RANGE) ++ { /* The trampoline is in range of original; fix it! */ ++ fixS *newfixP; ++ int offset; ++ TInsn insn; ++ symbolS *lsym; ++ ++ new_stretch += init_trampoline_frag (tf); ++ offset = fragP->fr_fix; /* Where to assemble the j insn. */ ++ lsym = fragP->fr_symbol; ++ fP = fixP->fx_frag; ++ /* Assemble a jump to the target label here. */ ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], lsym, offset); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, trampoline_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, trampoline_buf, trampoline_slotbuf); ++ xtensa_insnbuf_to_chars (isa, trampoline_buf, (unsigned char *)fragP->fr_literal + offset, 3); ++ fragP->fr_fix += 3; ++ fragP->fr_var -= 3; ++ /* Add a fix-up for the original j insn. */ ++ newfixP = fix_new (fP, fixP->fx_where, fixP->fx_size, lsym, fragP->fr_fix - 3, TRUE, fixP->fx_r_type); ++ newfixP->fx_no_overflow = 1; ++ newfixP->tc_fix_data.X_add_symbol = lsym; ++ newfixP->tc_fix_data.X_add_number = offset; ++ newfixP->tc_fix_data.slot = slot; ++ /* Move the fix-up from the original j insn to this one. */ ++ fixP->fx_frag = fragP; ++ fixP->fx_where = fragP->fr_fix - 3; ++ fixP->tc_fix_data.slot = 0; ++ /* Adjust the jump around this trampoline (if present). */ ++ if (tf->fixP != NULL) ++ { ++ tf->fixP->fx_offset += 3; ++ } ++ new_stretch += 3; ++ fragP->tc_frag_data.relax_seen = FALSE; /* Need another pass. */ ++ /* Do we have room for more? */ ++ if (fragP->fr_var < 3) ++ { /* No, convert to fill. */ ++ frag_wane (fragP); ++ fragP->fr_subtype = 0; ++ /* Remove from the trampoline_list. */ ++ prev->next = tf->next; ++ break; ++ } ++ } ++ } ++ } ++ } ++ } ++ break; ++ + default: + as_bad (_("bad relaxation state")); + } +@@ -9146,6 +9472,200 @@ bytes_to_stretch (fragS *this_frag, + } + + ++static struct trampoline_frag * ++search_trampolines (TInsn *tinsn, fragS *fragP, bfd_boolean unreachable_only) ++{ ++ struct trampoline_seg *ts = find_trampoline_seg (now_seg); ++ struct trampoline_frag *tf = (ts) ? ts->trampoline_list.next : NULL; ++ struct trampoline_frag *best_tf = NULL; ++ int best_delta = 0; ++ int best_addr = 0; ++ symbolS *sym = tinsn->tok[0].X_add_symbol; ++ offsetT target = S_GET_VALUE (sym) + tinsn->tok[0].X_add_number; ++ offsetT addr = fragP->fr_address; ++ offsetT lower = (addr < target) ? addr : target; ++ offsetT upper = (addr > target) ? addr : target; ++ int delta = upper - lower; ++ offsetT midpoint = lower + delta / 2; ++ int this_delta = -1; ++ int this_addr = -1; ++ ++ if (delta > 2 * J_RANGE) ++ { ++ /* One trampoline won't do; we need multiple. ++ Choose the farthest trampoline that's still in range of the original ++ and let a later pass finish the job. */ ++ for ( ; tf; tf = tf->next) ++ { ++ int next_addr = (tf->next) ? tf->next->fragP->fr_address + tf->next->fragP->fr_fix : 0; ++ ++ this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ if (lower == addr) ++ { ++ /* Forward jump. */ ++ if (this_addr - addr < J_RANGE) ++ break; ++ } ++ else ++ { ++ /* Backward jump. */ ++ if (next_addr == 0 || addr - next_addr > J_RANGE) ++ break; ++ } ++ if (abs (addr - this_addr) < J_RANGE) ++ return tf; ++ ++ return NULL; ++ } ++ } ++ for ( ; tf; tf = tf->next) ++ { ++ this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ this_delta = abs (this_addr - midpoint); ++ if (unreachable_only && tf->needs_jump_around) ++ continue; ++ if (!best_tf || this_delta < best_delta) ++ { ++ best_tf = tf; ++ best_delta = this_delta; ++ best_addr = this_addr; ++ } ++ } ++ ++ if (best_tf && ++ best_delta < J_RANGE && ++ abs(best_addr - lower) < J_RANGE && ++ abs(best_addr - upper) < J_RANGE) ++ return best_tf; ++ ++ return NULL; /* No suitable trampoline found. */ ++} ++ ++ ++static struct trampoline_frag * ++get_best_trampoline (TInsn *tinsn, fragS *fragP) ++{ ++ struct trampoline_frag *tf = NULL; ++ ++ tf = search_trampolines (tinsn, fragP, TRUE); /* Try unreachable first. */ ++ ++ if (tf == NULL) ++ tf = search_trampolines (tinsn, fragP, FALSE); /* Try ones needing a jump-around, too. */ ++ ++ return tf; ++} ++ ++ ++static void ++check_and_update_trampolines (void) ++{ ++ struct trampoline_seg *ts = find_trampoline_seg (now_seg); ++ struct trampoline_frag *tf = ts->trampoline_list.next; ++ struct trampoline_frag *prev = &ts->trampoline_list; ++ ++ for ( ; tf; prev = tf, tf = tf->next) ++ { ++ if (tf->fragP->fr_var < 3) ++ { ++ frag_wane (tf->fragP); ++ prev->next = tf->next; ++ tf->fragP = NULL; ++ } ++ } ++} ++ ++ ++static int ++init_trampoline_frag (struct trampoline_frag *trampP) ++{ ++ fragS *fp = trampP->fragP; ++ int growth = 0; ++ ++ if (fp->fr_fix == 0) ++ { ++ symbolS *lsym; ++ char label[10 + 2 * sizeof(fp)]; ++ sprintf (label, ".L0_TR_%p", fp); ++ ++ lsym = (symbolS *)local_symbol_make (label, now_seg, 0, fp); ++ fp->fr_symbol = lsym; ++ if (trampP->needs_jump_around) ++ { ++ /* Add a jump around this block of jumps, in case ++ control flows into this block. */ ++ fixS *fixP; ++ TInsn insn; ++ xtensa_format fmt; ++ xtensa_isa isa = xtensa_default_isa; ++ ++ fp->tc_frag_data.is_insn = 1; ++ /* Assemble a jump insn. */ ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], lsym, 3); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, trampoline_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, trampoline_buf, trampoline_slotbuf); ++ xtensa_insnbuf_to_chars (isa, trampoline_buf, (unsigned char *)fp->fr_literal, 3); ++ fp->fr_fix += 3; ++ fp->fr_var -= 3; ++ growth = 3; ++ fixP = fix_new (fp, 0, 3, lsym, 3, TRUE, BFD_RELOC_XTENSA_SLOT0_OP); ++ trampP->fixP = fixP; ++ } ++ } ++ return growth; ++} ++ ++ ++static int ++add_jump_to_trampoline (struct trampoline_frag *trampP, fragS *origfrag) ++{ ++ fragS *tramp = trampP->fragP; ++ fixS *fixP; ++ int offset = tramp->fr_fix; /* Where to assemble the j insn. */ ++ TInsn insn; ++ symbolS *lsym; ++ symbolS *tsym; ++ int toffset; ++ xtensa_format fmt; ++ xtensa_isa isa = xtensa_default_isa; ++ int growth = 0; ++ ++ lsym = tramp->fr_symbol; ++ /* Assemble a jump to the target label in the trampoline frag. */ ++ tsym = origfrag->tc_frag_data.slot_symbols[0]; ++ toffset = origfrag-> tc_frag_data.slot_offsets[0]; ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], tsym, toffset); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, trampoline_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, trampoline_buf, trampoline_slotbuf); ++ xtensa_insnbuf_to_chars (isa, trampoline_buf, (unsigned char *)tramp->fr_literal + offset, 3); ++ tramp->fr_fix += 3; ++ tramp->fr_var -= 3; ++ growth = 3; ++ /* add a fix-up for the trampoline jump. */ ++ fixP = fix_new (tramp, tramp->fr_fix - 3, 3, tsym, toffset, TRUE, BFD_RELOC_XTENSA_SLOT0_OP); ++ /* Modify the jump at the start of this trampoline to point past the newly-added jump. */ ++ fixP = trampP->fixP; ++ if (fixP) ++ fixP->fx_offset += 3; ++ /* Modify the original j to point here. */ ++ origfrag->tc_frag_data.slot_symbols[0] = lsym; ++ origfrag->tc_frag_data.slot_offsets[0] = tramp->fr_fix - 3; ++ /* If trampoline is full, remove it from the list. */ ++ check_and_update_trampolines (); ++ ++ return growth; ++} ++ ++ + static long + relax_frag_immed (segT segP, + fragS *fragP, +@@ -9284,6 +9804,37 @@ relax_frag_immed (segT segP, + if (negatable_branch && istack.ninsn > 1) + update_next_frag_state (fragP); + ++ /* If last insn is a jump, and it cannot reach its target, try to find a trampoline. */ ++ if (istack.ninsn > 2 && ++ istack.insn[istack.ninsn - 1].insn_type == ITYPE_LABEL && ++ istack.insn[istack.ninsn - 2].insn_type == ITYPE_INSN && ++ istack.insn[istack.ninsn - 2].opcode == xtensa_j_opcode) ++ { ++ TInsn *jinsn = &istack.insn[istack.ninsn - 2]; ++ ++ if (!xg_symbolic_immeds_fit (jinsn, segP, fragP, fragP->fr_offset, total_text_diff)) ++ { ++ struct trampoline_frag *tf = get_best_trampoline (jinsn, fragP); ++ ++ if (tf) ++ { ++ this_text_diff += init_trampoline_frag (tf); ++ this_text_diff += add_jump_to_trampoline (tf, fragP); ++ } ++ else ++ { ++ /* If target symbol is undefined, assume it will reach once linked. */ ++ expressionS *exp = &istack.insn[istack.ninsn - 2].tok[0]; ++ ++ if (exp->X_op == O_symbol && S_IS_DEFINED (exp->X_add_symbol)) ++ { ++ as_bad_where (fragP->fr_file, fragP->fr_line, ++ _("jump target out of range; no usable trampoline found")); ++ } ++ } ++ } ++ } ++ + return this_text_diff; + } + +@@ -9404,6 +9955,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec, fragS *fragp) + else + as_bad (_("invalid relaxation fragment result")); + break; ++ ++ case RELAX_TRAMPOLINE: ++ break; + } + + fragp->fr_var = 0; +diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h +index 0bf1240..4672bc6 100644 +--- a/gas/config/tc-xtensa.h ++++ b/gas/config/tc-xtensa.h +@@ -180,6 +180,11 @@ enum xtensa_relax_statesE + prevent the linker from changing the size of any frag between the + section start and the org frag. */ + ++ RELAX_TRAMPOLINE, ++ /* Every few thousand frags, we insert one of these, just in case we may ++ need some space for a trampoline (jump to a jump) because the function ++ has gotten too big. If not needed, it disappears. */ ++ + RELAX_NONE + }; + +diff --git a/gas/frags.c b/gas/frags.c +index 5f68480..e14099d 100644 +--- a/gas/frags.c ++++ b/gas/frags.c +@@ -24,6 +24,20 @@ + + extern fragS zero_address_frag; + extern fragS predefined_address_frag; ++ ++static int totalfrags; ++ ++int ++get_frag_count (void) ++{ ++ return totalfrags; ++} ++ ++void ++clear_frag_count (void) ++{ ++ totalfrags = 0; ++} + + /* Initialization for frag routines. */ + +@@ -70,6 +84,7 @@ frag_alloc (struct obstack *ob) + ptr = (fragS *) obstack_alloc (ob, SIZEOF_STRUCT_FRAG); + obstack_alignment_mask (ob) = oalign; + memset (ptr, 0, SIZEOF_STRUCT_FRAG); ++ totalfrags++; + return ptr; + } + +diff --git a/gas/frags.h b/gas/frags.h +index 319898f..2f9e1b5 100644 +--- a/gas/frags.h ++++ b/gas/frags.h +@@ -155,4 +155,7 @@ char *frag_var (relax_stateT type, + + bfd_boolean frag_offset_fixed_p (const fragS *, const fragS *, offsetT *); + ++int get_frag_count (void); ++void clear_frag_count (void); ++ + #endif /* FRAGS_H */ +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index 2b2c294..3683b78 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -98,6 +98,7 @@ if [istarget xtensa*-*-*] then { + run_dump_test "pcrel" + run_dump_test "weak-call" + run_dump_test "jlong" ++ run_dump_test "trampoline" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/trampoline.d b/gas/testsuite/gas/xtensa/trampoline.d +new file mode 100644 +index 0000000..b4f65dc +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/trampoline.d +@@ -0,0 +1,26 @@ ++#as: ++#objdump: -d ++#name: trampolines relaxation ++ ++.*: +file format .*xtensa.* ++#... ++.*0:.*j.0x1194c ++.*3:.*j.0x1194f ++.*6:.*j.0x11952 ++.*9:.*j.0x1d4e4 ++#... ++.*11949:.*j.0x11955 ++.*1194c:.*j.0x24a0e ++.*1194f:.*j.0x24a0e ++.*11952:.*j.0x24a11 ++#... ++.*1d4e1:.*j.0x1d4e7 ++.*1d4e4:.*j.0x33462 ++#... ++.*24a0e:.*j.0x24a0e ++.*24a11:.*j.0x24a11 ++#... ++.*3345f:.*ret ++.*33462:.*j.0x49407 ++#... ++.*49407:.*j.0x49407 +diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s +new file mode 100644 +index 0000000..259a3bb +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/trampoline.s +@@ -0,0 +1,21 @@ ++ .text ++ j 1f ++ j 1f ++ j 2f ++ j 3f ++ .rep 25000 ++99: ++ and a2, a2, a3 ++ bne a2, a3, 99b ++ .endr ++1: ++ j 1b ++2: ++ j 2b ++ ++ .rep 25000 ++ and a2, a2, a3 ++ _ret ++ .endr ++3: ++ j 3b +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/901-xtensa-gas-first-frag-alignment.patch b/package/binutils/2.23.2/901-xtensa-gas-first-frag-alignment.patch new file mode 100644 index 0000000000..e1c2d85aa8 --- /dev/null +++ b/package/binutils/2.23.2/901-xtensa-gas-first-frag-alignment.patch @@ -0,0 +1,51 @@ +From a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 15 Apr 2014 19:12:46 +0400 +Subject: [PATCH] Fix alignment for the first section frag on xtensa + +Linking object files produced by partial linking with link-time +relaxation enabled sometimes fails with the following error message: + +dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63) + +This happens because no basic block with an XTENSA_PROP_ALIGN flag in the +property table is generated for the first basic block, even if the +.align directive is present. +It was believed that the first frag alignment could be derived from the +section alignment, but this was not implemented for the partial linking +case: after partial linking first frag of a section may become not +first, but no additional alignment frag is inserted before it. +Basic block for such frag may be merged with previous basic block into +extended basic block during relaxation pass losing its alignment +restrictions. + +Fix this by always recording alignment for the first section frag. + +2014-04-22 Max Filippov + +gas/ + * config/tc-xtensa.c (xtensa_handle_align): record alignment for the + first section frag. + +--- +Backported from: a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1 +Changes to Changelog files and tests are dropped. + + gas/config/tc-xtensa.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index ea23c96..58ace38 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5609,7 +5609,6 @@ xtensa_handle_align (fragS *fragP) + && ! fragP->tc_frag_data.is_literal + && (fragP->fr_type == rs_align + || fragP->fr_type == rs_align_code) +- && fragP->fr_address + fragP->fr_fix > 0 + && fragP->fr_offset > 0 + && now_seg != bss_section) + { +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/902-xtensa-gas-ld-diff-relocation-signed.patch b/package/binutils/2.23.2/902-xtensa-gas-ld-diff-relocation-signed.patch new file mode 100644 index 0000000000..ba24f4e4b0 --- /dev/null +++ b/package/binutils/2.23.2/902-xtensa-gas-ld-diff-relocation-signed.patch @@ -0,0 +1,133 @@ +From 6a17eba5358549d0d6d195bb22b34cdbc068def2 Mon Sep 17 00:00:00 2001 +From: Volodymyr Arbatov +Date: Mon, 6 May 2013 09:43:21 -0800 +Subject: [PATCH] Use signed data type for R_XTENSA_DIFF* relocation offsets. + +R_XTENSA_DIFF relocation offsets are in fact signed. Treat them as such. +Add testcase that examines ld behaviour on R_XTENSA_DIFF relocation +changing sign during relaxation. + +2014-05-02 Volodymyr Arbatov + David Weatherford + Max Filippov + +bfd/ + * elf32-xtensa.c (relax_section): treat R_XTENSA_DIFF* relocations as + signed. + +gas/ + * config/tc-xtensa.c (md_apply_fix): mark BFD_RELOC_XTENSA_DIFF* + fixups as signed. +--- +Backported from: 1058c7532d0b012ac329219264ddad59049fb6e6 +Changes to Changelog files and tests are dropped. + + bfd/elf32-xtensa.c | 32 ++++++++++++----------- + gas/config/tc-xtensa.c | 3 +++ + 2 files changed, 20 insertions(+), 15 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index edb04b4..8818d67 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -222,11 +222,11 @@ static reloc_howto_type elf_howto_table[] = + FALSE, 0, 0, FALSE), + + /* Relocations for supporting difference of symbols. */ +- HOWTO (R_XTENSA_DIFF8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_XTENSA_DIFF8, 0, 0, 8, FALSE, 0, complain_overflow_signed, + bfd_elf_xtensa_reloc, "R_XTENSA_DIFF8", FALSE, 0, 0xff, FALSE), +- HOWTO (R_XTENSA_DIFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_XTENSA_DIFF16, 0, 1, 16, FALSE, 0, complain_overflow_signed, + bfd_elf_xtensa_reloc, "R_XTENSA_DIFF16", FALSE, 0, 0xffff, FALSE), +- HOWTO (R_XTENSA_DIFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_XTENSA_DIFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed, + bfd_elf_xtensa_reloc, "R_XTENSA_DIFF32", FALSE, 0, 0xffffffff, FALSE), + + /* General immediate operand relocations. */ +@@ -9013,7 +9013,8 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + || r_type == R_XTENSA_DIFF16 + || r_type == R_XTENSA_DIFF32) + { +- bfd_vma diff_value = 0, new_end_offset, diff_mask = 0; ++ bfd_signed_vma diff_value = 0; ++ bfd_vma new_end_offset, diff_mask = 0; + + if (bfd_get_section_limit (abfd, sec) < old_source_offset) + { +@@ -9027,15 +9028,15 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + { + case R_XTENSA_DIFF8: + diff_value = +- bfd_get_8 (abfd, &contents[old_source_offset]); ++ bfd_get_signed_8 (abfd, &contents[old_source_offset]); + break; + case R_XTENSA_DIFF16: + diff_value = +- bfd_get_16 (abfd, &contents[old_source_offset]); ++ bfd_get_signed_16 (abfd, &contents[old_source_offset]); + break; + case R_XTENSA_DIFF32: + diff_value = +- bfd_get_32 (abfd, &contents[old_source_offset]); ++ bfd_get_signed_32 (abfd, &contents[old_source_offset]); + break; + } + +@@ -9047,24 +9048,25 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + switch (r_type) + { + case R_XTENSA_DIFF8: +- diff_mask = 0xff; +- bfd_put_8 (abfd, diff_value, ++ diff_mask = 0x7f; ++ bfd_put_signed_8 (abfd, diff_value, + &contents[old_source_offset]); + break; + case R_XTENSA_DIFF16: +- diff_mask = 0xffff; +- bfd_put_16 (abfd, diff_value, ++ diff_mask = 0x7fff; ++ bfd_put_signed_16 (abfd, diff_value, + &contents[old_source_offset]); + break; + case R_XTENSA_DIFF32: +- diff_mask = 0xffffffff; +- bfd_put_32 (abfd, diff_value, ++ diff_mask = 0x7fffffff; ++ bfd_put_signed_32 (abfd, diff_value, + &contents[old_source_offset]); + break; + } + +- /* Check for overflow. */ +- if ((diff_value & ~diff_mask) != 0) ++ /* Check for overflow. Sign bits must be all zeroes or all ones */ ++ if ((diff_value & ~diff_mask) != 0 && ++ (diff_value & ~diff_mask) != (-1 & ~diff_mask)) + { + (*link_info->callbacks->reloc_dangerous) + (link_info, _("overflow after relaxation"), +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 58ace38..7547c0a0 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5867,12 +5867,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) + { + case BFD_RELOC_8: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8; ++ fixP->fx_signed = 1; + break; + case BFD_RELOC_16: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16; ++ fixP->fx_signed = 1; + break; + case BFD_RELOC_32: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32; ++ fixP->fx_signed = 1; + break; + default: + break; +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/903-xtensa-fix-ld-segfault-when-linking-linux-modules.patch b/package/binutils/2.23.2/903-xtensa-fix-ld-segfault-when-linking-linux-modules.patch new file mode 100644 index 0000000000..6a0846ef8e --- /dev/null +++ b/package/binutils/2.23.2/903-xtensa-fix-ld-segfault-when-linking-linux-modules.patch @@ -0,0 +1,47 @@ +From e7d17e71cdc10a2e81e454ce3b9637f1b2a587f2 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 10 Jul 2014 01:47:33 +0400 +Subject: [PATCH] Fix xtensa ld segfault when linking linux modules + +is_inconsistent_linkonce_section makes an assumption that section name +that starts with ".gnu.linkonce.prop." has one more dot in its suffix. +However gas generates such section name by insertion of "prop." right +after ".gnu.linkonce." part of the name of the original section. So, for +section named ".gnu.linkonce.this_module" corresponding property section +name does not satisfy the assumption. Such section names are common in +linux modules. This bug was exposed by the patch "a35d5e8 Fix alignment +for the first section frag on xtensa", that makes gas produce property +section for each section that has ".align" directive in it. + +Use suffix that immediately follows ".gnu.linkonce.prop." when there are +no more dots following it. + +2014-07-10 Max Filippov + +ld/ + * emultempl/xtensaelf.em (is_inconsistent_linkonce_section): + correctly handle missing dot in section name after + ".gnu.linkonce.prop.". +--- +Backported from: e7d17e71cdc10a2e81e454ce3b9637f1b2a587f2 +Changes to ld/ChangeLog file are dropped. + + ld/emultempl/xtensaelf.em | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em +index 151eea4..948d18d 100644 +--- a/ld/emultempl/xtensaelf.em ++++ b/ld/emultempl/xtensaelf.em +@@ -1310,7 +1310,7 @@ is_inconsistent_linkonce_section (asection *sec) + for Tensilica's XCC compiler. */ + name = sec_name + linkonce_len; + if (CONST_STRNEQ (name, "prop.")) +- name = strchr (name + 5, '.') + 1; ++ name = strchr (name + 5, '.') ? strchr (name + 5, '.') + 1 : name + 5; + else if (name[1] == '.' + && (name[0] == 'p' || name[0] == 'e' || name[0] == 'h')) + name += 2; +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/904-Fix-call8-call-target-out-of-range-xtensa-ld-relaxation.patch b/package/binutils/2.23.2/904-Fix-call8-call-target-out-of-range-xtensa-ld-relaxation.patch new file mode 100644 index 0000000000..dba7620b7e --- /dev/null +++ b/package/binutils/2.23.2/904-Fix-call8-call-target-out-of-range-xtensa-ld-relaxation.patch @@ -0,0 +1,79 @@ +From 7fc39194f8fb48914c995f8ec3826d50086f1ec0 Mon Sep 17 00:00:00 2001 +From: Sterling Augustine +Date: Tue, 25 Jan 2011 13:59:13 -0800 +Subject: [PATCH] Fix 'call8: call target out of range' xtensa ld relaxation + bug + +During link-time relaxation distance between cross-section call site and +its target may grow, producing 'call target out of range' error for +relaxed calls. Be more conservative when calculating whether or not a +callx can be converted to a straight call. + +2014-09-23 Sterling Augustine + +bfd/ + * elf32-xtensa.c (is_resolvable_asm_expansion): for cross-section + call relaxation use furthermost addresses where call source and + destination can be to check whether it's in the range of a direct + call. + +Signed-off-by: Max Filippov +--- + bfd/elf32-xtensa.c | 41 +++++++++++++++++++++++++++++++++++++---- + 1 file changed, 37 insertions(+), 4 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 09862e3..e32496a 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -7124,10 +7124,43 @@ is_resolvable_asm_expansion (bfd *abfd, + || is_reloc_sym_weak (abfd, irel))) + return FALSE; + +- self_address = (sec->output_section->vma +- + sec->output_offset + irel->r_offset + 3); +- dest_address = (target_sec->output_section->vma +- + target_sec->output_offset + target_offset); ++ if (target_sec->output_section != sec->output_section) ++ { ++ /* If the two sections are sufficiently far away that relaxation ++ might take the call out of range, we can't simplify. For ++ example, a positive displacement call into another memory ++ could get moved to a lower address due to literal removal, ++ but the destination won't move, and so the displacment might ++ get larger. ++ ++ If the displacement is negative, assume the destination could ++ move as far back as the start of the output section. The ++ self_address will be at least as far into the output section ++ as it is prior to relaxation. ++ ++ If the displacement is postive, assume the destination will be in ++ it's pre-relaxed location (because relaxation only makes sections ++ smaller). The self_address could go all the way to the beginning ++ of the output section. */ ++ ++ dest_address = target_sec->output_section->vma; ++ self_address = sec->output_section->vma; ++ ++ if (sec->output_section->vma > target_sec->output_section->vma) ++ self_address += sec->output_offset + irel->r_offset + 3; ++ else ++ dest_address += bfd_get_section_limit (abfd, target_sec->output_section); ++ /* Call targets should be four-byte aligned. */ ++ dest_address = (dest_address + 3) & ~3; ++ } ++ else ++ { ++ ++ self_address = (sec->output_section->vma ++ + sec->output_offset + irel->r_offset + 3); ++ dest_address = (target_sec->output_section->vma ++ + target_sec->output_offset + target_offset); ++ } + + *is_reachable_p = pcrel_reloc_fits (direct_call_opcode, 0, + self_address, dest_address); +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/905-Fix-trampolines-search-code-for-conditional-branches.patch b/package/binutils/2.23.2/905-Fix-trampolines-search-code-for-conditional-branches.patch new file mode 100644 index 0000000000..8aeb06428a --- /dev/null +++ b/package/binutils/2.23.2/905-Fix-trampolines-search-code-for-conditional-branches.patch @@ -0,0 +1,90 @@ +From 415480d6471e67aef97c0241d451ef2423a1da9d Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 25 Nov 2014 21:33:21 +0300 +Subject: [PATCH] Fix trampolines search code for conditional branches + +For conditional branches that need more than one trampoline to reach its +target assembler couldn't always find suitable trampoline because +post-loop condition check was placed inside the loop, resulting in +premature loop termination. Move check outside the loop. + +This fixes the following build errors seen when assembling huge files +produced by gcc: + Error: jump target out of range; no usable trampoline found + Error: operand 1 of 'j' has out of range value '307307' + +2014-11-25 Max Filippov + +gas/ + * config/tc-xtensa.c (search_trampolines): Move post-loop + condition check outside the search loop. + +gas/testsuite/ + * gas/xtensa/trampoline.d: Add expected output for branches. + * gas/xtensa/trampoline.s: Add test case for branches. + +Signed-off-by: Max Filippov +--- +Backported from: d92b6eece424f0ad35d96fdd85bf207295e8c4c3 +Changes to ChangeLogs are dropped. + + gas/config/tc-xtensa.c | 8 ++++---- + gas/testsuite/gas/xtensa/trampoline.d | 9 +++++++++ + gas/testsuite/gas/xtensa/trampoline.s | 7 +++++++ + 3 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index d11b0c7..f23ccf8 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -9514,11 +9514,11 @@ search_trampolines (TInsn *tinsn, fragS *fragP, bfd_boolean unreachable_only) + if (next_addr == 0 || addr - next_addr > J_RANGE) + break; + } +- if (abs (addr - this_addr) < J_RANGE) +- return tf; +- +- return NULL; + } ++ if (abs (addr - this_addr) < J_RANGE) ++ return tf; ++ ++ return NULL; + } + for ( ; tf; tf = tf->next) + { +diff --git a/gas/testsuite/gas/xtensa/trampoline.d b/gas/testsuite/gas/xtensa/trampoline.d +index b4f65dc..5ae32a6 100644 +--- a/gas/testsuite/gas/xtensa/trampoline.d ++++ b/gas/testsuite/gas/xtensa/trampoline.d +@@ -24,3 +24,12 @@ + .*33462:.*j.0x49407 + #... + .*49407:.*j.0x49407 ++.*4940a:.*beqz.n.a2,.0x4940f ++.*4940c:.*j.0x693d1 ++#... ++.*693d1:.*j.0x7ddd4 ++#... ++.*7ddd4:.*j.0x927f5 ++#... ++.*927f5:.*j.0x927f5 ++#... +diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s +index 259a3bb..4465786 100644 +--- a/gas/testsuite/gas/xtensa/trampoline.s ++++ b/gas/testsuite/gas/xtensa/trampoline.s +@@ -19,3 +19,10 @@ + .endr + 3: + j 3b ++ bnez a2, 4f ++ .rep 50000 ++ and a2, a2, a3 ++ _ret ++ .endr ++4: ++ j 4b +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch b/package/binutils/2.23.2/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch new file mode 100644 index 0000000000..9ad6b3be05 --- /dev/null +++ b/package/binutils/2.23.2/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch @@ -0,0 +1,57 @@ +From 8ec76b16f62d1bf386fb2c39af5f66c3afddc5cb Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 14 May 2015 05:22:55 +0300 +Subject: [PATCH] xtensa: fix localized symbol refcounting with --gc-sections + +elf_xtensa_gc_sweep_hook doesn't correctly unreference symbols that were +made local, that results in link failure with the following message: + + BFD (GNU Binutils) 2.24 internal error, aborting at elf32-xtensa.c line + 3372 in elf_xtensa_finish_dynamic_sections + +elf_xtensa_gc_sweep_hook determines symbol reference type (PLT or GOT) by +relocation type. Relocation types are not changed when symbol becomes +local, but its PLT references are added to GOT references and +plt.refcount is set to 0. Such symbol cannot be unreferences in the +elf_xtensa_gc_sweep_hook and its extra references make calculated GOT +relocations section size not match number of GOT relocations. + +Fix it by treating PLT reference as GOT reference when plt.refcount is +not positive. + +2015-05-14 Max Filippov +bfd/ + * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Treat PLT reference + as GOT reference when plt.refcount is not positive. + +Signed-off-by: Max Filippov +--- +Backported from: e6c9a083ec5ae7a45bd71682b26aae1939849388 +Changes to ChangeLog are dropped. + + bfd/elf32-xtensa.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 53af1c6..2523670 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -1360,10 +1360,14 @@ elf_xtensa_gc_sweep_hook (bfd *abfd, + { + if (is_plt) + { ++ /* If the symbol has been localized its plt.refcount got moved ++ to got.refcount. Handle it as GOT. */ + if (h->plt.refcount > 0) + h->plt.refcount--; ++ else ++ is_got = TRUE; + } +- else if (is_got) ++ if (is_got) + { + if (h->got.refcount > 0) + h->got.refcount--; +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/912-xtensa-fix-gas-segfault-with-text-section-literals.patch b/package/binutils/2.23.2/912-xtensa-fix-gas-segfault-with-text-section-literals.patch new file mode 100644 index 0000000000..4a3de2c839 --- /dev/null +++ b/package/binutils/2.23.2/912-xtensa-fix-gas-segfault-with-text-section-literals.patch @@ -0,0 +1,56 @@ +From 2d0522e76e4afeeb2e104e0a4332d94fa0d2fbf6 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sun, 17 May 2015 06:46:15 +0300 +Subject: [PATCH] xtensa: fix gas segfault with --text-section-literals + +When --text-section-literals is used and code in the .init or .fini +emits literal in the absence of .literal_position, xtensa_move_literals +segfaults. + +Check that search_frag is non-NULL in the xtensa_move_literals and +report error otherwise. + +2015-05-26 Max Filippov +gas/ + * config/tc-xtensa.c (xtensa_move_literals): Check that + search_frag is non-NULL. Report error if literal frag is not + found. + +Signed-off-by: Max Filippov +--- +Backported from: 4de0562a4c69fef4952aa7e19d7bda359f02e8b4 +Changes to ChangeLog are dropped. + + gas/config/tc-xtensa.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 31c0b6b..18307c1 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -10808,13 +10808,21 @@ xtensa_move_literals (void) + frchain_to = NULL; + frag_splice = &(frchain_from->frch_root); + +- while (!search_frag->tc_frag_data.literal_frag) ++ while (search_frag && !search_frag->tc_frag_data.literal_frag) + { + gas_assert (search_frag->fr_fix == 0 + || search_frag->fr_type == rs_align); + search_frag = search_frag->fr_next; + } + ++ if (!search_frag) ++ { ++ search_frag = frchain_from->frch_root; ++ as_bad_where (search_frag->fr_file, search_frag->fr_line, ++ _("literal pool location required for text-section-literals; specify with .literal_position")); ++ continue; ++ } ++ + gas_assert (search_frag->tc_frag_data.literal_frag->fr_subtype + == RELAX_LITERAL_POOL_BEGIN); + xtensa_switch_section_emit_state (&state, segment->seg, 0); +-- +1.8.1.4 + diff --git a/package/binutils/2.23.2/914-xtensa-fix-signedness-of-gas-relocations.patch b/package/binutils/2.23.2/914-xtensa-fix-signedness-of-gas-relocations.patch new file mode 100644 index 0000000000..2955e114e2 --- /dev/null +++ b/package/binutils/2.23.2/914-xtensa-fix-signedness-of-gas-relocations.patch @@ -0,0 +1,47 @@ +From 6c7c5c477ef9ccf2d2548cf2ac3cec9bd3c9c5b6 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 2 Feb 2016 17:11:38 +0300 +Subject: [PATCH] xtensa: fix signedness of gas relocations + +Change 1058c7532d0b "Use signed data type for R_XTENSA_DIFF* relocation +offsets." changed signedness of BFD_RELOC_XTENSA_DIFF* relocations +substituted for BFD_RELOC_*. This made it impossible to encode arbitrary +8-, 16- and 32-bit values, which broke e.g. debug info encoding by .loc +directive. Revert this part and add test. + +gas/ +2016-02-03 Max Filippov + * config/tc-xtensa.c (md_apply_fix): Mark BFD_RELOC_XTENSA_DIFF* + substitutions for BFD_RELOC_* as unsigned. + +Signed-off-by: Max Filippov +--- + gas/config/tc-xtensa.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index a119871..36a06cc 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5961,15 +5961,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) + { + case BFD_RELOC_8: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + case BFD_RELOC_16: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + case BFD_RELOC_32: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + default: + break; +-- +2.1.4 + diff --git a/package/binutils/2.23.2/915-xtensa-fix-.init-.fini-literals-moving.patch b/package/binutils/2.23.2/915-xtensa-fix-.init-.fini-literals-moving.patch new file mode 100644 index 0000000000..4bdd8a0277 --- /dev/null +++ b/package/binutils/2.23.2/915-xtensa-fix-.init-.fini-literals-moving.patch @@ -0,0 +1,70 @@ +From 7db2accc3fdea0aaa0c3a76a413d8e8030e022c3 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 16 Feb 2016 02:23:28 +0300 +Subject: [PATCH] xtensa: fix .init/.fini literals moving + +Despite the documentation and the comment in xtensa_move_literals, in +the presence of --text-section-literals and --auto-litpools literals are +moved from the separate literal sections into .init and .fini, because +the check in the xtensa_move_literals is incorrect. + +This moving was broken with introduction of auto litpools: some literals +now may be lost. This happens because literal frags emitted from .init +and .fini are not closed when new .literal_position marks new literal +pool. Then frag_align(2, 0, 0) changes type of the last literal frag to +rs_align. rs_align frags are skipped in the xtensa_move_literals. As a +result fixups against such literals are not moved out of .init.literal/ +.fini.literal sections producing the following assembler error: + + test.S: Warning: fixes not all moved from .init.literal + test.S: Internal error! + +Fix check for .init.literal/.fini.literal in the xtensa_move_literals +and don't let it move literals from there in the presence of +--text-section-literals or --auto-litpools. + +2016-02-17 Max Filippov +gas/ + * config/tc-xtensa.c (xtensa_move_literals): Fix check for + .init.literal/.fini.literal section name. + +Signed-off-by: Max Filippov +--- +Backported from: 4111950f363221c4641dc2f33bea61cc94f34906 + + gas/config/tc-xtensa.c | 12 ++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 36a06cc..5773634 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -10625,5 +10625,9 @@ xtensa_move_literals (void) + fixS *fix, *next_fix, **fix_splice; + sym_list *lit; ++ const char *init_name = INIT_SECTION_NAME; ++ const char *fini_name = FINI_SECTION_NAME; ++ int init_name_len = strlen(init_name); ++ int fini_name_len = strlen(fini_name); + + mark_literal_frags (literal_head->next); + +@@ -10632,9 +10636,13 @@ xtensa_move_literals (void) + + for (segment = literal_head->next; segment; segment = segment->next) + { ++ const char *seg_name = segment_name (segment->seg); ++ + /* Keep the literals for .init and .fini in separate sections. */ +- if (!strcmp (segment_name (segment->seg), INIT_SECTION_NAME) +- || !strcmp (segment_name (segment->seg), FINI_SECTION_NAME)) ++ if ((!memcmp (seg_name, init_name, init_name_len) && ++ !strcmp (seg_name + init_name_len, ".literal")) || ++ (!memcmp (seg_name, fini_name, fini_name_len) && ++ !strcmp (seg_name + fini_name_len, ".literal"))) + continue; + + frchain_from = seg_info (segment->seg)->frchainP; +-- +2.1.4 + diff --git a/package/binutils/2.24/001-fix-enable-install-libiberty-flag.patch b/package/binutils/2.24/001-fix-enable-install-libiberty-flag.patch new file mode 100644 index 0000000000..e40840194d --- /dev/null +++ b/package/binutils/2.24/001-fix-enable-install-libiberty-flag.patch @@ -0,0 +1,46 @@ +From 369be6981b26787b2685e3b8c6da779dae8ce35f Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Mon, 6 Jan 2014 18:15:31 +0000 +Subject: [PATCH] libiberty: fix --enable-install-libiberty flag [PR 56780] + +Commit 199570 fixed the --disable-install-libiberty behavior, but it also +added a bug where the enable path never works because the initial clear +of target_header_dir wasn't deleted. So we end up initializing properly +at the top only to reset it at the end all the time. + +[Arnout: adapt to match 2.24 tarball] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206367 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libiberty/configure | 1 - + libiberty/configure.ac | 1 - + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libiberty/configure b/libiberty/configure +index 8ea54da..7bde9b3 100755 +--- a/libiberty/configure ++++ b/libiberty/configure +@@ -5507,7 +5507,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +diff --git a/libiberty/configure.ac b/libiberty/configure.ac +index 4ad88a9..d6180bc 100644 +--- a/libiberty/configure.ac ++++ b/libiberty/configure.ac +@@ -405,7 +405,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +-- +1.7.1 + diff --git a/package/binutils/2.24/002-dont-segv-on-initial-instructions-overflow.patch b/package/binutils/2.24/002-dont-segv-on-initial-instructions-overflow.patch new file mode 100644 index 0000000000..7881646981 --- /dev/null +++ b/package/binutils/2.24/002-dont-segv-on-initial-instructions-overflow.patch @@ -0,0 +1,66 @@ +From: Alan Modra +Date: Fri, 20 Dec 2013 13:27:52 +0000 (+1030) +Subject: Don't segv on cie.initial_instructions[] overflow. +X-Git-Tag: gdb-7.7-release~148 +X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=99d190fac4d2aab238cfc798dc5c28ab41456882 + +Don't segv on cie.initial_instructions[] overflow. + +Don't attempt to merge CIEs with a larger number of insns than will +fit in the buffer. + + * elf-eh-frame.c (cie_eq): Return false when initial_insn_length + is too large. + (cie_compute_hash): Don't exceed bounds of initial_instructions. + (_bfd_elf_parse_eh_frame): Always set initial_insn_length, and + save as much of insns to initial_instructions[] as will fit. +--- + +diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c +index 832a991..4b6e8ea 100644 +--- a/bfd/elf-eh-frame.c ++++ b/bfd/elf-eh-frame.c +@@ -235,6 +235,7 @@ cie_eq (const void *e1, const void *e2) + && c1->lsda_encoding == c2->lsda_encoding + && c1->fde_encoding == c2->fde_encoding + && c1->initial_insn_length == c2->initial_insn_length ++ && c1->initial_insn_length <= sizeof (c1->initial_instructions) + && memcmp (c1->initial_instructions, + c2->initial_instructions, + c1->initial_insn_length) == 0) +@@ -254,6 +255,7 @@ static hashval_t + cie_compute_hash (struct cie *c) + { + hashval_t h = 0; ++ size_t len; + h = iterative_hash_object (c->length, h); + h = iterative_hash_object (c->version, h); + h = iterative_hash (c->augmentation, strlen (c->augmentation) + 1, h); +@@ -267,7 +269,10 @@ cie_compute_hash (struct cie *c) + h = iterative_hash_object (c->lsda_encoding, h); + h = iterative_hash_object (c->fde_encoding, h); + h = iterative_hash_object (c->initial_insn_length, h); +- h = iterative_hash (c->initial_instructions, c->initial_insn_length, h); ++ len = c->initial_insn_length; ++ if (len > sizeof (c->initial_instructions)) ++ len = sizeof (c->initial_instructions); ++ h = iterative_hash (c->initial_instructions, len, h); + c->hash = h; + return h; + } +@@ -762,11 +767,10 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, + cie->fde_encoding = DW_EH_PE_absptr; + + initial_insn_length = end - buf; +- if (initial_insn_length <= sizeof (cie->initial_instructions)) +- { +- cie->initial_insn_length = initial_insn_length; +- memcpy (cie->initial_instructions, buf, initial_insn_length); +- } ++ cie->initial_insn_length = initial_insn_length; ++ memcpy (cie->initial_instructions, buf, ++ initial_insn_length <= sizeof (cie->initial_instructions) ++ ? initial_insn_length : sizeof (cie->initial_instructions)); + insns = buf; + buf += initial_insn_length; + ENSURE_NO_RELOCS (buf); diff --git a/package/binutils/2.24/120-sh-conf.patch b/package/binutils/2.24/120-sh-conf.patch new file mode 100644 index 0000000000..ea3d1b6068 --- /dev/null +++ b/package/binutils/2.24/120-sh-conf.patch @@ -0,0 +1,29 @@ +r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines + +Likewise, binutils has no idea about any of these new targets either, so we +fix that up too.. now we're able to actually build a real toolchain for +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more +inept targets than that one, really. Go look, I promise). + +--- a/configure ++++ b/configure +@@ -1495,7 +1495,7 @@ + mips*-*-*) + noconfigdirs="$noconfigdirs gprof" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${target}" in + sh*-*-elf) + ;; +--- a/configure.ac ++++ b/configure.ac +@@ -712,7 +712,7 @@ + mips*-*-*) + noconfigdirs="$noconfigdirs gprof" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${target}" in + sh*-*-elf) + ;; diff --git a/package/binutils/2.24/300-001_ld_makefile_patch.patch b/package/binutils/2.24/300-001_ld_makefile_patch.patch new file mode 100644 index 0000000000..5cb0f614d8 --- /dev/null +++ b/package/binutils/2.24/300-001_ld_makefile_patch.patch @@ -0,0 +1,24 @@ +diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am +--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200 ++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200 +@@ -18,7 +18,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in +--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200 ++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200 +@@ -287,7 +287,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/package/binutils/2.24/300-012_check_ldrunpath_length.patch b/package/binutils/2.24/300-012_check_ldrunpath_length.patch new file mode 100644 index 0000000000..df783109bb --- /dev/null +++ b/package/binutils/2.24/300-012_check_ldrunpath_length.patch @@ -0,0 +1,21 @@ +diff -Nura binutils-2.21.orig/ld/emultempl/elf32.em binutils-2.21/ld/emultempl/elf32.em +--- binutils-2.21.orig/ld/emultempl/elf32.em 2010-10-29 09:10:36.000000000 -0300 ++++ binutils-2.21/ld/emultempl/elf32.em 2010-12-10 09:26:56.746102724 -0300 +@@ -1270,6 +1270,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1497,6 +1499,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + + for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) diff --git a/package/binutils/2.24/500-sysroot.patch b/package/binutils/2.24/500-sysroot.patch new file mode 100644 index 0000000000..e49c795332 --- /dev/null +++ b/package/binutils/2.24/500-sysroot.patch @@ -0,0 +1,37 @@ +Signed-off-by: Sven Rebhan + +Always try to prepend the sysroot prefix to absolute filenames first. + +http://bugs.gentoo.org/275666 +http://sourceware.org/bugzilla/show_bug.cgi?id=10340 + +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -308,18 +308,25 @@ + directory first. */ + if (! entry->flags.maybe_archive) + { +- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)) ++ /* For absolute pathnames, try to always open the file in the ++ sysroot first. If this fails, try to open the file at the ++ given location. */ ++ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename); ++ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename) ++ && ld_sysroot) + { + char *name = concat (ld_sysroot, entry->filename, + (const char *) NULL); + if (ldfile_try_open_bfd (name, entry)) + { + entry->filename = name; ++ entry->flags.sysrooted = TRUE; + return TRUE; + } + free (name); + } +- else if (ldfile_try_open_bfd (entry->filename, entry)) ++ ++ if (ldfile_try_open_bfd (entry->filename, entry)) + return TRUE; + + if (IS_ABSOLUTE_PATH (entry->filename)) diff --git a/package/binutils/2.24/600-poison-system-directories.patch b/package/binutils/2.24/600-poison-system-directories.patch new file mode 100644 index 0000000000..6a3bf6be87 --- /dev/null +++ b/package/binutils/2.24/600-poison-system-directories.patch @@ -0,0 +1,279 @@ +Patch adapted to binutils 2.23.2 and extended to use +BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni. + +Signed-off-by: Thomas Petazzoni + +Upstream-Status: Inappropriate [distribution: codesourcery] + +Patch originally created by Mark Hatle, forward-ported to +binutils 2.21 by Scott Garman. + +purpose: warn for uses of system directories when cross linking + +Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 + +2008-07-02 Joseph Myers + + ld/ + * ld.h (args_type): Add error_poison_system_directories. + * ld.texinfo (--error-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.error_poison_system_directories. + * ldmain.c (main): Initialize + command_line.error_poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --error-poison-system-directories. + (parse_args): Handle new option. + +2007-06-13 Joseph Myers + + ld/ + * config.in: Regenerate. + * ld.h (args_type): Add poison_system_directories. + * ld.texinfo (--no-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.poison_system_directories. + * ldmain.c (main): Initialize + command_line.poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_NO_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --no-poison-system-directories. + (parse_args): Handle new option. + +2007-04-20 Joseph Myers + + Merge from Sourcery G++ binutils 2.17: + + 2007-03-20 Joseph Myers + Based on patch by Mark Hatle . + ld/ + * configure.in (--enable-poison-system-directories): New option. + * configure, config.in: Regenerate. + * ldfile.c (ldfile_add_library_path): If + ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib, + /usr/lib, /usr/local/lib or /usr/X11R6/lib. + +Signed-off-by: Mark Hatle +Signed-off-by: Scott Garman + +Index: b/ld/config.in +=================================================================== +--- a/ld/config.in ++++ b/ld/config.in +@@ -11,6 +11,9 @@ + language is requested. */ + #undef ENABLE_NLS + ++/* Define to warn for use of native system library directories */ ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES ++ + /* Additional extension a shared object might have. */ + #undef EXTRA_SHLIB_EXTENSION + +Index: b/ld/configure +=================================================================== +--- a/ld/configure ++++ b/ld/configure +@@ -774,6 +774,7 @@ + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_werror +@@ -1429,6 +1430,8 @@ + (and sometimes confusing) to the casual installer + --enable-targets alternative target configurations + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) ++ --enable-poison-system-directories ++ warn for use of native system library directories + --enable-gold[=ARG] build gold [ARG={default,yes,no}] + --enable-got= GOT handling scheme (target, single, negative, + multigot) +@@ -4339,7 +4342,18 @@ + fi + + ++# Check whether --enable-poison-system-directories was given. ++if test "${enable_poison_system_directories+set}" = set; then : ++ enableval=$enable_poison_system_directories; ++else ++ enable_poison_system_directories=no ++fi ++ ++if test "x${enable_poison_system_directories}" = "xyes"; then + ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h ++ ++fi + + # Check whether --enable-got was given. + if test "${enable_got+set}" = set; then : +Index: b/ld/configure.in +=================================================================== +--- a/ld/configure.in ++++ b/ld/configure.in +@@ -87,6 +87,16 @@ + AC_SUBST(TARGET_SYSTEM_ROOT) + AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) + ++AC_ARG_ENABLE([poison-system-directories], ++ AS_HELP_STRING([--enable-poison-system-directories], ++ [warn for use of native system library directories]),, ++ [enable_poison_system_directories=no]) ++if test "x${enable_poison_system_directories}" = "xyes"; then ++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], ++ [1], ++ [Define to warn for use of native system library directories]) ++fi ++ + dnl Use --enable-gold to decide if this linker should be the default. + dnl "install_as_default" is set to false if gold is the default linker. + dnl "installed_linker" is the installed BFD linker name. +Index: b/ld/ldfile.c +=================================================================== +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -116,6 +116,23 @@ + new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); + else + new_dirs->name = xstrdup (name); ++ ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES ++ if (command_line.poison_system_directories ++ && ((!strncmp (name, "/lib", 4)) ++ || (!strncmp (name, "/usr/lib", 8)) ++ || (!strncmp (name, "/usr/local/lib", 14)) ++ || (!strncmp (name, "/usr/X11R6/lib", 14)))) ++ { ++ if (command_line.error_poison_system_directories) ++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ else ++ einfo (_("%P: warning: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ } ++#endif ++ + } + + /* Try to open a BFD for a lang_input_statement. */ +Index: b/ld/ld.h +=================================================================== +--- a/ld/ld.h ++++ b/ld/ld.h +@@ -180,6 +180,14 @@ + /* If TRUE we'll just print the default output on stdout. */ + bfd_boolean print_output_format; + ++ /* If TRUE (the default) warn for uses of system directories when ++ cross linking. */ ++ bfd_boolean poison_system_directories; ++ ++ /* If TRUE (default FALSE) give an error for uses of system ++ directories when cross linking instead of a warning. */ ++ bfd_boolean error_poison_system_directories; ++ + /* Big or little endian as set on command line. */ + enum endian_enum endian; + +Index: b/ld/ldmain.c +=================================================================== +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -266,6 +266,8 @@ + command_line.warn_mismatch = TRUE; + command_line.warn_search_mismatch = TRUE; + command_line.check_section_addresses = -1; ++ command_line.poison_system_directories = TRUE; ++ command_line.error_poison_system_directories = FALSE; + + /* We initialize DEMANGLING based on the environment variable + COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the +Index: b/ld/ld.texinfo +=================================================================== +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -2175,6 +2175,18 @@ + + Passing @code{none} for @var{style} disables the setting from any + @code{--build-id} options earlier on the command line. ++ ++@kindex --no-poison-system-directories ++@item --no-poison-system-directories ++Do not warn for @option{-L} options using system directories such as ++@file{/usr/lib} when cross linking. This option is intended for use ++in chroot environments when such directories contain the correct ++libraries for the target system rather than the host. ++ ++@kindex --error-poison-system-directories ++@item --error-poison-system-directories ++Give an error instead of a warning for @option{-L} options using ++system directories when cross linking. + @end table + + @c man end +Index: b/ld/lexsup.c +=================================================================== +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -507,6 +507,14 @@ + OPTION_IGNORE_UNRESOLVED_SYMBOL}, + '\0', N_("SYMBOL"), + N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES }, ++ { {"no-poison-system-directories", no_argument, NULL, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Do not warn for -L options using system directories"), ++ TWO_DASHES }, ++ { {"error-poison-system-directories", no_argument, NULL, ++ + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Give an error for -L options using system directories"), ++ TWO_DASHES }, + }; + + #define OPTION_COUNT ARRAY_SIZE (ld_options) +@@ -519,6 +527,7 @@ + int ingroup = 0; + char *default_dirlist = NULL; + char *shortopts; ++ char *BR_paranoid_env; + struct option *longopts; + struct option *really_longopts; + int last_optind; +@@ -1442,9 +1451,21 @@ + einfo (_("%P%X: --hash-size needs a numeric argument\n")); + } + break; ++ ++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES: ++ command_line.poison_system_directories = FALSE; ++ break; ++ ++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: ++ command_line.error_poison_system_directories = TRUE; ++ break; + } + } + ++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH"); ++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0) ++ command_line.error_poison_system_directories = TRUE; ++ + while (ingroup) + { + lang_leave_group (); +Index: b/ld/ldlex.h +=================================================================== +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -138,6 +138,8 @@ + OPTION_DEFAULT_SCRIPT, + OPTION_PRINT_OUTPUT_FORMAT, + OPTION_IGNORE_UNRESOLVED_SYMBOL, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, + }; + + /* The initial parser states. */ diff --git a/package/binutils/2.24/900-xtensa-trampolines.patch b/package/binutils/2.24/900-xtensa-trampolines.patch new file mode 100644 index 0000000000..b5b934fcab --- /dev/null +++ b/package/binutils/2.24/900-xtensa-trampolines.patch @@ -0,0 +1,846 @@ +From a82c7d9030b67a6a76a5403d0e1641f9e42141ac Mon Sep 17 00:00:00 2001 +From: David Weatherford +Date: Fri, 21 Mar 2014 11:53:42 +0000 +Subject: [PATCH] Add support to the Xtensa target for creating trampolines for + out-of-range branches. + + * tc-xtensa.c (xtensa_check_frag_count, xtensa_create_trampoline_frag) + (xtensa_maybe_create_trampoline_frag, init_trampoline_frag) + (find_trampoline_seg, search_trampolines, get_best_trampoline) + (check_and_update_trampolines, add_jump_to_trampoline) + (dump_trampolines): New function. + (md_parse_option): Add cases for --[no-]trampolines options. + (md_assemble, finish_vinsn, xtensa_end): Add call to + xtensa_check_frag_count. + (xg_assemble_vliw_tokens): Add call to + xtensa_maybe_create_trampoline_frag. + (xtensa_relax_frag): Relax fragments with RELAX_TRAMPOLINE state. + (relax_frag_immed): Relax jump instructions that cannot reach its + target. + * tc-xtensa.h (xtensa_relax_statesE::RELAX_TRAMPOLINE): New relax + state. + + * as.texinfo: Document --[no-]trampolines command-line options. + * c-xtensa.texi: Document trampolines relaxation and command line + options. + + * frags.c (get_frag_count, clear_frag_count): New function. + (frag_alloc): Increment totalfrags counter. + * frags.h (get_frag_count, clear_frag_count): New function. + + * all.exp: Add test for trampoline relaxation. + * trampoline.d: Trampoline relaxation expected dump. + * trampoline.s: Trampoline relaxation test source. +--- +Backported from: a82c7d9030b67a6a76a5403d0e1641f9e42141ac +Changes to Changelog files are dropped. + + gas/config/tc-xtensa.c | 558 +++++++++++++++++++++++++++++++++- + gas/config/tc-xtensa.h | 5 + + gas/frags.c | 15 + + gas/frags.h | 3 + + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/trampoline.d | 26 ++ + gas/testsuite/gas/xtensa/trampoline.s | 21 ++ + 11 files changed, 753 insertions(+), 2 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/trampoline.d + create mode 100644 gas/testsuite/gas/xtensa/trampoline.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index fe8ec0f..ea23c96 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -468,6 +468,12 @@ static void xtensa_set_frag_assembly_state (fragS *); + static void finish_vinsn (vliw_insn *); + static bfd_boolean emit_single_op (TInsn *); + static int total_frag_text_expansion (fragS *); ++static bfd_boolean use_trampolines = TRUE; ++static void xtensa_check_frag_count (void); ++static void xtensa_create_trampoline_frag (bfd_boolean); ++static void xtensa_maybe_create_trampoline_frag (void); ++struct trampoline_frag; ++static int init_trampoline_frag (struct trampoline_frag *); + + /* Alignment Functions. */ + +@@ -520,6 +526,7 @@ static void tinsn_from_chars (TInsn *, char *, int); + static void tinsn_immed_from_frag (TInsn *, fragS *, int); + static int get_num_stack_text_bytes (IStack *); + static int get_num_stack_literal_bytes (IStack *); ++static bfd_boolean tinsn_to_slotbuf (xtensa_format, int, TInsn *, xtensa_insnbuf); + + /* vliw_insn functions. */ + +@@ -687,7 +694,10 @@ enum + option_prefer_l32r, + option_prefer_const16, + +- option_target_hardware ++ option_target_hardware, ++ ++ option_trampolines, ++ option_no_trampolines, + }; + + const char *md_shortopts = ""; +@@ -760,6 +770,9 @@ struct option md_longopts[] = + + { "target-hardware", required_argument, NULL, option_target_hardware }, + ++ { "trampolines", no_argument, NULL, option_trampolines }, ++ { "no-trampolines", no_argument, NULL, option_no_trampolines }, ++ + { NULL, no_argument, NULL, 0 } + }; + +@@ -940,6 +953,14 @@ md_parse_option (int c, char *arg) + directive_state[directive_transform] = FALSE; + return 1; + ++ case option_trampolines: ++ use_trampolines = TRUE; ++ return 1; ++ ++ case option_no_trampolines: ++ use_trampolines = FALSE; ++ return 1; ++ + default: + return 0; + } +@@ -963,7 +984,9 @@ Xtensa options:\n\ + flix bundles\n\ + --no-allow-flix neither allow hand-written nor generate\n\ + flix bundles\n\ +- --rename-section old=new Rename section 'old' to 'new'\n", stream); ++ --rename-section old=new Rename section 'old' to 'new'\n\ ++ --[no-]trampolines [Do not] generate trampolines (jumps to jumps)\n\ ++ when jumps do not reach their targets\n", stream); + } + + +@@ -5568,6 +5591,8 @@ md_assemble (char *str) + + /* We've just emitted a new instruction so clear the list of labels. */ + xtensa_clear_insn_labels (); ++ ++ xtensa_check_frag_count (); + } + + +@@ -6372,6 +6397,8 @@ finish_vinsn (vliw_insn *vinsn) + xg_assemble_vliw_tokens (vinsn); + + xg_clear_vinsn (vinsn); ++ ++ xtensa_check_frag_count (); + } + + +@@ -7140,6 +7167,7 @@ xg_assemble_vliw_tokens (vliw_insn *vinsn) + RELAX_UNREACHABLE, + frag_now->fr_symbol, frag_now->fr_offset, NULL); + xtensa_set_frag_assembly_state (frag_now); ++ xtensa_maybe_create_trampoline_frag (); + } + else if (is_branch && do_align_targets ()) + { +@@ -7222,9 +7250,164 @@ xtensa_end (void) + xtensa_sanity_check (); + + xtensa_add_config_info (); ++ ++ xtensa_check_frag_count (); ++} ++ ++ ++struct trampoline_frag ++{ ++ struct trampoline_frag *next; ++ bfd_boolean needs_jump_around; ++ fragS *fragP; ++ fixS *fixP; ++}; ++ ++struct trampoline_seg ++{ ++ struct trampoline_seg *next; ++ asection *seg; ++ struct trampoline_frag trampoline_list; ++}; ++ ++static struct trampoline_seg trampoline_seg_list; ++#define J_RANGE (128 * 1024) ++ ++static int unreachable_count = 0; ++ ++ ++static void ++xtensa_maybe_create_trampoline_frag (void) ++{ ++ if (!use_trampolines) ++ return; ++ ++ /* We create an area for possible trampolines every 10 unreachable frags. ++ These are preferred over the ones not preceded by an unreachable frag, ++ because we don't have to jump around them. This function is called after ++ each RELAX_UNREACHABLE frag is created. */ ++ ++ if (++unreachable_count > 10) ++ { ++ xtensa_create_trampoline_frag (FALSE); ++ clear_frag_count (); ++ unreachable_count = 0; ++ } ++} ++ ++static void ++xtensa_check_frag_count (void) ++{ ++ if (!use_trampolines || frag_now->tc_frag_data.is_no_transform) ++ return; ++ ++ /* We create an area for possible trampolines every 8000 frags or so. This ++ is an estimate based on the max range of a "j" insn (+/-128K) divided ++ by a typical frag byte count (16), minus a few for safety. This function ++ is called after each source line is processed. */ ++ ++ if (get_frag_count () > 8000) ++ { ++ xtensa_create_trampoline_frag (TRUE); ++ clear_frag_count (); ++ unreachable_count = 0; ++ } ++} ++ ++static xtensa_insnbuf trampoline_buf = NULL; ++static xtensa_insnbuf trampoline_slotbuf = NULL; ++ ++#define TRAMPOLINE_FRAG_SIZE 3000 ++ ++static void ++xtensa_create_trampoline_frag (bfd_boolean needs_jump_around) ++{ ++ /* Emit a frag where we can place intermediate jump instructions, ++ in case we need to jump farther than 128K bytes. ++ Each jump instruction takes three bytes. ++ We allocate enough for 1000 trampolines in each frag. ++ If that's not enough, oh well. */ ++ ++ struct trampoline_seg *ts = trampoline_seg_list.next; ++ struct trampoline_frag *tf; ++ char *varP; ++ fragS *fragP; ++ int size = TRAMPOLINE_FRAG_SIZE; ++ ++ for ( ; ts; ts = ts->next) ++ { ++ if (ts->seg == now_seg) ++ break; ++ } ++ ++ if (ts == NULL) ++ { ++ ts = (struct trampoline_seg *)xcalloc(sizeof (struct trampoline_seg), 1); ++ ts->next = trampoline_seg_list.next; ++ trampoline_seg_list.next = ts; ++ ts->seg = now_seg; ++ } ++ ++ frag_wane (frag_now); ++ frag_new (0); ++ xtensa_set_frag_assembly_state (frag_now); ++ varP = frag_var (rs_machine_dependent, size, size, RELAX_TRAMPOLINE, NULL, 0, NULL); ++ fragP = (fragS *)(varP - SIZEOF_STRUCT_FRAG); ++ if (trampoline_buf == NULL) ++ { ++ trampoline_buf = xtensa_insnbuf_alloc (xtensa_default_isa); ++ trampoline_slotbuf = xtensa_insnbuf_alloc (xtensa_default_isa); ++ } ++ tf = (struct trampoline_frag *)xmalloc(sizeof (struct trampoline_frag)); ++ tf->next = ts->trampoline_list.next; ++ ts->trampoline_list.next = tf; ++ tf->needs_jump_around = needs_jump_around; ++ tf->fragP = fragP; ++ tf->fixP = NULL; ++} ++ ++ ++static struct trampoline_seg * ++find_trampoline_seg (asection *seg) ++{ ++ struct trampoline_seg *ts = trampoline_seg_list.next; ++ ++ for ( ; ts; ts = ts->next) ++ { ++ if (ts->seg == seg) ++ return ts; ++ } ++ ++ return NULL; + } + + ++void dump_trampolines (void); ++ ++void ++dump_trampolines (void) ++{ ++ struct trampoline_seg *ts = trampoline_seg_list.next; ++ ++ for ( ; ts; ts = ts->next) ++ { ++ asection *seg = ts->seg; ++ ++ if (seg == NULL) ++ continue; ++ fprintf(stderr, "SECTION %s\n", seg->name); ++ struct trampoline_frag *tf = ts->trampoline_list.next; ++ for ( ; tf; tf = tf->next) ++ { ++ if (tf->fragP == NULL) ++ continue; ++ fprintf(stderr, " 0x%08x: fix=%d, jump_around=%s\n", ++ (int)tf->fragP->fr_address, (int)tf->fragP->fr_fix, ++ tf->needs_jump_around ? "T" : "F"); ++ } ++ } ++} ++ + static void + xtensa_cleanup_align_frags (void) + { +@@ -8708,6 +8891,149 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + new_stretch += relax_frag_for_align (fragP, stretch); + break; + ++ case RELAX_TRAMPOLINE: ++ if (fragP->tc_frag_data.relax_seen) ++ { ++ segment_info_type *seginfo = seg_info (now_seg); ++ fragS *fP; /* The out-of-range jump. */ ++ fixS *fixP; ++ ++ /* Scan for jumps that will not reach. */ ++ for (fixP = seginfo->fix_root; fixP ; fixP = fixP->fx_next) ++ { ++ symbolS *s = fixP->fx_addsy; ++ xtensa_opcode opcode; ++ int target; ++ int addr; ++ int delta; ++ ++ if (fixP->fx_r_type < BFD_RELOC_XTENSA_SLOT0_OP || ++ fixP->fx_r_type > BFD_RELOC_XTENSA_SLOT14_OP) ++ continue; ++ xtensa_insnbuf_from_chars (isa, trampoline_buf, ++ (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where, ++ 0); ++ fmt = xtensa_format_decode (isa, trampoline_buf); ++ gas_assert (fmt != XTENSA_UNDEFINED); ++ slot = fixP->tc_fix_data.slot; ++ xtensa_format_get_slot (isa, fmt, slot, trampoline_buf, trampoline_slotbuf); ++ opcode = xtensa_opcode_decode (isa, fmt, slot, trampoline_slotbuf); ++ if (opcode != xtensa_j_opcode) ++ continue; ++ target = S_GET_VALUE (s); ++ addr = fixP->fx_frag->fr_address; ++ delta = target - addr + stretch; ++ if (delta > J_RANGE || delta < -1 * J_RANGE) ++ { /* Found an out-of-range jump; scan the list of trampolines for the best match. */ ++ struct trampoline_seg *ts = find_trampoline_seg (now_seg); ++ struct trampoline_frag *tf = ts->trampoline_list.next; ++ struct trampoline_frag *prev = &ts->trampoline_list; ++ int lower = (target < addr) ? target : addr; ++ int upper = (target > addr) ? target : addr; ++ int midpoint = lower + (upper - lower) / 2; ++ ++ if ((upper - lower) > 2 * J_RANGE) ++ { ++ /* One trampoline won't suffice; we need multiple jumps. ++ Jump to the trampoline that's farthest, but still in ++ range relative to the original "j" instruction. */ ++ for ( ; tf; prev = tf, tf = tf->next ) ++ { ++ int this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ int next_addr = (tf->next) ? tf->next->fragP->fr_address + tf->next->fragP->fr_fix : 0 ; ++ ++ if (addr == lower) ++ { ++ /* Forward jump. */ ++ if (this_addr - addr < J_RANGE) ++ break; ++ } ++ else ++ { ++ /* Backward jump. */ ++ if (next_addr == 0 || addr - next_addr > J_RANGE) ++ break; ++ } ++ } ++ } ++ else ++ { ++ struct trampoline_frag *best_tf = NULL; ++ int best_delta = 0; ++ ++ for ( ; tf; prev = tf, tf = tf->next ) ++ { ++ int this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ int this_delta = abs (this_addr - midpoint); ++ ++ if (!best_tf || this_delta < best_delta) ++ { ++ best_tf = tf; ++ best_delta = this_delta; ++ } ++ } ++ tf = best_tf; ++ } ++ if (tf->fragP == fragP) ++ { ++ int trampaddr = fragP->fr_address + fragP->fr_fix; ++ ++ if (abs (addr - trampaddr) < J_RANGE) ++ { /* The trampoline is in range of original; fix it! */ ++ fixS *newfixP; ++ int offset; ++ TInsn insn; ++ symbolS *lsym; ++ ++ new_stretch += init_trampoline_frag (tf); ++ offset = fragP->fr_fix; /* Where to assemble the j insn. */ ++ lsym = fragP->fr_symbol; ++ fP = fixP->fx_frag; ++ /* Assemble a jump to the target label here. */ ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], lsym, offset); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, trampoline_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, trampoline_buf, trampoline_slotbuf); ++ xtensa_insnbuf_to_chars (isa, trampoline_buf, (unsigned char *)fragP->fr_literal + offset, 3); ++ fragP->fr_fix += 3; ++ fragP->fr_var -= 3; ++ /* Add a fix-up for the original j insn. */ ++ newfixP = fix_new (fP, fixP->fx_where, fixP->fx_size, lsym, fragP->fr_fix - 3, TRUE, fixP->fx_r_type); ++ newfixP->fx_no_overflow = 1; ++ newfixP->tc_fix_data.X_add_symbol = lsym; ++ newfixP->tc_fix_data.X_add_number = offset; ++ newfixP->tc_fix_data.slot = slot; ++ /* Move the fix-up from the original j insn to this one. */ ++ fixP->fx_frag = fragP; ++ fixP->fx_where = fragP->fr_fix - 3; ++ fixP->tc_fix_data.slot = 0; ++ /* Adjust the jump around this trampoline (if present). */ ++ if (tf->fixP != NULL) ++ { ++ tf->fixP->fx_offset += 3; ++ } ++ new_stretch += 3; ++ fragP->tc_frag_data.relax_seen = FALSE; /* Need another pass. */ ++ /* Do we have room for more? */ ++ if (fragP->fr_var < 3) ++ { /* No, convert to fill. */ ++ frag_wane (fragP); ++ fragP->fr_subtype = 0; ++ /* Remove from the trampoline_list. */ ++ prev->next = tf->next; ++ break; ++ } ++ } ++ } ++ } ++ } ++ } ++ break; ++ + default: + as_bad (_("bad relaxation state")); + } +@@ -9146,6 +9472,200 @@ bytes_to_stretch (fragS *this_frag, + } + + ++static struct trampoline_frag * ++search_trampolines (TInsn *tinsn, fragS *fragP, bfd_boolean unreachable_only) ++{ ++ struct trampoline_seg *ts = find_trampoline_seg (now_seg); ++ struct trampoline_frag *tf = (ts) ? ts->trampoline_list.next : NULL; ++ struct trampoline_frag *best_tf = NULL; ++ int best_delta = 0; ++ int best_addr = 0; ++ symbolS *sym = tinsn->tok[0].X_add_symbol; ++ offsetT target = S_GET_VALUE (sym) + tinsn->tok[0].X_add_number; ++ offsetT addr = fragP->fr_address; ++ offsetT lower = (addr < target) ? addr : target; ++ offsetT upper = (addr > target) ? addr : target; ++ int delta = upper - lower; ++ offsetT midpoint = lower + delta / 2; ++ int this_delta = -1; ++ int this_addr = -1; ++ ++ if (delta > 2 * J_RANGE) ++ { ++ /* One trampoline won't do; we need multiple. ++ Choose the farthest trampoline that's still in range of the original ++ and let a later pass finish the job. */ ++ for ( ; tf; tf = tf->next) ++ { ++ int next_addr = (tf->next) ? tf->next->fragP->fr_address + tf->next->fragP->fr_fix : 0; ++ ++ this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ if (lower == addr) ++ { ++ /* Forward jump. */ ++ if (this_addr - addr < J_RANGE) ++ break; ++ } ++ else ++ { ++ /* Backward jump. */ ++ if (next_addr == 0 || addr - next_addr > J_RANGE) ++ break; ++ } ++ if (abs (addr - this_addr) < J_RANGE) ++ return tf; ++ ++ return NULL; ++ } ++ } ++ for ( ; tf; tf = tf->next) ++ { ++ this_addr = tf->fragP->fr_address + tf->fragP->fr_fix; ++ this_delta = abs (this_addr - midpoint); ++ if (unreachable_only && tf->needs_jump_around) ++ continue; ++ if (!best_tf || this_delta < best_delta) ++ { ++ best_tf = tf; ++ best_delta = this_delta; ++ best_addr = this_addr; ++ } ++ } ++ ++ if (best_tf && ++ best_delta < J_RANGE && ++ abs(best_addr - lower) < J_RANGE && ++ abs(best_addr - upper) < J_RANGE) ++ return best_tf; ++ ++ return NULL; /* No suitable trampoline found. */ ++} ++ ++ ++static struct trampoline_frag * ++get_best_trampoline (TInsn *tinsn, fragS *fragP) ++{ ++ struct trampoline_frag *tf = NULL; ++ ++ tf = search_trampolines (tinsn, fragP, TRUE); /* Try unreachable first. */ ++ ++ if (tf == NULL) ++ tf = search_trampolines (tinsn, fragP, FALSE); /* Try ones needing a jump-around, too. */ ++ ++ return tf; ++} ++ ++ ++static void ++check_and_update_trampolines (void) ++{ ++ struct trampoline_seg *ts = find_trampoline_seg (now_seg); ++ struct trampoline_frag *tf = ts->trampoline_list.next; ++ struct trampoline_frag *prev = &ts->trampoline_list; ++ ++ for ( ; tf; prev = tf, tf = tf->next) ++ { ++ if (tf->fragP->fr_var < 3) ++ { ++ frag_wane (tf->fragP); ++ prev->next = tf->next; ++ tf->fragP = NULL; ++ } ++ } ++} ++ ++ ++static int ++init_trampoline_frag (struct trampoline_frag *trampP) ++{ ++ fragS *fp = trampP->fragP; ++ int growth = 0; ++ ++ if (fp->fr_fix == 0) ++ { ++ symbolS *lsym; ++ char label[10 + 2 * sizeof(fp)]; ++ sprintf (label, ".L0_TR_%p", fp); ++ ++ lsym = (symbolS *)local_symbol_make (label, now_seg, 0, fp); ++ fp->fr_symbol = lsym; ++ if (trampP->needs_jump_around) ++ { ++ /* Add a jump around this block of jumps, in case ++ control flows into this block. */ ++ fixS *fixP; ++ TInsn insn; ++ xtensa_format fmt; ++ xtensa_isa isa = xtensa_default_isa; ++ ++ fp->tc_frag_data.is_insn = 1; ++ /* Assemble a jump insn. */ ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], lsym, 3); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, trampoline_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, trampoline_buf, trampoline_slotbuf); ++ xtensa_insnbuf_to_chars (isa, trampoline_buf, (unsigned char *)fp->fr_literal, 3); ++ fp->fr_fix += 3; ++ fp->fr_var -= 3; ++ growth = 3; ++ fixP = fix_new (fp, 0, 3, lsym, 3, TRUE, BFD_RELOC_XTENSA_SLOT0_OP); ++ trampP->fixP = fixP; ++ } ++ } ++ return growth; ++} ++ ++ ++static int ++add_jump_to_trampoline (struct trampoline_frag *trampP, fragS *origfrag) ++{ ++ fragS *tramp = trampP->fragP; ++ fixS *fixP; ++ int offset = tramp->fr_fix; /* Where to assemble the j insn. */ ++ TInsn insn; ++ symbolS *lsym; ++ symbolS *tsym; ++ int toffset; ++ xtensa_format fmt; ++ xtensa_isa isa = xtensa_default_isa; ++ int growth = 0; ++ ++ lsym = tramp->fr_symbol; ++ /* Assemble a jump to the target label in the trampoline frag. */ ++ tsym = origfrag->tc_frag_data.slot_symbols[0]; ++ toffset = origfrag-> tc_frag_data.slot_offsets[0]; ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], tsym, toffset); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, trampoline_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, trampoline_buf, trampoline_slotbuf); ++ xtensa_insnbuf_to_chars (isa, trampoline_buf, (unsigned char *)tramp->fr_literal + offset, 3); ++ tramp->fr_fix += 3; ++ tramp->fr_var -= 3; ++ growth = 3; ++ /* add a fix-up for the trampoline jump. */ ++ fixP = fix_new (tramp, tramp->fr_fix - 3, 3, tsym, toffset, TRUE, BFD_RELOC_XTENSA_SLOT0_OP); ++ /* Modify the jump at the start of this trampoline to point past the newly-added jump. */ ++ fixP = trampP->fixP; ++ if (fixP) ++ fixP->fx_offset += 3; ++ /* Modify the original j to point here. */ ++ origfrag->tc_frag_data.slot_symbols[0] = lsym; ++ origfrag->tc_frag_data.slot_offsets[0] = tramp->fr_fix - 3; ++ /* If trampoline is full, remove it from the list. */ ++ check_and_update_trampolines (); ++ ++ return growth; ++} ++ ++ + static long + relax_frag_immed (segT segP, + fragS *fragP, +@@ -9284,6 +9804,37 @@ relax_frag_immed (segT segP, + if (negatable_branch && istack.ninsn > 1) + update_next_frag_state (fragP); + ++ /* If last insn is a jump, and it cannot reach its target, try to find a trampoline. */ ++ if (istack.ninsn > 2 && ++ istack.insn[istack.ninsn - 1].insn_type == ITYPE_LABEL && ++ istack.insn[istack.ninsn - 2].insn_type == ITYPE_INSN && ++ istack.insn[istack.ninsn - 2].opcode == xtensa_j_opcode) ++ { ++ TInsn *jinsn = &istack.insn[istack.ninsn - 2]; ++ ++ if (!xg_symbolic_immeds_fit (jinsn, segP, fragP, fragP->fr_offset, total_text_diff)) ++ { ++ struct trampoline_frag *tf = get_best_trampoline (jinsn, fragP); ++ ++ if (tf) ++ { ++ this_text_diff += init_trampoline_frag (tf); ++ this_text_diff += add_jump_to_trampoline (tf, fragP); ++ } ++ else ++ { ++ /* If target symbol is undefined, assume it will reach once linked. */ ++ expressionS *exp = &istack.insn[istack.ninsn - 2].tok[0]; ++ ++ if (exp->X_op == O_symbol && S_IS_DEFINED (exp->X_add_symbol)) ++ { ++ as_bad_where (fragP->fr_file, fragP->fr_line, ++ _("jump target out of range; no usable trampoline found")); ++ } ++ } ++ } ++ } ++ + return this_text_diff; + } + +@@ -9404,6 +9955,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec, fragS *fragp) + else + as_bad (_("invalid relaxation fragment result")); + break; ++ ++ case RELAX_TRAMPOLINE: ++ break; + } + + fragp->fr_var = 0; +diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h +index 0bf1240..4672bc6 100644 +--- a/gas/config/tc-xtensa.h ++++ b/gas/config/tc-xtensa.h +@@ -180,6 +180,11 @@ enum xtensa_relax_statesE + prevent the linker from changing the size of any frag between the + section start and the org frag. */ + ++ RELAX_TRAMPOLINE, ++ /* Every few thousand frags, we insert one of these, just in case we may ++ need some space for a trampoline (jump to a jump) because the function ++ has gotten too big. If not needed, it disappears. */ ++ + RELAX_NONE + }; + +diff --git a/gas/frags.c b/gas/frags.c +index 5f68480..e14099d 100644 +--- a/gas/frags.c ++++ b/gas/frags.c +@@ -24,6 +24,20 @@ + + extern fragS zero_address_frag; + extern fragS predefined_address_frag; ++ ++static int totalfrags; ++ ++int ++get_frag_count (void) ++{ ++ return totalfrags; ++} ++ ++void ++clear_frag_count (void) ++{ ++ totalfrags = 0; ++} + + /* Initialization for frag routines. */ + +@@ -70,6 +84,7 @@ frag_alloc (struct obstack *ob) + ptr = (fragS *) obstack_alloc (ob, SIZEOF_STRUCT_FRAG); + obstack_alignment_mask (ob) = oalign; + memset (ptr, 0, SIZEOF_STRUCT_FRAG); ++ totalfrags++; + return ptr; + } + +diff --git a/gas/frags.h b/gas/frags.h +index 319898f..2f9e1b5 100644 +--- a/gas/frags.h ++++ b/gas/frags.h +@@ -155,4 +155,7 @@ char *frag_var (relax_stateT type, + + bfd_boolean frag_offset_fixed_p (const fragS *, const fragS *, offsetT *); + ++int get_frag_count (void); ++void clear_frag_count (void); ++ + #endif /* FRAGS_H */ +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index 2b2c294..3683b78 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -98,6 +98,7 @@ if [istarget xtensa*-*-*] then { + run_dump_test "pcrel" + run_dump_test "weak-call" + run_dump_test "jlong" ++ run_dump_test "trampoline" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/trampoline.d b/gas/testsuite/gas/xtensa/trampoline.d +new file mode 100644 +index 0000000..b4f65dc +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/trampoline.d +@@ -0,0 +1,26 @@ ++#as: ++#objdump: -d ++#name: trampolines relaxation ++ ++.*: +file format .*xtensa.* ++#... ++.*0:.*j.0x1194c ++.*3:.*j.0x1194f ++.*6:.*j.0x11952 ++.*9:.*j.0x1d4e4 ++#... ++.*11949:.*j.0x11955 ++.*1194c:.*j.0x24a0e ++.*1194f:.*j.0x24a0e ++.*11952:.*j.0x24a11 ++#... ++.*1d4e1:.*j.0x1d4e7 ++.*1d4e4:.*j.0x33462 ++#... ++.*24a0e:.*j.0x24a0e ++.*24a11:.*j.0x24a11 ++#... ++.*3345f:.*ret ++.*33462:.*j.0x49407 ++#... ++.*49407:.*j.0x49407 +diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s +new file mode 100644 +index 0000000..259a3bb +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/trampoline.s +@@ -0,0 +1,21 @@ ++ .text ++ j 1f ++ j 1f ++ j 2f ++ j 3f ++ .rep 25000 ++99: ++ and a2, a2, a3 ++ bne a2, a3, 99b ++ .endr ++1: ++ j 1b ++2: ++ j 2b ++ ++ .rep 25000 ++ and a2, a2, a3 ++ _ret ++ .endr ++3: ++ j 3b +-- +1.8.1.4 + diff --git a/package/binutils/2.24/901-xtensa-gas-first-frag-alignment.patch b/package/binutils/2.24/901-xtensa-gas-first-frag-alignment.patch new file mode 100644 index 0000000000..e1c2d85aa8 --- /dev/null +++ b/package/binutils/2.24/901-xtensa-gas-first-frag-alignment.patch @@ -0,0 +1,51 @@ +From a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 15 Apr 2014 19:12:46 +0400 +Subject: [PATCH] Fix alignment for the first section frag on xtensa + +Linking object files produced by partial linking with link-time +relaxation enabled sometimes fails with the following error message: + +dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63) + +This happens because no basic block with an XTENSA_PROP_ALIGN flag in the +property table is generated for the first basic block, even if the +.align directive is present. +It was believed that the first frag alignment could be derived from the +section alignment, but this was not implemented for the partial linking +case: after partial linking first frag of a section may become not +first, but no additional alignment frag is inserted before it. +Basic block for such frag may be merged with previous basic block into +extended basic block during relaxation pass losing its alignment +restrictions. + +Fix this by always recording alignment for the first section frag. + +2014-04-22 Max Filippov + +gas/ + * config/tc-xtensa.c (xtensa_handle_align): record alignment for the + first section frag. + +--- +Backported from: a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1 +Changes to Changelog files and tests are dropped. + + gas/config/tc-xtensa.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index ea23c96..58ace38 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5609,7 +5609,6 @@ xtensa_handle_align (fragS *fragP) + && ! fragP->tc_frag_data.is_literal + && (fragP->fr_type == rs_align + || fragP->fr_type == rs_align_code) +- && fragP->fr_address + fragP->fr_fix > 0 + && fragP->fr_offset > 0 + && now_seg != bss_section) + { +-- +1.8.1.4 + diff --git a/package/binutils/2.24/902-xtensa-gas-ld-diff-relocation-signed.patch b/package/binutils/2.24/902-xtensa-gas-ld-diff-relocation-signed.patch new file mode 100644 index 0000000000..ba24f4e4b0 --- /dev/null +++ b/package/binutils/2.24/902-xtensa-gas-ld-diff-relocation-signed.patch @@ -0,0 +1,133 @@ +From 6a17eba5358549d0d6d195bb22b34cdbc068def2 Mon Sep 17 00:00:00 2001 +From: Volodymyr Arbatov +Date: Mon, 6 May 2013 09:43:21 -0800 +Subject: [PATCH] Use signed data type for R_XTENSA_DIFF* relocation offsets. + +R_XTENSA_DIFF relocation offsets are in fact signed. Treat them as such. +Add testcase that examines ld behaviour on R_XTENSA_DIFF relocation +changing sign during relaxation. + +2014-05-02 Volodymyr Arbatov + David Weatherford + Max Filippov + +bfd/ + * elf32-xtensa.c (relax_section): treat R_XTENSA_DIFF* relocations as + signed. + +gas/ + * config/tc-xtensa.c (md_apply_fix): mark BFD_RELOC_XTENSA_DIFF* + fixups as signed. +--- +Backported from: 1058c7532d0b012ac329219264ddad59049fb6e6 +Changes to Changelog files and tests are dropped. + + bfd/elf32-xtensa.c | 32 ++++++++++++----------- + gas/config/tc-xtensa.c | 3 +++ + 2 files changed, 20 insertions(+), 15 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index edb04b4..8818d67 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -222,11 +222,11 @@ static reloc_howto_type elf_howto_table[] = + FALSE, 0, 0, FALSE), + + /* Relocations for supporting difference of symbols. */ +- HOWTO (R_XTENSA_DIFF8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_XTENSA_DIFF8, 0, 0, 8, FALSE, 0, complain_overflow_signed, + bfd_elf_xtensa_reloc, "R_XTENSA_DIFF8", FALSE, 0, 0xff, FALSE), +- HOWTO (R_XTENSA_DIFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_XTENSA_DIFF16, 0, 1, 16, FALSE, 0, complain_overflow_signed, + bfd_elf_xtensa_reloc, "R_XTENSA_DIFF16", FALSE, 0, 0xffff, FALSE), +- HOWTO (R_XTENSA_DIFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_XTENSA_DIFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed, + bfd_elf_xtensa_reloc, "R_XTENSA_DIFF32", FALSE, 0, 0xffffffff, FALSE), + + /* General immediate operand relocations. */ +@@ -9013,7 +9013,8 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + || r_type == R_XTENSA_DIFF16 + || r_type == R_XTENSA_DIFF32) + { +- bfd_vma diff_value = 0, new_end_offset, diff_mask = 0; ++ bfd_signed_vma diff_value = 0; ++ bfd_vma new_end_offset, diff_mask = 0; + + if (bfd_get_section_limit (abfd, sec) < old_source_offset) + { +@@ -9027,15 +9028,15 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + { + case R_XTENSA_DIFF8: + diff_value = +- bfd_get_8 (abfd, &contents[old_source_offset]); ++ bfd_get_signed_8 (abfd, &contents[old_source_offset]); + break; + case R_XTENSA_DIFF16: + diff_value = +- bfd_get_16 (abfd, &contents[old_source_offset]); ++ bfd_get_signed_16 (abfd, &contents[old_source_offset]); + break; + case R_XTENSA_DIFF32: + diff_value = +- bfd_get_32 (abfd, &contents[old_source_offset]); ++ bfd_get_signed_32 (abfd, &contents[old_source_offset]); + break; + } + +@@ -9047,24 +9048,25 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + switch (r_type) + { + case R_XTENSA_DIFF8: +- diff_mask = 0xff; +- bfd_put_8 (abfd, diff_value, ++ diff_mask = 0x7f; ++ bfd_put_signed_8 (abfd, diff_value, + &contents[old_source_offset]); + break; + case R_XTENSA_DIFF16: +- diff_mask = 0xffff; +- bfd_put_16 (abfd, diff_value, ++ diff_mask = 0x7fff; ++ bfd_put_signed_16 (abfd, diff_value, + &contents[old_source_offset]); + break; + case R_XTENSA_DIFF32: +- diff_mask = 0xffffffff; +- bfd_put_32 (abfd, diff_value, ++ diff_mask = 0x7fffffff; ++ bfd_put_signed_32 (abfd, diff_value, + &contents[old_source_offset]); + break; + } + +- /* Check for overflow. */ +- if ((diff_value & ~diff_mask) != 0) ++ /* Check for overflow. Sign bits must be all zeroes or all ones */ ++ if ((diff_value & ~diff_mask) != 0 && ++ (diff_value & ~diff_mask) != (-1 & ~diff_mask)) + { + (*link_info->callbacks->reloc_dangerous) + (link_info, _("overflow after relaxation"), +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 58ace38..7547c0a0 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5867,12 +5867,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) + { + case BFD_RELOC_8: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8; ++ fixP->fx_signed = 1; + break; + case BFD_RELOC_16: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16; ++ fixP->fx_signed = 1; + break; + case BFD_RELOC_32: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32; ++ fixP->fx_signed = 1; + break; + default: + break; +-- +1.8.1.4 + diff --git a/package/binutils/2.24/903-xtensa-fix-ld-segfault-when-linking-linux-modules.patch b/package/binutils/2.24/903-xtensa-fix-ld-segfault-when-linking-linux-modules.patch new file mode 100644 index 0000000000..6a0846ef8e --- /dev/null +++ b/package/binutils/2.24/903-xtensa-fix-ld-segfault-when-linking-linux-modules.patch @@ -0,0 +1,47 @@ +From e7d17e71cdc10a2e81e454ce3b9637f1b2a587f2 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 10 Jul 2014 01:47:33 +0400 +Subject: [PATCH] Fix xtensa ld segfault when linking linux modules + +is_inconsistent_linkonce_section makes an assumption that section name +that starts with ".gnu.linkonce.prop." has one more dot in its suffix. +However gas generates such section name by insertion of "prop." right +after ".gnu.linkonce." part of the name of the original section. So, for +section named ".gnu.linkonce.this_module" corresponding property section +name does not satisfy the assumption. Such section names are common in +linux modules. This bug was exposed by the patch "a35d5e8 Fix alignment +for the first section frag on xtensa", that makes gas produce property +section for each section that has ".align" directive in it. + +Use suffix that immediately follows ".gnu.linkonce.prop." when there are +no more dots following it. + +2014-07-10 Max Filippov + +ld/ + * emultempl/xtensaelf.em (is_inconsistent_linkonce_section): + correctly handle missing dot in section name after + ".gnu.linkonce.prop.". +--- +Backported from: e7d17e71cdc10a2e81e454ce3b9637f1b2a587f2 +Changes to ld/ChangeLog file are dropped. + + ld/emultempl/xtensaelf.em | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em +index 151eea4..948d18d 100644 +--- a/ld/emultempl/xtensaelf.em ++++ b/ld/emultempl/xtensaelf.em +@@ -1310,7 +1310,7 @@ is_inconsistent_linkonce_section (asection *sec) + for Tensilica's XCC compiler. */ + name = sec_name + linkonce_len; + if (CONST_STRNEQ (name, "prop.")) +- name = strchr (name + 5, '.') + 1; ++ name = strchr (name + 5, '.') ? strchr (name + 5, '.') + 1 : name + 5; + else if (name[1] == '.' + && (name[0] == 'p' || name[0] == 'e' || name[0] == 'h')) + name += 2; +-- +1.8.1.4 + diff --git a/package/binutils/2.24/904-Fix-call8-call-target-out-of-range-xtensa-ld-relaxation.patch b/package/binutils/2.24/904-Fix-call8-call-target-out-of-range-xtensa-ld-relaxation.patch new file mode 100644 index 0000000000..e4c600e542 --- /dev/null +++ b/package/binutils/2.24/904-Fix-call8-call-target-out-of-range-xtensa-ld-relaxation.patch @@ -0,0 +1,79 @@ +From 7fc39194f8fb48914c995f8ec3826d50086f1ec0 Mon Sep 17 00:00:00 2001 +From: Sterling Augustine +Date: Tue, 25 Jan 2011 13:59:13 -0800 +Subject: [PATCH] Fix 'call8: call target out of range' xtensa ld relaxation + bug + +During link-time relaxation distance between cross-section call site and +its target may grow, producing 'call target out of range' error for +relaxed calls. Be more conservative when calculating whether or not a +callx can be converted to a straight call. + +2014-09-23 Sterling Augustine + +bfd/ + * elf32-xtensa.c (is_resolvable_asm_expansion): for cross-section + call relaxation use furthermost addresses where call source and + destination can be to check whether it's in the range of a direct + call. + +Signed-off-by: Max Filippov +--- + bfd/elf32-xtensa.c | 41 +++++++++++++++++++++++++++++++++++++---- + 1 file changed, 37 insertions(+), 4 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 09862e3..e32496a 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -7124,10 +7124,43 @@ is_resolvable_asm_expansion (bfd *abfd, + || is_reloc_sym_weak (abfd, irel))) + return FALSE; + +- self_address = (sec->output_section->vma +- + sec->output_offset + irel->r_offset + 3); +- dest_address = (target_sec->output_section->vma +- + target_sec->output_offset + target_offset); ++ if (target_sec->output_section != sec->output_section) ++ { ++ /* If the two sections are sufficiently far away that relaxation ++ might take the call out of range, we can't simplify. For ++ example, a positive displacement call into another memory ++ could get moved to a lower address due to literal removal, ++ but the destination won't move, and so the displacment might ++ get larger. ++ ++ If the displacement is negative, assume the destination could ++ move as far back as the start of the output section. The ++ self_address will be at least as far into the output section ++ as it is prior to relaxation. ++ ++ If the displacement is postive, assume the destination will be in ++ it's pre-relaxed location (because relaxation only makes sections ++ smaller). The self_address could go all the way to the beginning ++ of the output section. */ ++ ++ dest_address = target_sec->output_section->vma; ++ self_address = sec->output_section->vma; ++ ++ if (sec->output_section->vma > target_sec->output_section->vma) ++ self_address += sec->output_offset + irel->r_offset + 3; ++ else ++ dest_address += bfd_get_section_limit (abfd, target_sec->output_section); ++ /* Call targets should be four-byte aligned. */ ++ dest_address = (dest_address + 3) & ~3; ++ } ++ else ++ { ++ ++ self_address = (sec->output_section->vma ++ + sec->output_offset + irel->r_offset + 3); ++ dest_address = (target_sec->output_section->vma ++ + target_sec->output_offset + target_offset); ++ } + + *is_reachable_p = pcrel_reloc_fits (direct_call_opcode, 0, + self_address, dest_address); +-- +1.8.1.4 + diff --git a/package/binutils/2.24/905-Fix-trampolines-search-code-for-conditional-branches.patch b/package/binutils/2.24/905-Fix-trampolines-search-code-for-conditional-branches.patch new file mode 100644 index 0000000000..8aeb06428a --- /dev/null +++ b/package/binutils/2.24/905-Fix-trampolines-search-code-for-conditional-branches.patch @@ -0,0 +1,90 @@ +From 415480d6471e67aef97c0241d451ef2423a1da9d Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 25 Nov 2014 21:33:21 +0300 +Subject: [PATCH] Fix trampolines search code for conditional branches + +For conditional branches that need more than one trampoline to reach its +target assembler couldn't always find suitable trampoline because +post-loop condition check was placed inside the loop, resulting in +premature loop termination. Move check outside the loop. + +This fixes the following build errors seen when assembling huge files +produced by gcc: + Error: jump target out of range; no usable trampoline found + Error: operand 1 of 'j' has out of range value '307307' + +2014-11-25 Max Filippov + +gas/ + * config/tc-xtensa.c (search_trampolines): Move post-loop + condition check outside the search loop. + +gas/testsuite/ + * gas/xtensa/trampoline.d: Add expected output for branches. + * gas/xtensa/trampoline.s: Add test case for branches. + +Signed-off-by: Max Filippov +--- +Backported from: d92b6eece424f0ad35d96fdd85bf207295e8c4c3 +Changes to ChangeLogs are dropped. + + gas/config/tc-xtensa.c | 8 ++++---- + gas/testsuite/gas/xtensa/trampoline.d | 9 +++++++++ + gas/testsuite/gas/xtensa/trampoline.s | 7 +++++++ + 3 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index d11b0c7..f23ccf8 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -9514,11 +9514,11 @@ search_trampolines (TInsn *tinsn, fragS *fragP, bfd_boolean unreachable_only) + if (next_addr == 0 || addr - next_addr > J_RANGE) + break; + } +- if (abs (addr - this_addr) < J_RANGE) +- return tf; +- +- return NULL; + } ++ if (abs (addr - this_addr) < J_RANGE) ++ return tf; ++ ++ return NULL; + } + for ( ; tf; tf = tf->next) + { +diff --git a/gas/testsuite/gas/xtensa/trampoline.d b/gas/testsuite/gas/xtensa/trampoline.d +index b4f65dc..5ae32a6 100644 +--- a/gas/testsuite/gas/xtensa/trampoline.d ++++ b/gas/testsuite/gas/xtensa/trampoline.d +@@ -24,3 +24,12 @@ + .*33462:.*j.0x49407 + #... + .*49407:.*j.0x49407 ++.*4940a:.*beqz.n.a2,.0x4940f ++.*4940c:.*j.0x693d1 ++#... ++.*693d1:.*j.0x7ddd4 ++#... ++.*7ddd4:.*j.0x927f5 ++#... ++.*927f5:.*j.0x927f5 ++#... +diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s +index 259a3bb..4465786 100644 +--- a/gas/testsuite/gas/xtensa/trampoline.s ++++ b/gas/testsuite/gas/xtensa/trampoline.s +@@ -19,3 +19,10 @@ + .endr + 3: + j 3b ++ bnez a2, 4f ++ .rep 50000 ++ and a2, a2, a3 ++ _ret ++ .endr ++4: ++ j 4b +-- +1.8.1.4 + diff --git a/package/binutils/2.24/906-xtensa-optimize-check_section_ebb_pcrels_fit.patch b/package/binutils/2.24/906-xtensa-optimize-check_section_ebb_pcrels_fit.patch new file mode 100644 index 0000000000..8a211004f3 --- /dev/null +++ b/package/binutils/2.24/906-xtensa-optimize-check_section_ebb_pcrels_fit.patch @@ -0,0 +1,502 @@ +From 20c79baf82273a0b368587f761f152c4d3a593a4 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 27 Mar 2015 07:13:55 +0300 +Subject: [PATCH 1/4] xtensa: optimize check_section_ebb_pcrels_fit + +The original check_section_ebb_pcrels_fit algorithm checks that text +actions proposed for current EBB are OK for every relocation in a +section. There's no need to check every relocation, because text actions +for EBB can only change size of that EBB, thus only affecting +relocations that in any way cross that EBB. In addition EBBs are +iterated in ascending order of their VMA, making it easier to track +relevant relocations. + +Introduce a structure that can track relocations that cross the range of +VMAs of EBB and use it to only check relocations relevant to current EBB +in check_section_ebb_pcrels_fit. +It takes O(N log N) operations to build it and O(N) operations to move +current EBB VMA window through its entire range, where N is the number +of relocations in a section. The resulting complexity of +compute_text_actions is thus reduced from O(N^2) to O(N log N + N * M), +where M is the average number of relocations crossing each EBB. + +Original profile: + +% time self children called name +----------------------------------------- + 44.26 71.53 6429/6429 compute_text_actions + 50.2 44.26 71.53 6429 check_section_ebb_pcrels_fit + 1.16 20.12 347506666/347576152 pcrel_reloc_fits + 2.95 16.52 347506666/348104944 get_relocation_opnd + 2.01 9.74 347575100/361252208 r_reloc_init + 0.55 7.53 347575100/363381467 r_reloc_get_section + 5.76 0.02 695013332/695013332 xlate_offset_with_removed_text + 0.68 3.89 347575100/363483827 bfd_octets_per_byte + 0.32 0.00 347506666/349910253 is_alt_relocation + 0.18 0.11 6391/6391 build_xlate_map + 0.00 0.00 6429/19417168 get_xtensa_relax_info + 0.00 0.00 6391/6391 free_xlate_map +----------------------------------------- + +Same data, after optimization: + +% time self children called name +----------------------------------------- + 2.56 3.08 6429/6429 compute_text_actions + 8.2 2.56 3.08 6429 check_section_ebb_pcrels_fit + 0.08 0.91 17721075/17790561 pcrel_reloc_fits + 0.17 0.47 17721075/31685977 r_reloc_init + 0.43 0.00 35442150/35442150 xlate_offset_with_removed_text + 0.02 0.37 17721075/33815236 r_reloc_get_section + 0.22 0.11 6391/6391 build_xlate_map + 0.05 0.22 17721075/33917596 bfd_octets_per_byte + 0.03 0.00 17721075/20405299 is_alt_relocation + 0.01 0.00 6429/6429 reloc_range_list_update_range + 0.00 0.00 6429/19417168 get_xtensa_relax_info + 0.00 0.00 6391/6391 free_xlate_map +----------------------------------------- + +2015-04-01 Max Filippov +bfd/ + * elf32-xtensa.c (reloc_range_list, reloc_range_list_entry, + reloc_range): new typedef. + (reloc_range_list_struct, reloc_range_list_entry_struct, + reloc_range_struct): new structures. + (reloc_range_compare, build_reloc_ranges, + reloc_range_list_append, reloc_range_list_remove, + reloc_range_list_update_range, free_reloc_range_list): new + functions. + (compute_text_actions): precompute relocation opcodes before the + loop. Add relevant_relocs variable, initialize it before the + loop, pass it to the check_section_ebb_pcrels_fit. + (check_section_ebb_pcrels_fit): add new parameter: + relevant_relocs. Update address range in the relevant_relocs if + it's non-NULL and iterate only over relevant relocations. + +Backported from: b2b326d246f839ee218192ac88da2384d929a072 +Signed-off-by: Max Filippov +--- + bfd/elf32-xtensa.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 298 insertions(+), 23 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 0b6f584..872370b 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -6619,8 +6619,10 @@ static bfd_boolean compute_text_actions + (bfd *, asection *, struct bfd_link_info *); + static bfd_boolean compute_ebb_proposed_actions (ebb_constraint *); + static bfd_boolean compute_ebb_actions (ebb_constraint *); ++typedef struct reloc_range_list_struct reloc_range_list; + static bfd_boolean check_section_ebb_pcrels_fit +- (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, const ebb_constraint *, ++ (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, ++ reloc_range_list *, const ebb_constraint *, + const xtensa_opcode *); + static bfd_boolean check_section_ebb_reduces (const ebb_constraint *); + static void text_action_add_proposed +@@ -7219,6 +7221,221 @@ build_reloc_opcodes (bfd *abfd, + return reloc_opcodes; + } + ++struct reloc_range_struct ++{ ++ bfd_vma addr; ++ bfd_boolean add; /* TRUE if start of a range, FALSE otherwise. */ ++ /* Original irel index in the array of relocations for a section. */ ++ unsigned irel_index; ++}; ++typedef struct reloc_range_struct reloc_range; ++ ++typedef struct reloc_range_list_entry_struct reloc_range_list_entry; ++struct reloc_range_list_entry_struct ++{ ++ reloc_range_list_entry *next; ++ reloc_range_list_entry *prev; ++ Elf_Internal_Rela *irel; ++ xtensa_opcode opcode; ++ int opnum; ++}; ++ ++struct reloc_range_list_struct ++{ ++ /* The rest of the structure is only meaningful when ok is TRUE. */ ++ bfd_boolean ok; ++ ++ unsigned n_range; /* Number of range markers. */ ++ reloc_range *range; /* Sorted range markers. */ ++ ++ unsigned first; /* Index of a first range element in the list. */ ++ unsigned last; /* One past index of a last range element in the list. */ ++ ++ unsigned n_list; /* Number of list elements. */ ++ reloc_range_list_entry *reloc; /* */ ++ reloc_range_list_entry list_root; ++}; ++ ++static int ++reloc_range_compare (const void *a, const void *b) ++{ ++ const reloc_range *ra = a; ++ const reloc_range *rb = b; ++ ++ if (ra->addr != rb->addr) ++ return ra->addr < rb->addr ? -1 : 1; ++ if (ra->add != rb->add) ++ return ra->add ? -1 : 1; ++ return 0; ++} ++ ++static void ++build_reloc_ranges (bfd *abfd, asection *sec, ++ bfd_byte *contents, ++ Elf_Internal_Rela *internal_relocs, ++ xtensa_opcode *reloc_opcodes, ++ reloc_range_list *list) ++{ ++ unsigned i; ++ size_t n = 0; ++ size_t max_n = 0; ++ reloc_range *ranges = NULL; ++ reloc_range_list_entry *reloc = ++ bfd_malloc (sec->reloc_count * sizeof (*reloc)); ++ ++ memset (list, 0, sizeof (*list)); ++ list->ok = TRUE; ++ ++ for (i = 0; i < sec->reloc_count; i++) ++ { ++ Elf_Internal_Rela *irel = &internal_relocs[i]; ++ int r_type = ELF32_R_TYPE (irel->r_info); ++ reloc_howto_type *howto = &elf_howto_table[r_type]; ++ r_reloc r_rel; ++ ++ if (r_type == R_XTENSA_ASM_SIMPLIFY ++ || r_type == R_XTENSA_32_PCREL ++ || !howto->pc_relative) ++ continue; ++ ++ r_reloc_init (&r_rel, abfd, irel, contents, ++ bfd_get_section_limit (abfd, sec)); ++ ++ if (r_reloc_get_section (&r_rel) != sec) ++ continue; ++ ++ if (n + 2 > max_n) ++ { ++ max_n = (max_n + 2) * 2; ++ ranges = bfd_realloc (ranges, max_n * sizeof (*ranges)); ++ } ++ ++ ranges[n].addr = irel->r_offset; ++ ranges[n + 1].addr = r_rel.target_offset; ++ ++ ranges[n].add = ranges[n].addr < ranges[n + 1].addr; ++ ranges[n + 1].add = !ranges[n].add; ++ ++ ranges[n].irel_index = i; ++ ranges[n + 1].irel_index = i; ++ ++ n += 2; ++ ++ reloc[i].irel = irel; ++ ++ /* Every relocation won't possibly be checked in the optimized version of ++ check_section_ebb_pcrels_fit, so this needs to be done here. */ ++ if (is_alt_relocation (ELF32_R_TYPE (irel->r_info))) ++ { ++ /* None of the current alternate relocs are PC-relative, ++ and only PC-relative relocs matter here. */ ++ } ++ else ++ { ++ xtensa_opcode opcode; ++ int opnum; ++ ++ if (reloc_opcodes) ++ opcode = reloc_opcodes[i]; ++ else ++ opcode = get_relocation_opcode (abfd, sec, contents, irel); ++ ++ if (opcode == XTENSA_UNDEFINED) ++ { ++ list->ok = FALSE; ++ break; ++ } ++ ++ opnum = get_relocation_opnd (opcode, ELF32_R_TYPE (irel->r_info)); ++ if (opnum == XTENSA_UNDEFINED) ++ { ++ list->ok = FALSE; ++ break; ++ } ++ ++ /* Record relocation opcode and opnum as we've calculated them ++ anyway and they won't change. */ ++ reloc[i].opcode = opcode; ++ reloc[i].opnum = opnum; ++ } ++ } ++ ++ if (list->ok) ++ { ++ ranges = bfd_realloc (ranges, n * sizeof (*ranges)); ++ qsort (ranges, n, sizeof (*ranges), reloc_range_compare); ++ ++ list->n_range = n; ++ list->range = ranges; ++ list->reloc = reloc; ++ list->list_root.prev = &list->list_root; ++ list->list_root.next = &list->list_root; ++ } ++ else ++ { ++ free (ranges); ++ free (reloc); ++ } ++} ++ ++static void reloc_range_list_append (reloc_range_list *list, ++ unsigned irel_index) ++{ ++ reloc_range_list_entry *entry = list->reloc + irel_index; ++ ++ entry->prev = list->list_root.prev; ++ entry->next = &list->list_root; ++ entry->prev->next = entry; ++ entry->next->prev = entry; ++ ++list->n_list; ++} ++ ++static void reloc_range_list_remove (reloc_range_list *list, ++ unsigned irel_index) ++{ ++ reloc_range_list_entry *entry = list->reloc + irel_index; ++ ++ entry->next->prev = entry->prev; ++ entry->prev->next = entry->next; ++ --list->n_list; ++} ++ ++/* Update relocation list object so that it lists all relocations that cross ++ [first; last] range. Range bounds should not decrease with successive ++ invocations. */ ++static void reloc_range_list_update_range (reloc_range_list *list, ++ bfd_vma first, bfd_vma last) ++{ ++ /* This should not happen: EBBs are iterated from lower addresses to higher. ++ But even if that happens there's no need to break: just flush current list ++ and start from scratch. */ ++ if ((list->last > 0 && list->range[list->last - 1].addr > last) || ++ (list->first > 0 && list->range[list->first - 1].addr >= first)) ++ { ++ list->first = 0; ++ list->last = 0; ++ list->n_list = 0; ++ list->list_root.next = &list->list_root; ++ list->list_root.prev = &list->list_root; ++ fprintf (stderr, "%s: move backwards requested\n", __func__); ++ } ++ ++ for (; list->last < list->n_range && ++ list->range[list->last].addr <= last; ++list->last) ++ if (list->range[list->last].add) ++ reloc_range_list_append (list, list->range[list->last].irel_index); ++ ++ for (; list->first < list->n_range && ++ list->range[list->first].addr < first; ++list->first) ++ if (!list->range[list->first].add) ++ reloc_range_list_remove (list, list->range[list->first].irel_index); ++} ++ ++static void free_reloc_range_list (reloc_range_list *list) ++{ ++ free (list->range); ++ free (list->reloc); ++} + + /* The compute_text_actions function will build a list of potential + transformation actions for code in the extended basic block of each +@@ -7245,6 +7462,7 @@ compute_text_actions (bfd *abfd, + property_table_entry *prop_table = 0; + int ptblsize = 0; + bfd_size_type sec_size; ++ reloc_range_list relevant_relocs; + + relax_info = get_xtensa_relax_info (sec); + BFD_ASSERT (relax_info); +@@ -7277,6 +7495,12 @@ compute_text_actions (bfd *abfd, + goto error_return; + } + ++ /* Precompute the opcode for each relocation. */ ++ reloc_opcodes = build_reloc_opcodes (abfd, sec, contents, internal_relocs); ++ ++ build_reloc_ranges (abfd, sec, contents, internal_relocs, reloc_opcodes, ++ &relevant_relocs); ++ + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; +@@ -7340,17 +7564,13 @@ compute_text_actions (bfd *abfd, + ebb->start_reloc_idx = i; + ebb->end_reloc_idx = i; + +- /* Precompute the opcode for each relocation. */ +- if (reloc_opcodes == NULL) +- reloc_opcodes = build_reloc_opcodes (abfd, sec, contents, +- internal_relocs); +- + if (!extend_ebb_bounds (ebb) + || !compute_ebb_proposed_actions (&ebb_table) + || !compute_ebb_actions (&ebb_table) + || !check_section_ebb_pcrels_fit (abfd, sec, contents, +- internal_relocs, &ebb_table, +- reloc_opcodes) ++ internal_relocs, ++ &relevant_relocs, ++ &ebb_table, reloc_opcodes) + || !check_section_ebb_reduces (&ebb_table)) + { + /* If anything goes wrong or we get unlucky and something does +@@ -7372,6 +7592,8 @@ compute_text_actions (bfd *abfd, + free_ebb_constraint (&ebb_table); + } + ++ free_reloc_range_list (&relevant_relocs); ++ + #if DEBUG + if (relax_info->action_list.head) + print_action_list (stderr, &relax_info->action_list); +@@ -7974,14 +8196,17 @@ check_section_ebb_pcrels_fit (bfd *abfd, + asection *sec, + bfd_byte *contents, + Elf_Internal_Rela *internal_relocs, ++ reloc_range_list *relevant_relocs, + const ebb_constraint *constraint, + const xtensa_opcode *reloc_opcodes) + { + unsigned i, j; ++ unsigned n = sec->reloc_count; + Elf_Internal_Rela *irel; + xlate_map_t *xmap = NULL; + bfd_boolean ok = TRUE; + xtensa_relax_info *relax_info; ++ reloc_range_list_entry *entry = NULL; + + relax_info = get_xtensa_relax_info (sec); + +@@ -7992,7 +8217,40 @@ check_section_ebb_pcrels_fit (bfd *abfd, + can still be used. */ + } + +- for (i = 0; i < sec->reloc_count; i++) ++ if (relevant_relocs && constraint->action_count) ++ { ++ if (!relevant_relocs->ok) ++ { ++ ok = FALSE; ++ n = 0; ++ } ++ else ++ { ++ bfd_vma min_offset, max_offset; ++ min_offset = max_offset = constraint->actions[0].offset; ++ ++ for (i = 1; i < constraint->action_count; ++i) ++ { ++ proposed_action *action = &constraint->actions[i]; ++ bfd_vma offset = action->offset; ++ ++ if (offset < min_offset) ++ min_offset = offset; ++ if (offset > max_offset) ++ max_offset = offset; ++ } ++ reloc_range_list_update_range (relevant_relocs, min_offset, ++ max_offset); ++ n = relevant_relocs->n_list; ++ entry = &relevant_relocs->list_root; ++ } ++ } ++ else ++ { ++ relevant_relocs = NULL; ++ } ++ ++ for (i = 0; i < n; i++) + { + r_reloc r_rel; + bfd_vma orig_self_offset, orig_target_offset; +@@ -8001,7 +8259,15 @@ check_section_ebb_pcrels_fit (bfd *abfd, + reloc_howto_type *howto; + int self_removed_bytes, target_removed_bytes; + +- irel = &internal_relocs[i]; ++ if (relevant_relocs) ++ { ++ entry = entry->next; ++ irel = entry->irel; ++ } ++ else ++ { ++ irel = internal_relocs + i; ++ } + r_type = ELF32_R_TYPE (irel->r_info); + + howto = &elf_howto_table[r_type]; +@@ -8067,21 +8333,30 @@ check_section_ebb_pcrels_fit (bfd *abfd, + xtensa_opcode opcode; + int opnum; + +- if (reloc_opcodes) +- opcode = reloc_opcodes[i]; +- else +- opcode = get_relocation_opcode (abfd, sec, contents, irel); +- if (opcode == XTENSA_UNDEFINED) ++ if (relevant_relocs) + { +- ok = FALSE; +- break; ++ opcode = entry->opcode; ++ opnum = entry->opnum; + } +- +- opnum = get_relocation_opnd (opcode, ELF32_R_TYPE (irel->r_info)); +- if (opnum == XTENSA_UNDEFINED) ++ else + { +- ok = FALSE; +- break; ++ if (reloc_opcodes) ++ opcode = reloc_opcodes[relevant_relocs ? ++ (unsigned)(entry - relevant_relocs->reloc) : i]; ++ else ++ opcode = get_relocation_opcode (abfd, sec, contents, irel); ++ if (opcode == XTENSA_UNDEFINED) ++ { ++ ok = FALSE; ++ break; ++ } ++ ++ opnum = get_relocation_opnd (opcode, ELF32_R_TYPE (irel->r_info)); ++ if (opnum == XTENSA_UNDEFINED) ++ { ++ ok = FALSE; ++ break; ++ } + } + + if (!pcrel_reloc_fits (opcode, opnum, self_offset, target_offset)) +@@ -8778,7 +9053,7 @@ move_shared_literal (asection *sec, + /* Check all of the PC-relative relocations to make sure they still fit. */ + relocs_fit = check_section_ebb_pcrels_fit (target_sec->owner, target_sec, + target_sec_cache->contents, +- target_sec_cache->relocs, ++ target_sec_cache->relocs, NULL, + &ebb_table, NULL); + + if (!relocs_fit) +-- +1.8.1.4 + diff --git a/package/binutils/2.24/907-xtensa-optimize-removed_by_actions.patch b/package/binutils/2.24/907-xtensa-optimize-removed_by_actions.patch new file mode 100644 index 0000000000..9df8065307 --- /dev/null +++ b/package/binutils/2.24/907-xtensa-optimize-removed_by_actions.patch @@ -0,0 +1,356 @@ +From 3e3f60207399ab29dd55af109e5ae9facc7d8e83 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sat, 28 Mar 2015 08:46:28 +0300 +Subject: [PATCH 2/4] xtensa: optimize removed_by_actions + +The function removed_by_actions iterates through text actions to +calculate an offset applied by text actions to a given VMA. Although it +has a parameter p_start_action that allows for incremental offset +calculation, in many places it's used with p_start_action explicitly set +to the first action. After the first relaxation pass when the list of +text actions is finalized, an array of offsets sorted by VMA may be used +to speed up this function. + +Original profile: + +% time self children called name +----------------------------------------- + 0.35 0.00 33872/4808961 relax_section_symbols + 3.32 0.00 326022/4808961 relax_property_section + 12.83 0.00 1259379/4808961 offset_with_removed_text + 32.50 0.00 3189688/4808961 translate_reloc + 71.5 49.00 0.00 4808961 removed_by_actions +----------------------------------------- + +Same data, after optimization: + +% time self children called name +----------------------------------------- + 0.00 0.00 33872/4808537 relax_section_symbols + 0.01 0.00 326022/4808537 relax_property_section + 0.05 0.00 1258955/4808537 offset_with_removed_text_map + 0.13 0.00 3189688/4808537 translate_reloc + 1.0 0.20 0.00 4808537 removed_by_actions_map + 0.00 0.00 120/120 map_removal_by_action +----------------------------------------- + +2015-04-01 Max Filippov +bfd/ + * elf32-xtensa.c (removal_by_action_entry_struct, + removal_by_action_map_struct): new structures. + (removal_by_action_entry, removal_by_action_map): new typedefs. + (text_action_list_struct): add new field: map. + (map_removal_by_action, removed_by_actions_map, + offset_with_removed_text_map): new functions. + (relax_section): replace offset_with_removed_text with + offset_with_removed_text_map. + (translate_reloc, relax_property_section, relax_section_symbols): + replace removed_by_actions with removed_by_actions_map. + +Backported from: 071aa5c98a31c966f5fbfc573fcee61350fd1936 +Signed-off-by: Max Filippov +--- + bfd/elf32-xtensa.c | 181 +++++++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 156 insertions(+), 25 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 872370b..21b2871 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -5420,11 +5420,28 @@ struct text_action_struct + text_action *next; + }; + ++struct removal_by_action_entry_struct ++{ ++ bfd_vma offset; ++ int removed; ++ int eq_removed; ++ int eq_removed_before_fill; ++}; ++typedef struct removal_by_action_entry_struct removal_by_action_entry; ++ ++struct removal_by_action_map_struct ++{ ++ unsigned n_entries; ++ removal_by_action_entry *entry; ++}; ++typedef struct removal_by_action_map_struct removal_by_action_map; ++ + + /* List of all of the actions taken on a text section. */ + struct text_action_list_struct + { + text_action *head; ++ removal_by_action_map map; + }; + + +@@ -5636,6 +5653,101 @@ action_list_count (text_action_list *action_list) + return count; + } + ++static void ++map_removal_by_action (text_action_list *action_list) ++{ ++ text_action *r; ++ int removed = 0; ++ removal_by_action_map map; ++ bfd_boolean eq_complete; ++ ++ map.n_entries = 0; ++ map.entry = bfd_malloc (action_list_count (action_list) * ++ sizeof (removal_by_action_entry)); ++ eq_complete = FALSE; ++ ++ for (r = action_list->head; r;) ++ { ++ removal_by_action_entry *ientry = map.entry + map.n_entries; ++ ++ if (map.n_entries && (ientry - 1)->offset == r->offset) ++ { ++ --ientry; ++ } ++ else ++ { ++ ++map.n_entries; ++ eq_complete = FALSE; ++ ientry->offset = r->offset; ++ ientry->eq_removed_before_fill = removed; ++ } ++ ++ if (!eq_complete) ++ { ++ if (r->action != ta_fill || r->removed_bytes >= 0) ++ { ++ ientry->eq_removed = removed; ++ eq_complete = TRUE; ++ } ++ else ++ ientry->eq_removed = removed + r->removed_bytes; ++ } ++ ++ removed += r->removed_bytes; ++ ientry->removed = removed; ++ r = r->next; ++ } ++ action_list->map = map; ++} ++ ++static int ++removed_by_actions_map (text_action_list *action_list, bfd_vma offset, ++ bfd_boolean before_fill) ++{ ++ unsigned a, b; ++ ++ if (!action_list->map.entry) ++ map_removal_by_action (action_list); ++ ++ if (!action_list->map.n_entries) ++ return 0; ++ ++ a = 0; ++ b = action_list->map.n_entries; ++ ++ while (b - a > 1) ++ { ++ unsigned c = (a + b) / 2; ++ ++ if (action_list->map.entry[c].offset <= offset) ++ a = c; ++ else ++ b = c; ++ } ++ ++ if (action_list->map.entry[a].offset < offset) ++ { ++ return action_list->map.entry[a].removed; ++ } ++ else if (action_list->map.entry[a].offset == offset) ++ { ++ return before_fill ? ++ action_list->map.entry[a].eq_removed_before_fill : ++ action_list->map.entry[a].eq_removed; ++ } ++ else ++ { ++ return 0; ++ } ++} ++ ++static bfd_vma ++offset_with_removed_text_map (text_action_list *action_list, bfd_vma offset) ++{ ++ int removed = removed_by_actions_map (action_list, offset, FALSE); ++ return offset - removed; ++} ++ + + /* The find_insn_action routine will only find non-fill actions. */ + +@@ -5909,6 +6021,9 @@ init_xtensa_relax_info (asection *sec) + + relax_info->action_list.head = NULL; + ++ relax_info->action_list.map.n_entries = 0; ++ relax_info->action_list.map.entry = NULL; ++ + relax_info->fix_list = NULL; + relax_info->fix_array = NULL; + relax_info->fix_array_count = 0; +@@ -9218,7 +9333,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + if (elf_hash_table (link_info)->dynamic_sections_created) + shrink_dynamic_reloc_sections (link_info, abfd, sec, irel); + irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); +- irel->r_offset = offset_with_removed_text ++ irel->r_offset = offset_with_removed_text_map + (&relax_info->action_list, irel->r_offset); + continue; + } +@@ -9255,7 +9370,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + } + } + +- source_offset = offset_with_removed_text ++ source_offset = offset_with_removed_text_map + (&relax_info->action_list, irel->r_offset); + irel->r_offset = source_offset; + } +@@ -9352,7 +9467,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + break; + } + +- new_end_offset = offset_with_removed_text ++ new_end_offset = offset_with_removed_text_map + (&target_relax_info->action_list, + r_rel.target_offset + diff_value); + diff_value = new_end_offset - new_reloc.target_offset; +@@ -9750,7 +9865,6 @@ translate_reloc (const r_reloc *orig_rel, r_reloc *new_rel, asection *sec) + xtensa_relax_info *relax_info; + removed_literal *removed; + bfd_vma target_offset, base_offset; +- text_action *act; + + *new_rel = *orig_rel; + +@@ -9803,19 +9917,26 @@ translate_reloc (const r_reloc *orig_rel, r_reloc *new_rel, asection *sec) + offset. */ + + base_offset = r_reloc_get_target_offset (new_rel) - new_rel->rela.r_addend; +- act = relax_info->action_list.head; + if (base_offset <= target_offset) + { +- int base_removed = removed_by_actions (&act, base_offset, FALSE); +- int addend_removed = removed_by_actions (&act, target_offset, FALSE); ++ int base_removed = removed_by_actions_map (&relax_info->action_list, ++ base_offset, FALSE); ++ int addend_removed = removed_by_actions_map (&relax_info->action_list, ++ target_offset, FALSE) - ++ base_removed; ++ + new_rel->target_offset = target_offset - base_removed - addend_removed; + new_rel->rela.r_addend -= addend_removed; + } + else + { + /* Handle a negative addend. The base offset comes first. */ +- int tgt_removed = removed_by_actions (&act, target_offset, FALSE); +- int addend_removed = removed_by_actions (&act, base_offset, FALSE); ++ int tgt_removed = removed_by_actions_map (&relax_info->action_list, ++ target_offset, FALSE); ++ int addend_removed = removed_by_actions_map (&relax_info->action_list, ++ base_offset, FALSE) - ++ tgt_removed; ++ + new_rel->target_offset = target_offset - tgt_removed; + new_rel->rela.r_addend += addend_removed; + } +@@ -10138,9 +10259,10 @@ relax_property_section (bfd *abfd, + bfd_vma old_offset = val.r_rel.target_offset; + bfd_vma new_offset; + long old_size, new_size; +- text_action *act = target_relax_info->action_list.head; +- new_offset = old_offset - +- removed_by_actions (&act, old_offset, FALSE); ++ int removed_by_old_offset = ++ removed_by_actions_map (&target_relax_info->action_list, ++ old_offset, FALSE); ++ new_offset = old_offset - removed_by_old_offset; + + /* Assert that we are not out of bounds. */ + old_size = bfd_get_32 (abfd, size_p); +@@ -10164,9 +10286,10 @@ relax_property_section (bfd *abfd, + + /* Recompute the new_offset, but this time don't + include any fill inserted by relaxation. */ +- act = target_relax_info->action_list.head; +- new_offset = old_offset - +- removed_by_actions (&act, old_offset, TRUE); ++ removed_by_old_offset = ++ removed_by_actions_map (&target_relax_info->action_list, ++ old_offset, TRUE); ++ new_offset = old_offset - removed_by_old_offset; + + /* If it is not unreachable and we have not yet + seen an unreachable at this address, place it +@@ -10182,8 +10305,12 @@ relax_property_section (bfd *abfd, + } + } + else +- new_size -= +- removed_by_actions (&act, old_offset + old_size, TRUE); ++ { ++ int removed_by_old_offset_size = ++ removed_by_actions_map (&target_relax_info->action_list, ++ old_offset + old_size, TRUE); ++ new_size -= removed_by_old_offset_size - removed_by_old_offset; ++ } + + if (new_size != old_size) + { +@@ -10441,14 +10568,16 @@ relax_section_symbols (bfd *abfd, asection *sec) + + if (isym->st_shndx == sec_shndx) + { +- text_action *act = relax_info->action_list.head; + bfd_vma orig_addr = isym->st_value; ++ int removed = removed_by_actions_map (&relax_info->action_list, ++ orig_addr, FALSE); + +- isym->st_value -= removed_by_actions (&act, orig_addr, FALSE); +- ++ isym->st_value -= removed; + if (ELF32_ST_TYPE (isym->st_info) == STT_FUNC) + isym->st_size -= +- removed_by_actions (&act, orig_addr + isym->st_size, FALSE); ++ removed_by_actions_map (&relax_info->action_list, ++ orig_addr + isym->st_size, FALSE) - ++ removed; + } + } + +@@ -10466,15 +10595,17 @@ relax_section_symbols (bfd *abfd, asection *sec) + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec) + { +- text_action *act = relax_info->action_list.head; + bfd_vma orig_addr = sym_hash->root.u.def.value; ++ int removed = removed_by_actions_map (&relax_info->action_list, ++ orig_addr, FALSE); + +- sym_hash->root.u.def.value -= +- removed_by_actions (&act, orig_addr, FALSE); ++ sym_hash->root.u.def.value -= removed; + + if (sym_hash->type == STT_FUNC) + sym_hash->size -= +- removed_by_actions (&act, orig_addr + sym_hash->size, FALSE); ++ removed_by_actions_map (&relax_info->action_list, ++ orig_addr + sym_hash->size, FALSE) - ++ removed; + } + } + +-- +1.8.1.4 + diff --git a/package/binutils/2.24/908-xtensa-optimize-find_removed_literal.patch b/package/binutils/2.24/908-xtensa-optimize-find_removed_literal.patch new file mode 100644 index 0000000000..96d526fe30 --- /dev/null +++ b/package/binutils/2.24/908-xtensa-optimize-find_removed_literal.patch @@ -0,0 +1,146 @@ +From 288c2b709e5e6841484e1a129eaccd299db36877 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sat, 4 Apr 2015 14:49:42 +0300 +Subject: [PATCH 3/4] xtensa: optimize find_removed_literal + +find_removed_literal uses linear search to find removed literal by its +VMA. The list of literals is fixed at that point, build an ordered index +array and use binary search instead. + +Original profile: + +% time self children called name +----------------------------------------- + 56.72 0.00 297578/669392 translate_reloc + 70.86 0.00 371814/669392 relax_section + 67.9 127.58 0.00 669392 find_removed_literal +----------------------------------------- + +Same data, after optimization: + +% time self children called name +----------------------------------------- + 0.00 0.00 297578/669392 translate_reloc + 0.00 0.00 371814/669392 relax_section + 0.0 0.00 0.00 669392 find_removed_literal + 0.00 0.00 23838/23838 map_removed_literal +----------------------------------------- + +2015-04-03 Max Filippov +bfd/ + * elf32-xtensa.c (removed_literal_map_entry): new typedef. + (removed_literal_map_entry_struct): new structure. + (removed_literal_list_struct): add new fields: n_map and map. + (map_removed_literal, removed_literal_compare): new functions. + (find_removed_literal): build index array for literals ordered + by VMA, use binary search to find removed literal. + +Backported from: 3439c466273378021821473d3fc84990e089ae34 +Signed-off-by: Max Filippov +--- + bfd/elf32-xtensa.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 58 insertions(+), 6 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 21b2871..51733ad 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -5832,6 +5832,7 @@ print_action_list (FILE *fp, text_action_list *action_list) + by the "from" offset field. */ + + typedef struct removed_literal_struct removed_literal; ++typedef struct removed_literal_map_entry_struct removed_literal_map_entry; + typedef struct removed_literal_list_struct removed_literal_list; + + struct removed_literal_struct +@@ -5841,10 +5842,19 @@ struct removed_literal_struct + removed_literal *next; + }; + ++struct removed_literal_map_entry_struct ++{ ++ bfd_vma addr; ++ removed_literal *literal; ++}; ++ + struct removed_literal_list_struct + { + removed_literal *head; + removed_literal *tail; ++ ++ unsigned n_map; ++ removed_literal_map_entry *map; + }; + + +@@ -5893,6 +5903,39 @@ add_removed_literal (removed_literal_list *removed_list, + } + } + ++static void ++map_removed_literal (removed_literal_list *removed_list) ++{ ++ unsigned n_map = 0; ++ unsigned i; ++ removed_literal_map_entry *map = NULL; ++ removed_literal *r = removed_list->head; ++ ++ for (i = 0; r; ++i, r = r->next) ++ { ++ if (i == n_map) ++ { ++ n_map = (n_map * 2) + 2; ++ map = bfd_realloc (map, n_map * sizeof (*map)); ++ } ++ map[i].addr = r->from.target_offset; ++ map[i].literal = r; ++ } ++ removed_list->map = map; ++ removed_list->n_map = i; ++} ++ ++static int ++removed_literal_compare (const void *a, const void *b) ++{ ++ const removed_literal_map_entry *pa = a; ++ const removed_literal_map_entry *pb = b; ++ ++ if (pa->addr == pb->addr) ++ return 0; ++ else ++ return pa->addr < pb->addr ? -1 : 1; ++} + + /* Check if the list of removed literals contains an entry for the + given address. Return the entry if found. */ +@@ -5900,12 +5943,21 @@ add_removed_literal (removed_literal_list *removed_list, + static removed_literal * + find_removed_literal (removed_literal_list *removed_list, bfd_vma addr) + { +- removed_literal *r = removed_list->head; +- while (r && r->from.target_offset < addr) +- r = r->next; +- if (r && r->from.target_offset == addr) +- return r; +- return NULL; ++ removed_literal_map_entry *p; ++ removed_literal *r = NULL; ++ ++ if (removed_list->map == NULL) ++ map_removed_literal (removed_list); ++ ++ p = bsearch (&addr, removed_list->map, removed_list->n_map, ++ sizeof (*removed_list->map), removed_literal_compare); ++ if (p) ++ { ++ while (p != removed_list->map && (p - 1)->addr == addr) ++ --p; ++ r = p->literal; ++ } ++ return r; + } + + +-- +1.8.1.4 + diff --git a/package/binutils/2.24/909-xtensa-replace-action-list-with-splay-tree.patch b/package/binutils/2.24/909-xtensa-replace-action-list-with-splay-tree.patch new file mode 100644 index 0000000000..3090cc21e5 --- /dev/null +++ b/package/binutils/2.24/909-xtensa-replace-action-list-with-splay-tree.patch @@ -0,0 +1,826 @@ +From e5409aedd3ee2192855018a564650ffb75c26e60 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sun, 5 Apr 2015 17:04:22 +0300 +Subject: [PATCH 4/4] xtensa: replace action list with splay tree + +text_action_add uses linear list search to order text actions list by +action VMA. The list is used at the first relaxation pass, when it's not +fixed yet. +Replace the list with splay tree from libiberty. + +Original profile: + +% time self children called name +----------------------------------------- + 0.00 0.00 14/158225 compute_text_actions + 3.62 0.00 25211/158225 remove_dead_literal + 8.42 0.00 58645/158225 coalesce_shared_literal + 10.68 0.00 74355/158225 text_action_add_proposed + 38.8 22.73 0.00 158225 text_action_add + 0.00 0.00 144527/293246 bfd_zmalloc +----------------------------------------- + +Same data, after optimization: + +% time self children called name +----------------------------------------- + 0.00 0.00 14/158225 compute_text_actions + 0.00 0.00 25211/158225 remove_dead_literal + 0.00 0.01 58645/158225 coalesce_shared_literal + 0.00 0.01 74355/158225 text_action_add_proposed + 0.1 0.00 0.02 158225 text_action_add + 0.01 0.00 144527/144527 splay_tree_insert + 0.00 0.00 144527/195130 splay_tree_lookup + 0.00 0.00 144527/293246 bfd_zmalloc +----------------------------------------- + +2015-04-03 Max Filippov +bfd/ + * elf32-xtensa.c (splay-tree.h): include header. + (text_action_struct): drop next pointer. + (text_action_list_struct): drop head pointer, add count and + tree fields. + (find_fill_action): instead of linear search in text_action_list + search in the tree. + (text_action_compare, action_first, action_next): new functions. + (text_action_add, text_action_add_literal): instead of linear + search and insertion insert new node into the tree. + (removed_by_actions): pass additional parameter: action_list, + use it to traverse the tree. + (offset_with_removed_text): pass additional action_list parameter + to removed_by_actions. + (map_action_fn_context): new typedef. + (map_action_fn_context_struct): new structure. + (map_action_fn): new function. + (map_removal_by_action): use splay_tree_foreach to build map. + (find_insn_action): replace linear search in text_action_list + with series of splay_tree_lookups. + (print_action, print_action_list_fn): new functions. + (print_action_list): use splay_tree_foreach. + (init_xtensa_relax_info): drop action_list.head initialization. + Initialize the tree. + (compute_text_actions): use non-zero action_list_count instead of + non-NULL action list. + (xlate_map_context): new typedef. + (xlate_map_context_struct): new structure. + (xlate_map_fn): new function. + (build_xlate_map): use splay_tree_foreach to build map. + (action_remove_bytes_fn): new function. + (relax_section): use zero action_list_count instead of NULL + action list. Use splay_tree_foreach to count final section size. + Drop unused variable 'removed'. + +Backported from: 4c2af04fe8b4452bf51d2debf1bb467fafcd0f08 +Signed-off-by: Max Filippov +--- + bfd/elf32-xtensa.c | 488 +++++++++++++++++++++++++++++++---------------------- + 1 file changed, 282 insertions(+), 206 deletions(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 51733ad..53af1c6 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -28,6 +28,7 @@ + #include "libbfd.h" + #include "elf-bfd.h" + #include "elf/xtensa.h" ++#include "splay-tree.h" + #include "xtensa-isa.h" + #include "xtensa-config.h" + +@@ -5416,8 +5417,6 @@ struct text_action_struct + bfd_vma virtual_offset; /* Zero except for adding literals. */ + int removed_bytes; + literal_value value; /* Only valid when adding literals. */ +- +- text_action *next; + }; + + struct removal_by_action_entry_struct +@@ -5440,7 +5439,8 @@ typedef struct removal_by_action_map_struct removal_by_action_map; + /* List of all of the actions taken on a text section. */ + struct text_action_list_struct + { +- text_action *head; ++ unsigned count; ++ splay_tree tree; + removal_by_action_map map; + }; + +@@ -5448,20 +5448,18 @@ struct text_action_list_struct + static text_action * + find_fill_action (text_action_list *l, asection *sec, bfd_vma offset) + { +- text_action **m_p; ++ text_action a; + + /* It is not necessary to fill at the end of a section. */ + if (sec->size == offset) + return NULL; + +- for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next) +- { +- text_action *t = *m_p; +- /* When the action is another fill at the same address, +- just increase the size. */ +- if (t->offset == offset && t->action == ta_fill) +- return t; +- } ++ a.offset = offset; ++ a.action = ta_fill; ++ ++ splay_tree_node node = splay_tree_lookup (l->tree, (splay_tree_key)&a); ++ if (node) ++ return (text_action *)node->value; + return NULL; + } + +@@ -5509,6 +5507,49 @@ adjust_fill_action (text_action *ta, int fill_diff) + } + + ++static int ++text_action_compare (splay_tree_key a, splay_tree_key b) ++{ ++ text_action *pa = (text_action *)a; ++ text_action *pb = (text_action *)b; ++ static const int action_priority[] = ++ { ++ [ta_fill] = 0, ++ [ta_none] = 1, ++ [ta_convert_longcall] = 2, ++ [ta_narrow_insn] = 3, ++ [ta_remove_insn] = 4, ++ [ta_remove_longcall] = 5, ++ [ta_remove_literal] = 6, ++ [ta_widen_insn] = 7, ++ [ta_add_literal] = 8, ++ }; ++ ++ if (pa->offset == pb->offset) ++ { ++ if (pa->action == pb->action) ++ return 0; ++ return action_priority[pa->action] - action_priority[pb->action]; ++ } ++ else ++ return pa->offset < pb->offset ? -1 : 1; ++} ++ ++static text_action * ++action_first (text_action_list *action_list) ++{ ++ splay_tree_node node = splay_tree_min (action_list->tree); ++ return node ? (text_action *)node->value : NULL; ++} ++ ++static text_action * ++action_next (text_action_list *action_list, text_action *action) ++{ ++ splay_tree_node node = splay_tree_successor (action_list->tree, ++ (splay_tree_key)action); ++ return node ? (text_action *)node->value : NULL; ++} ++ + /* Add a modification action to the text. For the case of adding or + removing space, modify any current fill and assume that + "unreachable_space" bytes can be freely contracted. Note that a +@@ -5521,8 +5562,8 @@ text_action_add (text_action_list *l, + bfd_vma offset, + int removed) + { +- text_action **m_p; + text_action *ta; ++ text_action a; + + /* It is not necessary to fill at the end of a section. */ + if (action == ta_fill && sec->size == offset) +@@ -5532,34 +5573,30 @@ text_action_add (text_action_list *l, + if (action == ta_fill && removed == 0) + return; + +- for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next) ++ a.action = action; ++ a.offset = offset; ++ ++ if (action == ta_fill) + { +- text_action *t = *m_p; ++ splay_tree_node node = splay_tree_lookup (l->tree, (splay_tree_key)&a); + +- if (action == ta_fill) ++ if (node) + { +- /* When the action is another fill at the same address, +- just increase the size. */ +- if (t->offset == offset && t->action == ta_fill) +- { +- t->removed_bytes += removed; +- return; +- } +- /* Fills need to happen before widens so that we don't +- insert fill bytes into the instruction stream. */ +- if (t->offset == offset && t->action == ta_widen_insn) +- break; ++ ta = (text_action *)node->value; ++ ta->removed_bytes += removed; ++ return; + } + } ++ else ++ BFD_ASSERT (splay_tree_lookup (l->tree, (splay_tree_key)&a) == NULL); + +- /* Create a new record and fill it up. */ + ta = (text_action *) bfd_zmalloc (sizeof (text_action)); + ta->action = action; + ta->sec = sec; + ta->offset = offset; + ta->removed_bytes = removed; +- ta->next = (*m_p); +- *m_p = ta; ++ splay_tree_insert (l->tree, (splay_tree_key)ta, (splay_tree_value)ta); ++ ++l->count; + } + + +@@ -5570,7 +5607,6 @@ text_action_add_literal (text_action_list *l, + const literal_value *value, + int removed) + { +- text_action **m_p; + text_action *ta; + asection *sec = r_reloc_get_section (loc); + bfd_vma offset = loc->target_offset; +@@ -5578,14 +5614,6 @@ text_action_add_literal (text_action_list *l, + + BFD_ASSERT (action == ta_add_literal); + +- for (m_p = &l->head; *m_p != NULL; m_p = &(*m_p)->next) +- { +- if ((*m_p)->offset > offset +- && ((*m_p)->offset != offset +- || (*m_p)->virtual_offset > virtual_offset)) +- break; +- } +- + /* Create a new record and fill it up. */ + ta = (text_action *) bfd_zmalloc (sizeof (text_action)); + ta->action = action; +@@ -5594,8 +5622,10 @@ text_action_add_literal (text_action_list *l, + ta->virtual_offset = virtual_offset; + ta->value = *value; + ta->removed_bytes = removed; +- ta->next = (*m_p); +- *m_p = ta; ++ ++ BFD_ASSERT (splay_tree_lookup (l->tree, (splay_tree_key)ta) == NULL); ++ splay_tree_insert (l->tree, (splay_tree_key)ta, (splay_tree_value)ta); ++ ++l->count; + } + + +@@ -5606,7 +5636,8 @@ text_action_add_literal (text_action_list *l, + so that each search may begin where the previous one left off. */ + + static int +-removed_by_actions (text_action **p_start_action, ++removed_by_actions (text_action_list *action_list, ++ text_action **p_start_action, + bfd_vma offset, + bfd_boolean before_fill) + { +@@ -5614,6 +5645,13 @@ removed_by_actions (text_action **p_start_action, + int removed = 0; + + r = *p_start_action; ++ if (r) ++ { ++ splay_tree_node node = splay_tree_lookup (action_list->tree, ++ (splay_tree_key)r); ++ BFD_ASSERT (node != NULL && r == (text_action *)node->value); ++ } ++ + while (r) + { + if (r->offset > offset) +@@ -5625,7 +5663,7 @@ removed_by_actions (text_action **p_start_action, + + removed += r->removed_bytes; + +- r = r->next; ++ r = action_next (action_list, r); + } + + *p_start_action = r; +@@ -5636,68 +5674,74 @@ removed_by_actions (text_action **p_start_action, + static bfd_vma + offset_with_removed_text (text_action_list *action_list, bfd_vma offset) + { +- text_action *r = action_list->head; +- return offset - removed_by_actions (&r, offset, FALSE); ++ text_action *r = action_first (action_list); ++ ++ return offset - removed_by_actions (action_list, &r, offset, FALSE); + } + + + static unsigned + action_list_count (text_action_list *action_list) + { +- text_action *r = action_list->head; +- unsigned count = 0; +- for (r = action_list->head; r != NULL; r = r->next) +- { +- count++; +- } +- return count; ++ return action_list->count; + } + +-static void +-map_removal_by_action (text_action_list *action_list) ++typedef struct map_action_fn_context_struct map_action_fn_context; ++struct map_action_fn_context_struct + { +- text_action *r; +- int removed = 0; ++ int removed; + removal_by_action_map map; + bfd_boolean eq_complete; ++}; + +- map.n_entries = 0; +- map.entry = bfd_malloc (action_list_count (action_list) * +- sizeof (removal_by_action_entry)); +- eq_complete = FALSE; ++static int ++map_action_fn (splay_tree_node node, void *p) ++{ ++ map_action_fn_context *ctx = p; ++ text_action *r = (text_action *)node->value; ++ removal_by_action_entry *ientry = ctx->map.entry + ctx->map.n_entries; + +- for (r = action_list->head; r;) ++ if (ctx->map.n_entries && (ientry - 1)->offset == r->offset) + { +- removal_by_action_entry *ientry = map.entry + map.n_entries; ++ --ientry; ++ } ++ else ++ { ++ ++ctx->map.n_entries; ++ ctx->eq_complete = FALSE; ++ ientry->offset = r->offset; ++ ientry->eq_removed_before_fill = ctx->removed; ++ } + +- if (map.n_entries && (ientry - 1)->offset == r->offset) ++ if (!ctx->eq_complete) ++ { ++ if (r->action != ta_fill || r->removed_bytes >= 0) + { +- --ientry; ++ ientry->eq_removed = ctx->removed; ++ ctx->eq_complete = TRUE; + } + else +- { +- ++map.n_entries; +- eq_complete = FALSE; +- ientry->offset = r->offset; +- ientry->eq_removed_before_fill = removed; +- } ++ ientry->eq_removed = ctx->removed + r->removed_bytes; ++ } + +- if (!eq_complete) +- { +- if (r->action != ta_fill || r->removed_bytes >= 0) +- { +- ientry->eq_removed = removed; +- eq_complete = TRUE; +- } +- else +- ientry->eq_removed = removed + r->removed_bytes; +- } ++ ctx->removed += r->removed_bytes; ++ ientry->removed = ctx->removed; ++ return 0; ++} + +- removed += r->removed_bytes; +- ientry->removed = removed; +- r = r->next; +- } +- action_list->map = map; ++static void ++map_removal_by_action (text_action_list *action_list) ++{ ++ map_action_fn_context ctx; ++ ++ ctx.removed = 0; ++ ctx.map.n_entries = 0; ++ ctx.map.entry = bfd_malloc (action_list_count (action_list) * ++ sizeof (removal_by_action_entry)); ++ ctx.eq_complete = FALSE; ++ ++ splay_tree_foreach (action_list->tree, map_action_fn, &ctx); ++ action_list->map = ctx.map; + } + + static int +@@ -5754,28 +5798,26 @@ offset_with_removed_text_map (text_action_list *action_list, bfd_vma offset) + static text_action * + find_insn_action (text_action_list *action_list, bfd_vma offset) + { +- text_action *t; +- for (t = action_list->head; t; t = t->next) ++ static const text_action_t action[] = + { +- if (t->offset == offset) +- { +- switch (t->action) +- { +- case ta_none: +- case ta_fill: +- break; +- case ta_remove_insn: +- case ta_remove_longcall: +- case ta_convert_longcall: +- case ta_narrow_insn: +- case ta_widen_insn: +- return t; +- case ta_remove_literal: +- case ta_add_literal: +- BFD_ASSERT (0); +- break; +- } +- } ++ ta_convert_longcall, ++ ta_remove_longcall, ++ ta_widen_insn, ++ ta_narrow_insn, ++ ta_remove_insn, ++ }; ++ text_action a; ++ unsigned i; ++ ++ a.offset = offset; ++ for (i = 0; i < sizeof (action) / sizeof (*action); ++i) ++ { ++ splay_tree_node node; ++ ++ a.action = action[i]; ++ node = splay_tree_lookup (action_list->tree, (splay_tree_key)&a); ++ if (node) ++ return (text_action *)node->value; + } + return NULL; + } +@@ -5784,40 +5826,50 @@ find_insn_action (text_action_list *action_list, bfd_vma offset) + #if DEBUG + + static void +-print_action_list (FILE *fp, text_action_list *action_list) ++print_action (FILE *fp, text_action *r) ++{ ++ const char *t = "unknown"; ++ switch (r->action) ++ { ++ case ta_remove_insn: ++ t = "remove_insn"; break; ++ case ta_remove_longcall: ++ t = "remove_longcall"; break; ++ case ta_convert_longcall: ++ t = "convert_longcall"; break; ++ case ta_narrow_insn: ++ t = "narrow_insn"; break; ++ case ta_widen_insn: ++ t = "widen_insn"; break; ++ case ta_fill: ++ t = "fill"; break; ++ case ta_none: ++ t = "none"; break; ++ case ta_remove_literal: ++ t = "remove_literal"; break; ++ case ta_add_literal: ++ t = "add_literal"; break; ++ } ++ ++ fprintf (fp, "%s: %s[0x%lx] \"%s\" %d\n", ++ r->sec->owner->filename, ++ r->sec->name, (unsigned long) r->offset, t, r->removed_bytes); ++} ++ ++static int ++print_action_list_fn (splay_tree_node node, void *p) + { +- text_action *r; ++ text_action *r = (text_action *)node->value; + +- fprintf (fp, "Text Action\n"); +- for (r = action_list->head; r != NULL; r = r->next) +- { +- const char *t = "unknown"; +- switch (r->action) +- { +- case ta_remove_insn: +- t = "remove_insn"; break; +- case ta_remove_longcall: +- t = "remove_longcall"; break; +- case ta_convert_longcall: +- t = "convert_longcall"; break; +- case ta_narrow_insn: +- t = "narrow_insn"; break; +- case ta_widen_insn: +- t = "widen_insn"; break; +- case ta_fill: +- t = "fill"; break; +- case ta_none: +- t = "none"; break; +- case ta_remove_literal: +- t = "remove_literal"; break; +- case ta_add_literal: +- t = "add_literal"; break; +- } ++ print_action (p, r); ++ return 0; ++} + +- fprintf (fp, "%s: %s[0x%lx] \"%s\" %d\n", +- r->sec->owner->filename, +- r->sec->name, (unsigned long) r->offset, t, r->removed_bytes); +- } ++static void ++print_action_list (FILE *fp, text_action_list *action_list) ++{ ++ fprintf (fp, "Text Action\n"); ++ splay_tree_foreach (action_list->tree, print_action_list_fn, fp); + } + + #endif /* DEBUG */ +@@ -6071,8 +6123,8 @@ init_xtensa_relax_info (asection *sec) + relax_info->removed_list.head = NULL; + relax_info->removed_list.tail = NULL; + +- relax_info->action_list.head = NULL; +- ++ relax_info->action_list.tree = splay_tree_new (text_action_compare, ++ NULL, NULL); + relax_info->action_list.map.n_entries = 0; + relax_info->action_list.map.entry = NULL; + +@@ -7762,7 +7814,7 @@ compute_text_actions (bfd *abfd, + free_reloc_range_list (&relevant_relocs); + + #if DEBUG +- if (relax_info->action_list.head) ++ if (action_list_count (&relax_info->action_list)) + print_action_list (stderr, &relax_info->action_list); + #endif + +@@ -8263,6 +8315,54 @@ xlate_offset_with_removed_text (const xlate_map_t *map, + return e->new_address - e->orig_address + offset; + } + ++typedef struct xlate_map_context_struct xlate_map_context; ++struct xlate_map_context_struct ++{ ++ xlate_map_t *map; ++ xlate_map_entry_t *current_entry; ++ int removed; ++}; ++ ++static int ++xlate_map_fn (splay_tree_node node, void *p) ++{ ++ text_action *r = (text_action *)node->value; ++ xlate_map_context *ctx = p; ++ unsigned orig_size = 0; ++ ++ switch (r->action) ++ { ++ case ta_none: ++ case ta_remove_insn: ++ case ta_convert_longcall: ++ case ta_remove_literal: ++ case ta_add_literal: ++ break; ++ case ta_remove_longcall: ++ orig_size = 6; ++ break; ++ case ta_narrow_insn: ++ orig_size = 3; ++ break; ++ case ta_widen_insn: ++ orig_size = 2; ++ break; ++ case ta_fill: ++ break; ++ } ++ ctx->current_entry->size = ++ r->offset + orig_size - ctx->current_entry->orig_address; ++ if (ctx->current_entry->size != 0) ++ { ++ ctx->current_entry++; ++ ctx->map->entry_count++; ++ } ++ ctx->current_entry->orig_address = r->offset + orig_size; ++ ctx->removed += r->removed_bytes; ++ ctx->current_entry->new_address = r->offset + orig_size - ctx->removed; ++ ctx->current_entry->size = 0; ++ return 0; ++} + + /* Build a binary searchable offset translation map from a section's + action list. */ +@@ -8270,75 +8370,40 @@ xlate_offset_with_removed_text (const xlate_map_t *map, + static xlate_map_t * + build_xlate_map (asection *sec, xtensa_relax_info *relax_info) + { +- xlate_map_t *map = (xlate_map_t *) bfd_malloc (sizeof (xlate_map_t)); + text_action_list *action_list = &relax_info->action_list; + unsigned num_actions = 0; +- text_action *r; +- int removed; +- xlate_map_entry_t *current_entry; ++ xlate_map_context ctx; + +- if (map == NULL) ++ ctx.map = (xlate_map_t *) bfd_malloc (sizeof (xlate_map_t)); ++ ++ if (ctx.map == NULL) + return NULL; + + num_actions = action_list_count (action_list); +- map->entry = (xlate_map_entry_t *) ++ ctx.map->entry = (xlate_map_entry_t *) + bfd_malloc (sizeof (xlate_map_entry_t) * (num_actions + 1)); +- if (map->entry == NULL) ++ if (ctx.map->entry == NULL) + { +- free (map); ++ free (ctx.map); + return NULL; + } +- map->entry_count = 0; ++ ctx.map->entry_count = 0; + +- removed = 0; +- current_entry = &map->entry[0]; ++ ctx.removed = 0; ++ ctx.current_entry = &ctx.map->entry[0]; + +- current_entry->orig_address = 0; +- current_entry->new_address = 0; +- current_entry->size = 0; ++ ctx.current_entry->orig_address = 0; ++ ctx.current_entry->new_address = 0; ++ ctx.current_entry->size = 0; + +- for (r = action_list->head; r != NULL; r = r->next) +- { +- unsigned orig_size = 0; +- switch (r->action) +- { +- case ta_none: +- case ta_remove_insn: +- case ta_convert_longcall: +- case ta_remove_literal: +- case ta_add_literal: +- break; +- case ta_remove_longcall: +- orig_size = 6; +- break; +- case ta_narrow_insn: +- orig_size = 3; +- break; +- case ta_widen_insn: +- orig_size = 2; +- break; +- case ta_fill: +- break; +- } +- current_entry->size = +- r->offset + orig_size - current_entry->orig_address; +- if (current_entry->size != 0) +- { +- current_entry++; +- map->entry_count++; +- } +- current_entry->orig_address = r->offset + orig_size; +- removed += r->removed_bytes; +- current_entry->new_address = r->offset + orig_size - removed; +- current_entry->size = 0; +- } ++ splay_tree_foreach (action_list->tree, xlate_map_fn, &ctx); + +- current_entry->size = (bfd_get_section_limit (sec->owner, sec) +- - current_entry->orig_address); +- if (current_entry->size != 0) +- map->entry_count++; ++ ctx.current_entry->size = (bfd_get_section_limit (sec->owner, sec) ++ - ctx.current_entry->orig_address); ++ if (ctx.current_entry->size != 0) ++ ctx.map->entry_count++; + +- return map; ++ return ctx.map; + } + + +@@ -9302,6 +9367,16 @@ move_shared_literal (asection *sec, + + /* Second relaxation pass. */ + ++static int ++action_remove_bytes_fn (splay_tree_node node, void *p) ++{ ++ bfd_size_type *final_size = p; ++ text_action *action = (text_action *)node->value; ++ ++ *final_size -= action->removed_bytes; ++ return 0; ++} ++ + /* Modify all of the relocations to point to the right spot, and if this + is a relaxable section, delete the unwanted literals and fix the + section size. */ +@@ -9334,7 +9409,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); +- if (!internal_relocs && !relax_info->action_list.head) ++ if (!internal_relocs && !action_list_count (&relax_info->action_list)) + return TRUE; + + contents = retrieve_contents (abfd, sec, link_info->keep_memory); +@@ -9412,6 +9487,12 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + } + /* Update the action so that the code that moves + the contents will do the right thing. */ ++ /* ta_remove_longcall and ta_remove_insn actions are ++ grouped together in the tree as well as ++ ta_convert_longcall and ta_none, so that changes below ++ can be done w/o removing and reinserting action into ++ the tree. */ ++ + if (action->action == ta_remove_longcall) + action->action = ta_remove_insn; + else +@@ -9584,13 +9665,12 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + + if ((relax_info->is_relaxable_literal_section + || relax_info->is_relaxable_asm_section) +- && relax_info->action_list.head) ++ && action_list_count (&relax_info->action_list)) + { + /* Walk through the planned actions and build up a table + of move, copy and fill records. Use the move, copy and + fill records to perform the actions once. */ + +- int removed = 0; + bfd_size_type final_size, copy_size, orig_insn_size; + bfd_byte *scratch = NULL; + bfd_byte *dup_contents = NULL; +@@ -9601,15 +9681,12 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + bfd_vma orig_dot_vo = 0; /* Virtual offset from orig_dot. */ + bfd_vma dup_dot = 0; + +- text_action *action = relax_info->action_list.head; ++ text_action *action; + + final_size = sec->size; +- for (action = relax_info->action_list.head; action; +- action = action->next) +- { +- final_size -= action->removed_bytes; +- } + ++ splay_tree_foreach (relax_info->action_list.tree, ++ action_remove_bytes_fn, &final_size); + scratch = (bfd_byte *) bfd_zmalloc (final_size); + dup_contents = (bfd_byte *) bfd_zmalloc (final_size); + +@@ -9618,8 +9695,8 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + print_action_list (stderr, &relax_info->action_list); + #endif + +- for (action = relax_info->action_list.head; action; +- action = action->next) ++ for (action = action_first (&relax_info->action_list); action; ++ action = action_next (&relax_info->action_list, action)) + { + virtual_action = FALSE; + if (action->offset > orig_dot) +@@ -9748,7 +9825,6 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) + break; + } + +- removed += action->removed_bytes; + BFD_ASSERT (dup_dot <= final_size); + BFD_ASSERT (orig_dot <= orig_size); + } +-- +1.8.1.4 + diff --git a/package/binutils/2.24/910-xtensa-optimize-trampolines-relaxation.patch b/package/binutils/2.24/910-xtensa-optimize-trampolines-relaxation.patch new file mode 100644 index 0000000000..043ff4df1e --- /dev/null +++ b/package/binutils/2.24/910-xtensa-optimize-trampolines-relaxation.patch @@ -0,0 +1,345 @@ +From cbe53e134d4c3a656880a906738ce19fdcd38e8b Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 1 May 2015 11:39:12 +0300 +Subject: [PATCH] xtensa: optimize trampolines relaxation + +Currently every fixup in the current segment is checked when relaxing +trampoline frag. This is very expensive. Make a searchable array of +fixups pointing at potentially oversized jumps at the beginning of every +relaxation pass and only check subset of this cache in the reach of +single jump from the trampoline frag currently being relaxed. + +Original profile: + +% time self children called name +----------------------------------------- + 370.16 593.38 12283048/12283048 relax_segment + 98.4 370.16 593.38 12283048 xtensa_relax_frag + 58.91 269.26 2691463834/2699602236 xtensa_insnbuf_from_chars + 68.35 68.17 811266668/813338977 S_GET_VALUE + 36.85 29.51 2684369246/2685538060 xtensa_opcode_decode + 28.34 8.84 2684369246/2685538060 xtensa_format_get_slot + 12.39 5.94 2691463834/2699775044 xtensa_format_decode + 0.03 4.60 4101109/4101109 relax_frag_for_align + 0.18 1.76 994617/994617 relax_frag_immed + 0.07 0.09 24556277/24851220 new_logical_line + 0.06 0.00 12283048/14067410 as_where + 0.04 0.00 7094588/15460506 xtensa_format_num_slots + 0.00 0.00 1/712477 xtensa_insnbuf_alloc +----------------------------------------- + +Same data, after optimization: + +% time self children called name +----------------------------------------- + 0.51 7.47 12283048/12283048 relax_segment + 58.0 0.51 7.47 12283048 xtensa_relax_frag + 0.02 4.08 4101109/4101109 relax_frag_for_align + 0.18 1.39 994617/994617 relax_frag_immed + 0.01 0.98 555/555 xtensa_cache_relaxable_fixups + 0.21 0.25 7094588/16693271 xtensa_insnbuf_from_chars + 0.06 0.12 24556277/24851220 new_logical_line + 0.06 0.00 7094588/15460506 xtensa_format_num_slots + 0.02 0.04 7094588/16866079 xtensa_format_decode + 0.05 0.00 12283048/14067410 as_where + 0.00 0.00 1/712477 xtensa_insnbuf_alloc + 0.00 0.00 93808/93808 xtensa_find_first_cached_fixup +----------------------------------------- + +2015-05-02 Max Filippov +gas/ + * config/tc-xtensa.c (cached_fixupS, fixup_cacheS): New typedefs. + (struct cached_fixup, struct fixup_cache): New structures. + (fixup_order, xtensa_make_cached_fixup), + (xtensa_realloc_fixup_cache, xtensa_cache_relaxable_fixups), + (xtensa_find_first_cached_fixup, xtensa_delete_cached_fixup), + (xtensa_add_cached_fixup): New functions. + (xtensa_relax_frag): Cache fixups pointing at potentially + oversized jumps at the beginning of every relaxation pass. Only + check subset of this cache in the reach of single jump from the + trampoline frag currently being relaxed. + +Signed-off-by: Max Filippov +--- +Backported from: b76f99d702c3501ac320396ea06bc7f9237173c3 +Changes to ChangeLog are dropped. + + gas/config/tc-xtensa.c | 220 +++++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 194 insertions(+), 26 deletions(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 3e85b69..31c0b6b 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -8785,6 +8785,154 @@ static long relax_frag_for_align (fragS *, long); + static long relax_frag_immed + (segT, fragS *, long, int, xtensa_format, int, int *, bfd_boolean); + ++typedef struct cached_fixup cached_fixupS; ++struct cached_fixup ++{ ++ int addr; ++ int target; ++ int delta; ++ fixS *fixP; ++}; ++ ++typedef struct fixup_cache fixup_cacheS; ++struct fixup_cache ++{ ++ cached_fixupS *fixups; ++ unsigned n_fixups; ++ unsigned n_max; ++ ++ segT seg; ++ fragS *first_frag; ++}; ++ ++static int fixup_order (const void *a, const void *b) ++{ ++ const cached_fixupS *pa = a; ++ const cached_fixupS *pb = b; ++ ++ if (pa->addr == pb->addr) ++ { ++ if (pa->target == pb->target) ++ { ++ if (pa->fixP->fx_r_type == pb->fixP->fx_r_type) ++ return 0; ++ return pa->fixP->fx_r_type < pb->fixP->fx_r_type ? -1 : 1; ++ } ++ return pa->target - pb->target; ++ } ++ return pa->addr - pb->addr; ++} ++ ++static bfd_boolean xtensa_make_cached_fixup (cached_fixupS *o, fixS *fixP) ++{ ++ xtensa_isa isa = xtensa_default_isa; ++ int addr = fixP->fx_frag->fr_address; ++ int target; ++ int delta; ++ symbolS *s = fixP->fx_addsy; ++ int slot; ++ xtensa_format fmt; ++ xtensa_opcode opcode; ++ ++ if (fixP->fx_r_type < BFD_RELOC_XTENSA_SLOT0_OP || ++ fixP->fx_r_type > BFD_RELOC_XTENSA_SLOT14_OP) ++ return FALSE; ++ target = S_GET_VALUE (s); ++ delta = target - addr; ++ ++ if (abs(delta) < J_RANGE / 2) ++ return FALSE; ++ ++ xtensa_insnbuf_from_chars (isa, trampoline_buf, ++ (unsigned char *) fixP->fx_frag->fr_literal + ++ fixP->fx_where, 0); ++ fmt = xtensa_format_decode (isa, trampoline_buf); ++ gas_assert (fmt != XTENSA_UNDEFINED); ++ slot = fixP->tc_fix_data.slot; ++ xtensa_format_get_slot (isa, fmt, slot, trampoline_buf, trampoline_slotbuf); ++ opcode = xtensa_opcode_decode (isa, fmt, slot, trampoline_slotbuf); ++ if (opcode != xtensa_j_opcode) ++ return FALSE; ++ ++ o->addr = addr; ++ o->target = target; ++ o->delta = delta; ++ o->fixP = fixP; ++ ++ return TRUE; ++} ++ ++static void xtensa_realloc_fixup_cache (fixup_cacheS *cache, unsigned add) ++{ ++ if (cache->n_fixups + add > cache->n_max) ++ { ++ cache->n_max = (cache->n_fixups + add) * 2; ++ cache->fixups = xrealloc (cache->fixups, ++ sizeof (*cache->fixups) * cache->n_max); ++ } ++} ++ ++static void xtensa_cache_relaxable_fixups (fixup_cacheS *cache, ++ segment_info_type *seginfo) ++{ ++ fixS *fixP; ++ ++ cache->n_fixups = 0; ++ ++ for (fixP = seginfo->fix_root; fixP ; fixP = fixP->fx_next) ++ { ++ xtensa_realloc_fixup_cache (cache, 1); ++ ++ if (xtensa_make_cached_fixup (cache->fixups + cache->n_fixups, fixP)) ++ ++cache->n_fixups; ++ } ++ qsort (cache->fixups, cache->n_fixups, sizeof (*cache->fixups), fixup_order); ++} ++ ++static unsigned xtensa_find_first_cached_fixup (const fixup_cacheS *cache, ++ int addr) ++{ ++ unsigned a = 0; ++ unsigned b = cache->n_fixups; ++ ++ while (b - a > 1) ++ { ++ unsigned c = (a + b) / 2; ++ ++ if (cache->fixups[c].addr < addr) ++ a = c; ++ else ++ b = c; ++ } ++ return a; ++} ++ ++static void xtensa_delete_cached_fixup (fixup_cacheS *cache, unsigned i) ++{ ++ memmove (cache->fixups + i, cache->fixups + i + 1, ++ (cache->n_fixups - i - 1) * sizeof (*cache->fixups)); ++ --cache->n_fixups; ++} ++ ++static bfd_boolean xtensa_add_cached_fixup (fixup_cacheS *cache, fixS *fixP) ++{ ++ cached_fixupS o; ++ unsigned i; ++ ++ if (!xtensa_make_cached_fixup (&o, fixP)) ++ return FALSE; ++ xtensa_realloc_fixup_cache (cache, 1); ++ i = xtensa_find_first_cached_fixup (cache, o.addr); ++ if (i < cache->n_fixups) ++ { ++ ++i; ++ memmove (cache->fixups + i + 1, cache->fixups + i, ++ (cache->n_fixups - i) * sizeof (*cache->fixups)); ++ } ++ cache->fixups[i] = o; ++ ++cache->n_fixups; ++ return TRUE; ++} + + /* Return the number of bytes added to this fragment, given that the + input has been stretched already by "stretch". */ +@@ -8896,35 +9044,42 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + case RELAX_TRAMPOLINE: + if (fragP->tc_frag_data.relax_seen) + { +- segment_info_type *seginfo = seg_info (now_seg); +- fragS *fP; /* The out-of-range jump. */ +- fixS *fixP; ++ static fixup_cacheS fixup_cache; ++ segment_info_type *seginfo = seg_info (now_seg); ++ int trampaddr = fragP->fr_address + fragP->fr_fix; ++ int searchaddr = trampaddr < J_RANGE ? 0 : trampaddr - J_RANGE; ++ unsigned i; ++ ++ if (now_seg != fixup_cache.seg || ++ fragP == fixup_cache.first_frag || ++ fixup_cache.first_frag == NULL) ++ { ++ xtensa_cache_relaxable_fixups (&fixup_cache, seginfo); ++ fixup_cache.seg = now_seg; ++ fixup_cache.first_frag = fragP; ++ } + + /* Scan for jumps that will not reach. */ +- for (fixP = seginfo->fix_root; fixP ; fixP = fixP->fx_next) ++ for (i = xtensa_find_first_cached_fixup (&fixup_cache, searchaddr); ++ i < fixup_cache.n_fixups; ++i) ++ + { +- symbolS *s = fixP->fx_addsy; +- xtensa_opcode opcode; +- int target; +- int addr; +- int delta; +- +- if (fixP->fx_r_type < BFD_RELOC_XTENSA_SLOT0_OP || +- fixP->fx_r_type > BFD_RELOC_XTENSA_SLOT14_OP) +- continue; +- xtensa_insnbuf_from_chars (isa, trampoline_buf, +- (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where, +- 0); +- fmt = xtensa_format_decode (isa, trampoline_buf); +- gas_assert (fmt != XTENSA_UNDEFINED); +- slot = fixP->tc_fix_data.slot; +- xtensa_format_get_slot (isa, fmt, slot, trampoline_buf, trampoline_slotbuf); +- opcode = xtensa_opcode_decode (isa, fmt, slot, trampoline_slotbuf); +- if (opcode != xtensa_j_opcode) ++ fixS *fixP = fixup_cache.fixups[i].fixP; ++ int target = fixup_cache.fixups[i].target; ++ int addr = fixup_cache.fixups[i].addr; ++ int delta = fixup_cache.fixups[i].delta + stretch; ++ ++ trampaddr = fragP->fr_address + fragP->fr_fix; ++ ++ if (addr + J_RANGE < trampaddr) + continue; +- target = S_GET_VALUE (s); +- addr = fixP->fx_frag->fr_address; +- delta = target - addr + stretch; ++ if (addr > trampaddr + J_RANGE) ++ break; ++ if (abs (delta) < J_RANGE) ++ continue; ++ ++ slot = fixP->tc_fix_data.slot; ++ + if (delta > J_RANGE || delta < -1 * J_RANGE) + { /* Found an out-of-range jump; scan the list of trampolines for the best match. */ + struct trampoline_seg *ts = find_trampoline_seg (now_seg); +@@ -8978,14 +9133,13 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + } + if (tf->fragP == fragP) + { +- int trampaddr = fragP->fr_address + fragP->fr_fix; +- + if (abs (addr - trampaddr) < J_RANGE) + { /* The trampoline is in range of original; fix it! */ + fixS *newfixP; + int offset; + TInsn insn; + symbolS *lsym; ++ fragS *fP; /* The out-of-range jump. */ + + new_stretch += init_trampoline_frag (tf); + offset = fragP->fr_fix; /* Where to assemble the j insn. */ +@@ -9009,10 +9163,20 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + newfixP->tc_fix_data.X_add_symbol = lsym; + newfixP->tc_fix_data.X_add_number = offset; + newfixP->tc_fix_data.slot = slot; ++ ++ xtensa_delete_cached_fixup (&fixup_cache, i); ++ xtensa_add_cached_fixup (&fixup_cache, newfixP); ++ + /* Move the fix-up from the original j insn to this one. */ + fixP->fx_frag = fragP; + fixP->fx_where = fragP->fr_fix - 3; + fixP->tc_fix_data.slot = 0; ++ ++ xtensa_add_cached_fixup (&fixup_cache, fixP); ++ ++ /* re-do current fixup */ ++ --i; ++ + /* Adjust the jump around this trampoline (if present). */ + if (tf->fixP != NULL) + { +@@ -9027,6 +9191,8 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + fragP->fr_subtype = 0; + /* Remove from the trampoline_list. */ + prev->next = tf->next; ++ if (fragP == fixup_cache.first_frag) ++ fixup_cache.first_frag = NULL; + break; + } + } +-- +1.8.1.4 + diff --git a/package/binutils/2.24/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch b/package/binutils/2.24/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch new file mode 100644 index 0000000000..9ad6b3be05 --- /dev/null +++ b/package/binutils/2.24/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch @@ -0,0 +1,57 @@ +From 8ec76b16f62d1bf386fb2c39af5f66c3afddc5cb Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 14 May 2015 05:22:55 +0300 +Subject: [PATCH] xtensa: fix localized symbol refcounting with --gc-sections + +elf_xtensa_gc_sweep_hook doesn't correctly unreference symbols that were +made local, that results in link failure with the following message: + + BFD (GNU Binutils) 2.24 internal error, aborting at elf32-xtensa.c line + 3372 in elf_xtensa_finish_dynamic_sections + +elf_xtensa_gc_sweep_hook determines symbol reference type (PLT or GOT) by +relocation type. Relocation types are not changed when symbol becomes +local, but its PLT references are added to GOT references and +plt.refcount is set to 0. Such symbol cannot be unreferences in the +elf_xtensa_gc_sweep_hook and its extra references make calculated GOT +relocations section size not match number of GOT relocations. + +Fix it by treating PLT reference as GOT reference when plt.refcount is +not positive. + +2015-05-14 Max Filippov +bfd/ + * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Treat PLT reference + as GOT reference when plt.refcount is not positive. + +Signed-off-by: Max Filippov +--- +Backported from: e6c9a083ec5ae7a45bd71682b26aae1939849388 +Changes to ChangeLog are dropped. + + bfd/elf32-xtensa.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index 53af1c6..2523670 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -1360,10 +1360,14 @@ elf_xtensa_gc_sweep_hook (bfd *abfd, + { + if (is_plt) + { ++ /* If the symbol has been localized its plt.refcount got moved ++ to got.refcount. Handle it as GOT. */ + if (h->plt.refcount > 0) + h->plt.refcount--; ++ else ++ is_got = TRUE; + } +- else if (is_got) ++ if (is_got) + { + if (h->got.refcount > 0) + h->got.refcount--; +-- +1.8.1.4 + diff --git a/package/binutils/2.24/912-xtensa-fix-gas-segfault-with-text-section-literals.patch b/package/binutils/2.24/912-xtensa-fix-gas-segfault-with-text-section-literals.patch new file mode 100644 index 0000000000..4a3de2c839 --- /dev/null +++ b/package/binutils/2.24/912-xtensa-fix-gas-segfault-with-text-section-literals.patch @@ -0,0 +1,56 @@ +From 2d0522e76e4afeeb2e104e0a4332d94fa0d2fbf6 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sun, 17 May 2015 06:46:15 +0300 +Subject: [PATCH] xtensa: fix gas segfault with --text-section-literals + +When --text-section-literals is used and code in the .init or .fini +emits literal in the absence of .literal_position, xtensa_move_literals +segfaults. + +Check that search_frag is non-NULL in the xtensa_move_literals and +report error otherwise. + +2015-05-26 Max Filippov +gas/ + * config/tc-xtensa.c (xtensa_move_literals): Check that + search_frag is non-NULL. Report error if literal frag is not + found. + +Signed-off-by: Max Filippov +--- +Backported from: 4de0562a4c69fef4952aa7e19d7bda359f02e8b4 +Changes to ChangeLog are dropped. + + gas/config/tc-xtensa.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 31c0b6b..18307c1 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -10808,13 +10808,21 @@ xtensa_move_literals (void) + frchain_to = NULL; + frag_splice = &(frchain_from->frch_root); + +- while (!search_frag->tc_frag_data.literal_frag) ++ while (search_frag && !search_frag->tc_frag_data.literal_frag) + { + gas_assert (search_frag->fr_fix == 0 + || search_frag->fr_type == rs_align); + search_frag = search_frag->fr_next; + } + ++ if (!search_frag) ++ { ++ search_frag = frchain_from->frch_root; ++ as_bad_where (search_frag->fr_file, search_frag->fr_line, ++ _("literal pool location required for text-section-literals; specify with .literal_position")); ++ continue; ++ } ++ + gas_assert (search_frag->tc_frag_data.literal_frag->fr_subtype + == RELAX_LITERAL_POOL_BEGIN); + xtensa_switch_section_emit_state (&state, segment->seg, 0); +-- +1.8.1.4 + diff --git a/package/binutils/2.24/913-xtensa-add-auto-litpools-option.patch b/package/binutils/2.24/913-xtensa-add-auto-litpools-option.patch new file mode 100644 index 0000000000..f0199e1e2a --- /dev/null +++ b/package/binutils/2.24/913-xtensa-add-auto-litpools-option.patch @@ -0,0 +1,698 @@ +From 978adaaa4cd3921842e2be8a31c05f081fb17fcf Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Wed, 29 Jul 2015 17:42:54 +0300 +Subject: [PATCH] xtensa: add --auto-litpools option + +Auto-litpools is the automated version of text-section-literals: literal +pool candidate frags are planted every N frags and during relaxation +they are turned into actual literal pools where literals are moved to +become reachable for their first reference by L32R instruction. + +2015-08-12 David Weatherford +gas/ + * config/tc-xtensa.c (struct litpool_frag, struct litpool_seg): + New structures. + (xtensa_maybe_create_literal_pool_frag): New function. + (litpool_seg_list, auto_litpools, auto_litpool_limit) + (litpool_buf, litpool_slotbuf): New static variables. + (option_auto_litpools, option_no_auto_litpools) + (option_auto_litpool_limit): New enum identifiers. + (md_longopts): Add entries for auto-litpools, no-auto-litpools + and auto-litpool-limit. + (md_parse_option): Handle option_auto_litpools, + option_no_auto_litpools and option_auto_litpool_limit. + (md_show_usage): Add help for --[no-]auto-litpools and + --auto-litpool-limit. + (xtensa_mark_literal_pool_location): Record a place for literal + pool with a call to xtensa_maybe_create_literal_pool_frag. + (get_literal_pool_location): Find highest priority literal pool + or convert candidate to literal pool when auto-litpools are used. + (xg_assemble_vliw_tokens): Create literal pool after jump + instruction. + (xtensa_check_frag_count): Create candidate literal pool every + auto_litpool_limit frags. + (xtensa_relax_frag): Add jump around literals to non-empty + literal pool. + (xtensa_move_literals): Estimate literal pool addresses and move + unreachable literals closer to their users, converting candidate + to literal pool if needed. + (xtensa_switch_to_non_abs_literal_fragment): Only emit error + about missing .literal_position in case auto-litpools are not + used. + * config/tc-xtensa.h (xtensa_relax_statesE): New relaxation + state: RELAX_LITERAL_POOL_CANDIDATE_BEGIN. + +2015-08-12 Max Filippov +gas/testsuite/ + * gas/xtensa/all.exp: Add auto-litpools to the list of xtensa + tests. + * gas/xtensa/auto-litpools.s: New file: auto-litpools test. + * gas/xtensa/auto-litpools.s: New file: auto-litpools test + result pattern. + +Signed-off-by: Max Filippov +--- +Backported from: b46824bd49648c575372e6d9bc6a6defeabd6ed5 +Changes to ChangeLogs and documentation are dropped. + + gas/config/tc-xtensa.c | 432 ++++++++++++++++++++++++++++++- + gas/config/tc-xtensa.h | 1 + + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/auto-litpools.d | 12 + + gas/testsuite/gas/xtensa/auto-litpools.s | 13 + + 5 files changed, 454 insertions(+), 5 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/auto-litpools.d + create mode 100644 gas/testsuite/gas/xtensa/auto-litpools.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 7311a05..b8b1e7d 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -440,6 +440,29 @@ bfd_boolean directive_state[] = + #endif + }; + ++/* A circular list of all potential and actual literal pool locations ++ in a segment. */ ++struct litpool_frag ++{ ++ struct litpool_frag *next; ++ struct litpool_frag *prev; ++ fragS *fragP; ++ addressT addr; ++ short priority; /* 1, 2, or 3 -- 1 is highest */ ++ short original_priority; ++}; ++ ++/* Map a segment to its litpool_frag list. */ ++struct litpool_seg ++{ ++ struct litpool_seg *next; ++ asection *seg; ++ struct litpool_frag frag_list; ++ int frag_count; /* since last litpool location */ ++}; ++ ++static struct litpool_seg litpool_seg_list; ++ + + /* Directive functions. */ + +@@ -474,6 +497,9 @@ static void xtensa_create_trampoline_frag (bfd_boolean); + static void xtensa_maybe_create_trampoline_frag (void); + struct trampoline_frag; + static int init_trampoline_frag (struct trampoline_frag *); ++static void xtensa_maybe_create_literal_pool_frag (bfd_boolean, bfd_boolean); ++static bfd_boolean auto_litpools = FALSE; ++static int auto_litpool_limit = 10000; + + /* Alignment Functions. */ + +@@ -698,6 +724,10 @@ enum + + option_trampolines, + option_no_trampolines, ++ ++ option_auto_litpools, ++ option_no_auto_litpools, ++ option_auto_litpool_limit, + }; + + const char *md_shortopts = ""; +@@ -773,6 +803,10 @@ struct option md_longopts[] = + { "trampolines", no_argument, NULL, option_trampolines }, + { "no-trampolines", no_argument, NULL, option_no_trampolines }, + ++ { "auto-litpools", no_argument, NULL, option_auto_litpools }, ++ { "no-auto-litpools", no_argument, NULL, option_no_auto_litpools }, ++ { "auto-litpool-limit", required_argument, NULL, option_auto_litpool_limit }, ++ + { NULL, no_argument, NULL, 0 } + }; + +@@ -961,6 +995,34 @@ md_parse_option (int c, char *arg) + use_trampolines = FALSE; + return 1; + ++ case option_auto_litpools: ++ auto_litpools = TRUE; ++ use_literal_section = FALSE; ++ return 1; ++ ++ case option_no_auto_litpools: ++ auto_litpools = FALSE; ++ auto_litpool_limit = -1; ++ return 1; ++ ++ case option_auto_litpool_limit: ++ { ++ int value = 0; ++ if (auto_litpool_limit < 0) ++ as_fatal (_("no-auto-litpools is incompatible with auto-litpool-limit")); ++ if (*arg == 0 || *arg == '-') ++ as_fatal (_("invalid auto-litpool-limit argument")); ++ value = strtol (arg, &arg, 10); ++ if (*arg != 0) ++ as_fatal (_("invalid auto-litpool-limit argument")); ++ if (value < 100 || value > 10000) ++ as_fatal (_("invalid auto-litpool-limit argument (range is 100-10000)")); ++ auto_litpool_limit = value; ++ auto_litpools = TRUE; ++ use_literal_section = FALSE; ++ return 1; ++ } ++ + default: + return 0; + } +@@ -986,7 +1048,12 @@ Xtensa options:\n\ + flix bundles\n\ + --rename-section old=new Rename section 'old' to 'new'\n\ + --[no-]trampolines [Do not] generate trampolines (jumps to jumps)\n\ +- when jumps do not reach their targets\n", stream); ++ when jumps do not reach their targets\n\ ++ --[no-]auto-litpools [Do not] automatically create literal pools\n\ ++ --auto-litpool-limit=\n\ ++ (range 100-10000) Maximum number of blocks of\n\ ++ instructions to emit between literal pool\n\ ++ locations; implies --auto-litpools flag\n", stream); + } + + +@@ -4728,6 +4795,8 @@ xtensa_mark_literal_pool_location (void) + pool_location = frag_now; + frag_now->tc_frag_data.lit_frchain = frchain_now; + frag_now->tc_frag_data.literal_frag = frag_now; ++ /* Just record this frag. */ ++ xtensa_maybe_create_literal_pool_frag (FALSE, FALSE); + frag_variant (rs_machine_dependent, 0, 0, + RELAX_LITERAL_POOL_BEGIN, NULL, 0, NULL); + xtensa_set_frag_assembly_state (frag_now); +@@ -4832,6 +4901,31 @@ get_expanded_loop_offset (xtensa_opcode opcode) + static fragS * + get_literal_pool_location (segT seg) + { ++ struct litpool_seg *lps = litpool_seg_list.next; ++ struct litpool_frag *lpf; ++ for ( ; lps && lps->seg->id != seg->id; lps = lps->next) ++ ; ++ if (lps) ++ { ++ for (lpf = lps->frag_list.prev; lpf->fragP; lpf = lpf->prev) ++ { /* Skip "candidates" for now. */ ++ if (lpf->fragP->fr_subtype == RELAX_LITERAL_POOL_BEGIN && ++ lpf->priority == 1) ++ return lpf->fragP; ++ } ++ /* Must convert a lower-priority pool. */ ++ for (lpf = lps->frag_list.prev; lpf->fragP; lpf = lpf->prev) ++ { ++ if (lpf->fragP->fr_subtype == RELAX_LITERAL_POOL_BEGIN) ++ return lpf->fragP; ++ } ++ /* Still no match -- try for a low priority pool. */ ++ for (lpf = lps->frag_list.prev; lpf->fragP; lpf = lpf->prev) ++ { ++ if (lpf->fragP->fr_subtype == RELAX_LITERAL_POOL_CANDIDATE_BEGIN) ++ return lpf->fragP; ++ } ++ } + return seg_info (seg)->tc_segment_info_data.literal_pool_loc; + } + +@@ -7098,6 +7192,11 @@ xg_assemble_vliw_tokens (vliw_insn *vinsn) + frag_now->tc_frag_data.slot_symbols[slot] = tinsn->symbol; + frag_now->tc_frag_data.slot_offsets[slot] = tinsn->offset; + frag_now->tc_frag_data.literal_frags[slot] = tinsn->literal_frag; ++ if (tinsn->opcode == xtensa_l32r_opcode) ++ { ++ frag_now->tc_frag_data.literal_frags[slot] = ++ tinsn->tok[1].X_add_symbol->sy_frag; ++ } + if (tinsn->literal_space != 0) + xg_assemble_literal_space (tinsn->literal_space, slot); + frag_now->tc_frag_data.free_reg[slot] = tinsn->extra_arg; +@@ -7170,6 +7269,8 @@ xg_assemble_vliw_tokens (vliw_insn *vinsn) + frag_now->fr_symbol, frag_now->fr_offset, NULL); + xtensa_set_frag_assembly_state (frag_now); + xtensa_maybe_create_trampoline_frag (); ++ /* Always create one here. */ ++ xtensa_maybe_create_literal_pool_frag (TRUE, FALSE); + } + else if (is_branch && do_align_targets ()) + { +@@ -7314,11 +7415,18 @@ xtensa_check_frag_count (void) + clear_frag_count (); + unreachable_count = 0; + } ++ ++ /* We create an area for a possible literal pool every N (default 5000) ++ frags or so. */ ++ xtensa_maybe_create_literal_pool_frag (TRUE, TRUE); + } + + static xtensa_insnbuf trampoline_buf = NULL; + static xtensa_insnbuf trampoline_slotbuf = NULL; + ++static xtensa_insnbuf litpool_buf = NULL; ++static xtensa_insnbuf litpool_slotbuf = NULL; ++ + #define TRAMPOLINE_FRAG_SIZE 3000 + + static void +@@ -7410,6 +7518,135 @@ dump_trampolines (void) + } + } + ++static void dump_litpools (void) __attribute__ ((unused)); ++ ++static void ++dump_litpools (void) ++{ ++ struct litpool_seg *lps = litpool_seg_list.next; ++ struct litpool_frag *lpf; ++ ++ for ( ; lps ; lps = lps->next ) ++ { ++ printf("litpool seg %s\n", lps->seg->name); ++ for ( lpf = lps->frag_list.next; lpf->fragP; lpf = lpf->next ) ++ { ++ fragS *litfrag = lpf->fragP->fr_next; ++ int count = 0; ++ while (litfrag && litfrag->fr_subtype != RELAX_LITERAL_POOL_END) ++ { ++ if (litfrag->fr_fix == 4) ++ count++; ++ litfrag = litfrag->fr_next; ++ } ++ printf(" %ld <%d:%d> (%d) [%d]: ", ++ lpf->addr, lpf->priority, lpf->original_priority, ++ lpf->fragP->fr_line, count); ++ //dump_frag(lpf->fragP); ++ } ++ } ++} ++ ++static void ++xtensa_maybe_create_literal_pool_frag (bfd_boolean create, ++ bfd_boolean only_if_needed) ++{ ++ struct litpool_seg *lps = litpool_seg_list.next; ++ fragS *fragP; ++ struct litpool_frag *lpf; ++ bfd_boolean needed = FALSE; ++ ++ if (use_literal_section || !auto_litpools) ++ return; ++ ++ for ( ; lps ; lps = lps->next ) ++ { ++ if (lps->seg == now_seg) ++ break; ++ } ++ ++ if (lps == NULL) ++ { ++ lps = (struct litpool_seg *)xcalloc (sizeof (struct litpool_seg), 1); ++ lps->next = litpool_seg_list.next; ++ litpool_seg_list.next = lps; ++ lps->seg = now_seg; ++ lps->frag_list.next = &lps->frag_list; ++ lps->frag_list.prev = &lps->frag_list; ++ } ++ ++ lps->frag_count++; ++ ++ if (create) ++ { ++ if (only_if_needed) ++ { ++ if (past_xtensa_end || !use_transform() || ++ frag_now->tc_frag_data.is_no_transform) ++ { ++ return; ++ } ++ if (auto_litpool_limit <= 0) ++ { ++ /* Don't create a litpool based only on frag count. */ ++ return; ++ } ++ else if (lps->frag_count > auto_litpool_limit) ++ { ++ needed = TRUE; ++ } ++ else ++ { ++ return; ++ } ++ } ++ else ++ { ++ needed = TRUE; ++ } ++ } ++ ++ if (needed) ++ { ++ int size = (only_if_needed) ? 3 : 0; /* Space for a "j" insn. */ ++ /* Create a potential site for a literal pool. */ ++ frag_wane (frag_now); ++ frag_new (0); ++ xtensa_set_frag_assembly_state (frag_now); ++ fragP = frag_now; ++ fragP->tc_frag_data.lit_frchain = frchain_now; ++ fragP->tc_frag_data.literal_frag = fragP; ++ frag_var (rs_machine_dependent, size, size, ++ (only_if_needed) ? ++ RELAX_LITERAL_POOL_CANDIDATE_BEGIN : ++ RELAX_LITERAL_POOL_BEGIN, ++ NULL, 0, NULL); ++ frag_now->tc_frag_data.lit_seg = now_seg; ++ frag_variant (rs_machine_dependent, 0, 0, ++ RELAX_LITERAL_POOL_END, NULL, 0, NULL); ++ xtensa_set_frag_assembly_state (frag_now); ++ } ++ else ++ { ++ /* RELAX_LITERAL_POOL_BEGIN frag is being created; ++ just record it here. */ ++ fragP = frag_now; ++ } ++ ++ lpf = (struct litpool_frag *)xmalloc(sizeof (struct litpool_frag)); ++ /* Insert at tail of circular list. */ ++ lpf->addr = 0; ++ lps->frag_list.prev->next = lpf; ++ lpf->next = &lps->frag_list; ++ lpf->prev = lps->frag_list.prev; ++ lps->frag_list.prev = lpf; ++ lpf->fragP = fragP; ++ lpf->priority = (needed) ? (only_if_needed) ? 3 : 2 : 1; ++ lpf->original_priority = lpf->priority; ++ ++ lps->frag_count = 0; ++} ++ + static void + xtensa_cleanup_align_frags (void) + { +@@ -9029,7 +9266,41 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) + break; + + case RELAX_LITERAL_POOL_BEGIN: ++ if (fragP->fr_var != 0) ++ { ++ /* We have a converted "candidate" literal pool; ++ assemble a jump around it. */ ++ TInsn insn; ++ if (!litpool_slotbuf) ++ { ++ litpool_buf = xtensa_insnbuf_alloc (isa); ++ litpool_slotbuf = xtensa_insnbuf_alloc (isa); ++ } ++ new_stretch += 3; ++ fragP->tc_frag_data.relax_seen = FALSE; /* Need another pass. */ ++ fragP->tc_frag_data.is_insn = TRUE; ++ tinsn_init (&insn); ++ insn.insn_type = ITYPE_INSN; ++ insn.opcode = xtensa_j_opcode; ++ insn.ntok = 1; ++ set_expr_symbol_offset (&insn.tok[0], fragP->fr_symbol, ++ fragP->fr_fix); ++ fmt = xg_get_single_format (xtensa_j_opcode); ++ tinsn_to_slotbuf (fmt, 0, &insn, litpool_slotbuf); ++ xtensa_format_set_slot (isa, fmt, 0, litpool_buf, litpool_slotbuf); ++ xtensa_insnbuf_to_chars (isa, litpool_buf, ++ (unsigned char *)fragP->fr_literal + ++ fragP->fr_fix, 3); ++ fragP->fr_fix += 3; ++ fragP->fr_var -= 3; ++ /* Add a fix-up. */ ++ fix_new (fragP, 0, 3, fragP->fr_symbol, 0, TRUE, ++ BFD_RELOC_XTENSA_SLOT0_OP); ++ } ++ break; ++ + case RELAX_LITERAL_POOL_END: ++ case RELAX_LITERAL_POOL_CANDIDATE_BEGIN: + case RELAX_MAYBE_UNREACHABLE: + case RELAX_MAYBE_DESIRE_ALIGN: + /* No relaxation required. */ +@@ -10789,12 +11060,115 @@ xtensa_move_literals (void) + segT dest_seg; + fixS *fix, *next_fix, **fix_splice; + sym_list *lit; ++ struct litpool_seg *lps; + + mark_literal_frags (literal_head->next); + + if (use_literal_section) + return; + ++ /* Assign addresses (rough estimates) to the potential literal pool locations ++ and create new ones if the gaps are too large. */ ++ ++ for (lps = litpool_seg_list.next; lps; lps = lps->next) ++ { ++ frchainS *frchP = seg_info (lps->seg)->frchainP; ++ struct litpool_frag *lpf = lps->frag_list.next; ++ addressT addr = 0; ++ ++ for ( ; frchP; frchP = frchP->frch_next) ++ { ++ fragS *fragP; ++ for (fragP = frchP->frch_root; fragP; fragP = fragP->fr_next) ++ { ++ if (lpf && fragP == lpf->fragP) ++ { ++ gas_assert(fragP->fr_type == rs_machine_dependent && ++ (fragP->fr_subtype == RELAX_LITERAL_POOL_BEGIN || ++ fragP->fr_subtype == RELAX_LITERAL_POOL_CANDIDATE_BEGIN)); ++ /* Found a litpool location. */ ++ lpf->addr = addr; ++ lpf = lpf->next; ++ } ++ if (fragP->fr_type == rs_machine_dependent && ++ fragP->fr_subtype == RELAX_SLOTS) ++ { ++ int slot; ++ for (slot = 0; slot < MAX_SLOTS; slot++) ++ { ++ if (fragP->tc_frag_data.literal_frags[slot]) ++ { ++ /* L32R; point its literal to the nearest litpool ++ preferring non-"candidate" positions to avoid ++ the jump-around. */ ++ fragS *litfrag = fragP->tc_frag_data.literal_frags[slot]; ++ struct litpool_frag *lp = lpf->prev; ++ if (!lp->fragP) ++ { ++ break; ++ } ++ while (lp->fragP->fr_subtype == ++ RELAX_LITERAL_POOL_CANDIDATE_BEGIN) ++ { ++ lp = lp->prev; ++ if (lp->fragP == NULL) ++ { ++ /* End of list; have to bite the bullet. ++ Take the nearest. */ ++ lp = lpf->prev; ++ break; ++ } ++ /* Does it (conservatively) reach? */ ++ if (addr - lp->addr <= 128 * 1024) ++ { ++ if (lp->fragP->fr_subtype == RELAX_LITERAL_POOL_BEGIN) ++ { ++ /* Found a good one. */ ++ break; ++ } ++ else if (lp->prev->fragP && ++ addr - lp->prev->addr > 128 * 1024) ++ { ++ /* This is still a "candidate" but the next one ++ will be too far away, so revert to the nearest ++ one, convert it and add the jump around. */ ++ fragS *poolbeg; ++ fragS *poolend; ++ symbolS *lsym; ++ char label[10 + 2 * sizeof (fragS *)]; ++ lp = lpf->prev; ++ poolbeg = lp->fragP; ++ lp->priority = 1; ++ poolbeg->fr_subtype = RELAX_LITERAL_POOL_BEGIN; ++ poolend = poolbeg->fr_next; ++ gas_assert (poolend->fr_type == rs_machine_dependent && ++ poolend->fr_subtype == RELAX_LITERAL_POOL_END); ++ /* Create a local symbol pointing to the ++ end of the pool. */ ++ sprintf (label, ".L0_LT_%p", poolbeg); ++ lsym = (symbolS *)local_symbol_make (label, lps->seg, ++ 0, poolend); ++ poolbeg->fr_symbol = lsym; ++ /* Rest is done in xtensa_relax_frag. */ ++ } ++ } ++ } ++ if (! litfrag->tc_frag_data.literal_frag) ++ { ++ /* Take earliest use of this literal to avoid ++ forward refs. */ ++ litfrag->tc_frag_data.literal_frag = lp->fragP; ++ } ++ } ++ } ++ } ++ addr += fragP->fr_fix; ++ if (fragP->fr_type == rs_fill) ++ addr += fragP->fr_offset; ++ } ++ } ++ } ++ + for (segment = literal_head->next; segment; segment = segment->next) + { + /* Keep the literals for .init and .fini in separate sections. */ +@@ -10839,9 +11213,6 @@ xtensa_move_literals (void) + while (search_frag != frag_now) + { + next_frag = search_frag->fr_next; +- +- /* First, move the frag out of the literal section and +- to the appropriate place. */ + if (search_frag->tc_frag_data.literal_frag) + { + literal_pool = search_frag->tc_frag_data.literal_frag; +@@ -10849,8 +11220,56 @@ xtensa_move_literals (void) + frchain_to = literal_pool->tc_frag_data.lit_frchain; + gas_assert (frchain_to); + } ++ ++ if (search_frag->fr_type == rs_fill && search_frag->fr_fix == 0) ++ { ++ /* Skip empty fill frags. */ ++ *frag_splice = next_frag; ++ search_frag = next_frag; ++ continue; ++ } ++ ++ if (search_frag->fr_type == rs_align) ++ { ++ /* Skip alignment frags, because the pool as a whole will be ++ aligned if used, and we don't want to force alignment if the ++ pool is unused. */ ++ *frag_splice = next_frag; ++ search_frag = next_frag; ++ continue; ++ } ++ ++ /* First, move the frag out of the literal section and ++ to the appropriate place. */ ++ ++ /* Insert an aligmnent frag at start of pool. */ ++ if (literal_pool->fr_next->fr_type == rs_machine_dependent && ++ literal_pool->fr_next->fr_subtype == RELAX_LITERAL_POOL_END) ++ { ++ segT pool_seg = literal_pool->fr_next->tc_frag_data.lit_seg; ++ emit_state prev_state; ++ fragS *prev_frag; ++ fragS *align_frag; ++ xtensa_switch_section_emit_state (&prev_state, pool_seg, 0); ++ prev_frag = frag_now; ++ frag_variant (rs_fill, 0, 0, 0, NULL, 0, NULL); ++ align_frag = frag_now; ++ frag_align (2, 0, 0); ++ /* Splice it into the right place. */ ++ prev_frag->fr_next = align_frag->fr_next; ++ align_frag->fr_next = literal_pool->fr_next; ++ literal_pool->fr_next = align_frag; ++ /* Insert after this one. */ ++ literal_pool->tc_frag_data.literal_frag = align_frag; ++ xtensa_restore_emit_state (&prev_state); ++ } + insert_after = literal_pool->tc_frag_data.literal_frag; + dest_seg = insert_after->fr_next->tc_frag_data.lit_seg; ++ /* Skip align frag. */ ++ if (insert_after->fr_next->fr_type == rs_align) ++ { ++ insert_after = insert_after->fr_next; ++ } + + *frag_splice = next_frag; + search_frag->fr_next = insert_after->fr_next; +@@ -11014,7 +11433,10 @@ xtensa_switch_to_non_abs_literal_fragment (emit_state *result) + && !recursive + && !is_init && ! is_fini) + { +- as_bad (_("literal pool location required for text-section-literals; specify with .literal_position")); ++ if (!auto_litpools) ++ { ++ as_bad (_("literal pool location required for text-section-literals; specify with .literal_position")); ++ } + + /* When we mark a literal pool location, we want to put a frag in + the literal pool that points to it. But to do that, we want to +diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h +index b2e43fa..290d902 100644 +--- a/gas/config/tc-xtensa.h ++++ b/gas/config/tc-xtensa.h +@@ -124,6 +124,7 @@ enum xtensa_relax_statesE + + RELAX_LITERAL_POOL_BEGIN, + RELAX_LITERAL_POOL_END, ++ RELAX_LITERAL_POOL_CANDIDATE_BEGIN, + /* Technically these are not relaxations at all but mark a location + to store literals later. Note that fr_var stores the frchain for + BEGIN frags and fr_var stores now_seg for END frags. */ +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index d197ec8..db39629 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -100,5 +100,6 @@ if [istarget xtensa*-*-*] then { + run_dump_test "jlong" + run_dump_test "trampoline" ++ run_dump_test "auto-litpools" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/auto-litpools.d b/gas/testsuite/gas/xtensa/auto-litpools.d +new file mode 100644 +index 0000000..4d1a690 +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/auto-litpools.d +@@ -0,0 +1,12 @@ ++#as: --auto-litpools ++#objdump: -d ++#name: auto literal pool placement ++ ++.*: +file format .*xtensa.* ++#... ++.*4:.*l32r.a2, 0 .* ++#... ++.*3e437:.*j.3e440 .* ++#... ++.*40750:.*l32r.a2, 3e43c .* ++#... +diff --git a/gas/testsuite/gas/xtensa/auto-litpools.s b/gas/testsuite/gas/xtensa/auto-litpools.s +new file mode 100644 +index 0000000..9a5b26b +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/auto-litpools.s +@@ -0,0 +1,13 @@ ++ .text ++ .align 4 ++ .literal .L0, 0x12345 ++ .literal .L1, 0x12345 ++ ++f: ++ l32r a2, .L0 ++ .rep 44000 ++ _nop ++ _nop ++ .endr ++ l32r a2, .L1 ++ ret +-- +1.8.1.4 + diff --git a/package/binutils/2.24/914-xtensa-fix-signedness-of-gas-relocations.patch b/package/binutils/2.24/914-xtensa-fix-signedness-of-gas-relocations.patch new file mode 100644 index 0000000000..bd751661b8 --- /dev/null +++ b/package/binutils/2.24/914-xtensa-fix-signedness-of-gas-relocations.patch @@ -0,0 +1,99 @@ +From 6c7c5c477ef9ccf2d2548cf2ac3cec9bd3c9c5b6 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 2 Feb 2016 17:11:38 +0300 +Subject: [PATCH] xtensa: fix signedness of gas relocations + +Change 1058c7532d0b "Use signed data type for R_XTENSA_DIFF* relocation +offsets." changed signedness of BFD_RELOC_XTENSA_DIFF* relocations +substituted for BFD_RELOC_*. This made it impossible to encode arbitrary +8-, 16- and 32-bit values, which broke e.g. debug info encoding by .loc +directive. Revert this part and add test. + +gas/ +2016-02-03 Max Filippov + * config/tc-xtensa.c (md_apply_fix): Mark BFD_RELOC_XTENSA_DIFF* + substitutions for BFD_RELOC_* as unsigned. + +gas/testsuite/ +2016-02-03 Max Filippov + * gas/xtensa/all.exp: Add loc to list of xtensa tests. + * gas/xtensa/loc.d: New file: loc test result patterns. + * gas/xtensa/loc.s: New file: loc test. + +Signed-off-by: Max Filippov +--- + gas/config/tc-xtensa.c | 6 +++--- + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/loc.d | 10 ++++++++++ + gas/testsuite/gas/xtensa/loc.s | 7 +++++++ + 4 files changed, 21 insertions(+), 3 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/loc.d + create mode 100644 gas/testsuite/gas/xtensa/loc.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index a119871..36a06cc 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5961,15 +5961,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) + { + case BFD_RELOC_8: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + case BFD_RELOC_16: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + case BFD_RELOC_32: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + default: + break; +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index 31b725b..7ff7bd7 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -101,6 +101,7 @@ if [istarget xtensa*-*-*] then { + run_dump_test "trampoline" + run_dump_test "first_frag_align" + run_dump_test "auto-litpools" ++ run_dump_test "loc" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/loc.d b/gas/testsuite/gas/xtensa/loc.d +new file mode 100644 +index 0000000..71983cc +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/loc.d +@@ -0,0 +1,10 @@ ++#as: ++#objdump: -r ++#name: .loc directive relocs ++ ++.*: +file format .*xtensa.* ++ ++RELOCATION RECORDS FOR \[\.debug_line\]: ++#... ++.*R_XTENSA_DIFF16.*\.text\+0x00009c42 ++#... +diff --git a/gas/testsuite/gas/xtensa/loc.s b/gas/testsuite/gas/xtensa/loc.s +new file mode 100644 +index 0000000..029e14e +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/loc.s +@@ -0,0 +1,7 @@ ++ .text ++ .file 1 "loc.s" ++ .loc 1 3 ++ nop ++ .space 40000 ++ .loc 1 5 ++ nop +-- +2.1.4 + diff --git a/package/binutils/2.24/915-xtensa-fix-.init-.fini-literals-moving.patch b/package/binutils/2.24/915-xtensa-fix-.init-.fini-literals-moving.patch new file mode 100644 index 0000000000..ead3e42b75 --- /dev/null +++ b/package/binutils/2.24/915-xtensa-fix-.init-.fini-literals-moving.patch @@ -0,0 +1,149 @@ +From 7db2accc3fdea0aaa0c3a76a413d8e8030e022c3 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 16 Feb 2016 02:23:28 +0300 +Subject: [PATCH] xtensa: fix .init/.fini literals moving + +Despite the documentation and the comment in xtensa_move_literals, in +the presence of --text-section-literals and --auto-litpools literals are +moved from the separate literal sections into .init and .fini, because +the check in the xtensa_move_literals is incorrect. + +This moving was broken with introduction of auto litpools: some literals +now may be lost. This happens because literal frags emitted from .init +and .fini are not closed when new .literal_position marks new literal +pool. Then frag_align(2, 0, 0) changes type of the last literal frag to +rs_align. rs_align frags are skipped in the xtensa_move_literals. As a +result fixups against such literals are not moved out of .init.literal/ +.fini.literal sections producing the following assembler error: + + test.S: Warning: fixes not all moved from .init.literal + test.S: Internal error! + +Fix check for .init.literal/.fini.literal in the xtensa_move_literals +and don't let it move literals from there in the presence of +--text-section-literals or --auto-litpools. + +2016-02-17 Max Filippov +gas/ + * config/tc-xtensa.c (xtensa_move_literals): Fix check for + .init.literal/.fini.literal section name. + * testsuite/gas/xtensa/all.exp: Add init-fini-literals to the + list of xtensa tests. + * testsuite/gas/xtensa/init-fini-literals.d: New file: + init-fini-literals test result patterns. + * testsuite/gas/xtensa/init-fini-literals.s: New file: + init-fini-literals test. + +Signed-off-by: Max Filippov +--- +Backported from: 4111950f363221c4641dc2f33bea61cc94f34906 + + gas/config/tc-xtensa.c | 12 ++++++++++-- + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/init-fini-literals.d | 24 ++++++++++++++++++++++++ + gas/testsuite/gas/xtensa/init-fini-literals.s | 19 +++++++++++++++++++ + 4 files changed, 54 insertions(+), 2 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/init-fini-literals.d + create mode 100644 gas/testsuite/gas/xtensa/init-fini-literals.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 36a06cc..5773634 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -11061,6 +11061,10 @@ xtensa_move_literals (void) + fixS *fix, *next_fix, **fix_splice; + sym_list *lit; + struct litpool_seg *lps; ++ const char *init_name = INIT_SECTION_NAME; ++ const char *fini_name = FINI_SECTION_NAME; ++ int init_name_len = strlen(init_name); ++ int fini_name_len = strlen(fini_name); + + mark_literal_frags (literal_head->next); + +@@ -11171,9 +11175,13 @@ xtensa_move_literals (void) + + for (segment = literal_head->next; segment; segment = segment->next) + { ++ const char *seg_name = segment_name (segment->seg); ++ + /* Keep the literals for .init and .fini in separate sections. */ +- if (!strcmp (segment_name (segment->seg), INIT_SECTION_NAME) +- || !strcmp (segment_name (segment->seg), FINI_SECTION_NAME)) ++ if ((!memcmp (seg_name, init_name, init_name_len) && ++ !strcmp (seg_name + init_name_len, ".literal")) || ++ (!memcmp (seg_name, fini_name, fini_name_len) && ++ !strcmp (seg_name + fini_name_len, ".literal"))) + continue; + + frchain_from = seg_info (segment->seg)->frchainP; +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index 7ff7bd7..6b67320 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -102,6 +102,7 @@ if [istarget xtensa*-*-*] then { + run_dump_test "first_frag_align" + run_dump_test "auto-litpools" + run_dump_test "loc" ++ run_dump_test "init-fini-literals" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/init-fini-literals.d b/gas/testsuite/gas/xtensa/init-fini-literals.d +new file mode 100644 +index 0000000..19ed121 +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/init-fini-literals.d +@@ -0,0 +1,24 @@ ++#as: --text-section-literals ++#objdump: -r ++#name: check that literals for .init and .fini always go to separate sections ++ ++.*: +file format .*xtensa.* ++#... ++RELOCATION RECORDS FOR \[\.init\.literal\]: ++#... ++00000000 R_XTENSA_PLT init ++#... ++RELOCATION RECORDS FOR \[\.fini\.literal\]: ++#... ++00000000 R_XTENSA_PLT fini ++#... ++RELOCATION RECORDS FOR \[\.init\]: ++#... ++.* R_XTENSA_SLOT0_OP \.init\.literal ++.* R_XTENSA_SLOT0_OP \.init\.literal\+0x00000004 ++#... ++RELOCATION RECORDS FOR \[\.fini\]: ++#... ++.* R_XTENSA_SLOT0_OP \.fini\.literal ++.* R_XTENSA_SLOT0_OP \.fini\.literal\+0x00000004 ++#... +diff --git a/gas/testsuite/gas/xtensa/init-fini-literals.s b/gas/testsuite/gas/xtensa/init-fini-literals.s +new file mode 100644 +index 0000000..7c9ec17 +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/init-fini-literals.s +@@ -0,0 +1,19 @@ ++ .section .init,"ax",@progbits ++ .literal_position ++ .literal .LC0, init@PLT ++ .literal_position ++ .literal .LC1, 1 ++ .align 4 ++ ++ l32r a2, .LC0 ++ l32r a2, .LC1 ++ ++ .section .fini,"ax",@progbits ++ .literal_position ++ .literal .LC2, fini@PLT ++ .literal_position ++ .literal .LC3, 1 ++ .align 4 ++ ++ l32r a2, .LC2 ++ l32r a2, .LC3 +-- +2.1.4 + diff --git a/package/binutils/2.26/0120-sh-conf.patch b/package/binutils/2.26/0120-sh-conf.patch new file mode 100644 index 0000000000..cc14ef4029 --- /dev/null +++ b/package/binutils/2.26/0120-sh-conf.patch @@ -0,0 +1,46 @@ +From 1ceee199e9a32034c6def7700fdbb26335ca76a3 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 25 Dec 2015 11:38:13 +0100 +Subject: [PATCH] sh-conf + +Likewise, binutils has no idea about any of these new targets either, so we +fix that up too.. now we're able to actually build a real toolchain for +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more +inept targets than that one, really. Go look, I promise). + +[Romain: rebase on top of 2.26] +Signed-off-by: Romain Naour +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 34b66f7..905bc7b 100755 +--- a/configure ++++ b/configure +@@ -3939,7 +3939,7 @@ case "${target}" in + or1k*-*-*) + noconfigdirs="$noconfigdirs gdb" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${target}" in + sh*-*-elf) + ;; +diff --git a/configure.ac b/configure.ac +index 4977d97..1e69ee2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1276,7 +1276,7 @@ case "${target}" in + or1k*-*-*) + noconfigdirs="$noconfigdirs gdb" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${target}" in + sh*-*-elf) + ;; +-- +2.4.3 + diff --git a/package/binutils/2.26/0300-ld-makefile.patch b/package/binutils/2.26/0300-ld-makefile.patch new file mode 100644 index 0000000000..73cc098024 --- /dev/null +++ b/package/binutils/2.26/0300-ld-makefile.patch @@ -0,0 +1,41 @@ +From d76a7549b43974fe8564971a3f40459bc495a8a7 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 25 Dec 2015 11:40:53 +0100 +Subject: [PATCH] ld-makefile + +[Romain: rebase on top of 2.26] +Signed-off-by: Romain Naour +--- + ld/Makefile.am | 2 +- + ld/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ld/Makefile.am b/ld/Makefile.am +index 0b3b049..3871c74 100644 +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -57,7 +57,7 @@ endif + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff --git a/ld/Makefile.in b/ld/Makefile.in +index ed98f87..530e4c9 100644 +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -413,7 +413,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include +-- +2.4.3 + diff --git a/package/binutils/2.26/0301-check-ldrunpath-length.patch b/package/binutils/2.26/0301-check-ldrunpath-length.patch new file mode 100644 index 0000000000..3b4c204c7f --- /dev/null +++ b/package/binutils/2.26/0301-check-ldrunpath-length.patch @@ -0,0 +1,36 @@ +From ebe1cba46df52d7bf86def3d681271fd05fb453b Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 25 Dec 2015 11:41:47 +0100 +Subject: [PATCH] check-ldrunpath-length + +[Romain: rebase on top of 2.26] +Signed-off-by: Romain Naour +--- + ld/emultempl/elf32.em | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em +index 0405d4f..efd3300 100644 +--- a/ld/emultempl/elf32.em ++++ b/ld/emultempl/elf32.em +@@ -1242,6 +1242,8 @@ fragment <link.next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) +-- +2.4.3 + diff --git a/package/binutils/2.26/0500-add-sysroot-fix-from-bug-3049.patch b/package/binutils/2.26/0500-add-sysroot-fix-from-bug-3049.patch new file mode 100644 index 0000000000..f67a43efdf --- /dev/null +++ b/package/binutils/2.26/0500-add-sysroot-fix-from-bug-3049.patch @@ -0,0 +1,52 @@ +From 30628870e583375f8927c04398c7219c6e9f703c Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 25 Dec 2015 11:42:48 +0100 +Subject: [PATCH] add sysroot fix from bug #3049 + +Always try to prepend the sysroot prefix to absolute filenames first. + +http://bugs.gentoo.org/275666 +http://sourceware.org/bugzilla/show_bug.cgi?id=10340 + +Signed-off-by: Sven Rebhan +[Romain: rebase on top of 2.26] +Signed-off-by: Romain Naour +--- + ld/ldfile.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/ld/ldfile.c b/ld/ldfile.c +index 96f9ecc..1439309 100644 +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -335,18 +335,25 @@ ldfile_open_file_search (const char *arch, + directory first. */ + if (! entry->flags.maybe_archive) + { +- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)) ++ /* For absolute pathnames, try to always open the file in the ++ sysroot first. If this fails, try to open the file at the ++ given location. */ ++ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename); ++ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename) ++ && ld_sysroot) + { + char *name = concat (ld_sysroot, entry->filename, + (const char *) NULL); + if (ldfile_try_open_bfd (name, entry)) + { + entry->filename = name; ++ entry->flags.sysrooted = TRUE; + return TRUE; + } + free (name); + } +- else if (ldfile_try_open_bfd (entry->filename, entry)) ++ ++ if (ldfile_try_open_bfd (entry->filename, entry)) + return TRUE; + + if (IS_ABSOLUTE_PATH (entry->filename)) +-- +2.4.3 + diff --git a/package/binutils/2.26/0600-poison-system-directories.patch b/package/binutils/2.26/0600-poison-system-directories.patch new file mode 100644 index 0000000000..d16994ec0c --- /dev/null +++ b/package/binutils/2.26/0600-poison-system-directories.patch @@ -0,0 +1,306 @@ +From be366461dd49e760440fb28eaee5164eb281adcc Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 25 Dec 2015 11:45:38 +0100 +Subject: [PATCH] poison-system-directories + +Patch adapted to binutils 2.23.2 and extended to use +BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni. + +[Romain: rebase on top of 2.26] +Signed-off-by: Romain Naour +[Gustavo: adapt to binutils 2.25] +Signed-off-by: Thomas Petazzoni +Signed-off-by: Gustavo Zacarias + +Upstream-Status: Inappropriate [distribution: codesourcery] + +Patch originally created by Mark Hatle, forward-ported to +binutils 2.21 by Scott Garman. + +purpose: warn for uses of system directories when cross linking + +Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 + +2008-07-02 Joseph Myers + + ld/ + * ld.h (args_type): Add error_poison_system_directories. + * ld.texinfo (--error-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.error_poison_system_directories. + * ldmain.c (main): Initialize + command_line.error_poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --error-poison-system-directories. + (parse_args): Handle new option. + +2007-06-13 Joseph Myers + + ld/ + * config.in: Regenerate. + * ld.h (args_type): Add poison_system_directories. + * ld.texinfo (--no-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.poison_system_directories. + * ldmain.c (main): Initialize + command_line.poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_NO_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --no-poison-system-directories. + (parse_args): Handle new option. + +2007-04-20 Joseph Myers + + Merge from Sourcery G++ binutils 2.17: + + 2007-03-20 Joseph Myers + Based on patch by Mark Hatle . + ld/ + * configure.ac (--enable-poison-system-directories): New option. + * configure, config.in: Regenerate. + * ldfile.c (ldfile_add_library_path): If + ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib, + /usr/lib, /usr/local/lib or /usr/X11R6/lib. + +Signed-off-by: Mark Hatle +Signed-off-by: Scott Garman +--- + ld/config.in | 3 +++ + ld/configure | 14 ++++++++++++++ + ld/configure.ac | 10 ++++++++++ + ld/ld.h | 8 ++++++++ + ld/ld.texinfo | 12 ++++++++++++ + ld/ldfile.c | 17 +++++++++++++++++ + ld/ldlex.h | 2 ++ + ld/ldmain.c | 2 ++ + ld/lexsup.c | 21 +++++++++++++++++++++ + 9 files changed, 89 insertions(+) + +diff --git a/ld/config.in b/ld/config.in +index 276fb77..35c58eb 100644 +--- a/ld/config.in ++++ b/ld/config.in +@@ -14,6 +14,9 @@ + language is requested. */ + #undef ENABLE_NLS + ++/* Define to warn for use of native system library directories */ ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES ++ + /* Additional extension a shared object might have. */ + #undef EXTRA_SHLIB_EXTENSION + +diff --git a/ld/configure b/ld/configure +index a446283..d1f9504 100755 +--- a/ld/configure ++++ b/ld/configure +@@ -786,6 +786,7 @@ with_lib_path + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_compressed_debug_sections +@@ -1442,6 +1443,8 @@ Optional Features: + --disable-largefile omit support for large files + --enable-targets alternative target configurations + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) ++ --enable-poison-system-directories ++ warn for use of native system library directories + --enable-gold[=ARG] build gold [ARG={default,yes,no}] + --enable-got= GOT handling scheme (target, single, negative, + multigot) +@@ -15491,7 +15494,18 @@ else + fi + + ++# Check whether --enable-poison-system-directories was given. ++if test "${enable_poison_system_directories+set}" = set; then : ++ enableval=$enable_poison_system_directories; ++else ++ enable_poison_system_directories=no ++fi ++ ++if test "x${enable_poison_system_directories}" = "xyes"; then + ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h ++ ++fi + + # Check whether --enable-got was given. + if test "${enable_got+set}" = set; then : +diff --git a/ld/configure.ac b/ld/configure.ac +index 188172d..2cd8443 100644 +--- a/ld/configure.ac ++++ b/ld/configure.ac +@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot) + AC_SUBST(TARGET_SYSTEM_ROOT) + AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) + ++AC_ARG_ENABLE([poison-system-directories], ++ AS_HELP_STRING([--enable-poison-system-directories], ++ [warn for use of native system library directories]),, ++ [enable_poison_system_directories=no]) ++if test "x${enable_poison_system_directories}" = "xyes"; then ++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], ++ [1], ++ [Define to warn for use of native system library directories]) ++fi ++ + dnl Use --enable-gold to decide if this linker should be the default. + dnl "install_as_default" is set to false if gold is the default linker. + dnl "installed_linker" is the installed BFD linker name. +diff --git a/ld/ld.h b/ld/ld.h +index d84ec4e..3476b26 100644 +--- a/ld/ld.h ++++ b/ld/ld.h +@@ -164,6 +164,14 @@ typedef struct { + /* If set, display the target memory usage (per memory region). */ + bfd_boolean print_memory_usage; + ++ /* If TRUE (the default) warn for uses of system directories when ++ cross linking. */ ++ bfd_boolean poison_system_directories; ++ ++ /* If TRUE (default FALSE) give an error for uses of system ++ directories when cross linking instead of a warning. */ ++ bfd_boolean error_poison_system_directories; ++ + /* Big or little endian as set on command line. */ + enum endian_enum endian; + +diff --git a/ld/ld.texinfo b/ld/ld.texinfo +index 1dd7492..fb1438e 100644 +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -2332,6 +2332,18 @@ string identifying the original linked file does not change. + + Passing @code{none} for @var{style} disables the setting from any + @code{--build-id} options earlier on the command line. ++ ++@kindex --no-poison-system-directories ++@item --no-poison-system-directories ++Do not warn for @option{-L} options using system directories such as ++@file{/usr/lib} when cross linking. This option is intended for use ++in chroot environments when such directories contain the correct ++libraries for the target system rather than the host. ++ ++@kindex --error-poison-system-directories ++@item --error-poison-system-directories ++Give an error instead of a warning for @option{-L} options using ++system directories when cross linking. + @end table + + @c man end +diff --git a/ld/ldfile.c b/ld/ldfile.c +index 1439309..086b354 100644 +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -114,6 +114,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline) + new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); + else + new_dirs->name = xstrdup (name); ++ ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES ++ if (command_line.poison_system_directories ++ && ((!strncmp (name, "/lib", 4)) ++ || (!strncmp (name, "/usr/lib", 8)) ++ || (!strncmp (name, "/usr/local/lib", 14)) ++ || (!strncmp (name, "/usr/X11R6/lib", 14)))) ++ { ++ if (command_line.error_poison_system_directories) ++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ else ++ einfo (_("%P: warning: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ } ++#endif ++ + } + + /* Try to open a BFD for a lang_input_statement. */ +diff --git a/ld/ldlex.h b/ld/ldlex.h +index 6f11e7b..0ca3110 100644 +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -144,6 +144,8 @@ enum option_values + OPTION_PRINT_MEMORY_USAGE, + OPTION_REQUIRE_DEFINED_SYMBOL, + OPTION_ORPHAN_HANDLING, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, + }; + + /* The initial parser states. */ +diff --git a/ld/ldmain.c b/ld/ldmain.c +index bb0b9cc..a23c56c 100644 +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -257,6 +257,8 @@ main (int argc, char **argv) + command_line.warn_mismatch = TRUE; + command_line.warn_search_mismatch = TRUE; + command_line.check_section_addresses = -1; ++ command_line.poison_system_directories = TRUE; ++ command_line.error_poison_system_directories = FALSE; + + /* We initialize DEMANGLING based on the environment variable + COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the +diff --git a/ld/lexsup.c b/ld/lexsup.c +index 4cad209..be7d584 100644 +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -530,6 +530,14 @@ static const struct ld_option ld_options[] = + { {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING}, + '\0', N_("=MODE"), N_("Control how orphan sections are handled."), + TWO_DASHES }, ++ { {"no-poison-system-directories", no_argument, NULL, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Do not warn for -L options using system directories"), ++ TWO_DASHES }, ++ { {"error-poison-system-directories", no_argument, NULL, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Give an error for -L options using system directories"), ++ TWO_DASHES }, + }; + + #define OPTION_COUNT ARRAY_SIZE (ld_options) +@@ -542,6 +550,7 @@ parse_args (unsigned argc, char **argv) + int ingroup = 0; + char *default_dirlist = NULL; + char *shortopts; ++ char *BR_paranoid_env; + struct option *longopts; + struct option *really_longopts; + int last_optind; +@@ -1516,6 +1525,14 @@ parse_args (unsigned argc, char **argv) + } + break; + ++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES: ++ command_line.poison_system_directories = FALSE; ++ break; ++ ++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: ++ command_line.error_poison_system_directories = TRUE; ++ break; ++ + case OPTION_PUSH_STATE: + input_flags.pushed = xmemdup (&input_flags, + sizeof (input_flags), +@@ -1559,6 +1576,10 @@ parse_args (unsigned argc, char **argv) + command_line.soname = NULL; + } + ++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH"); ++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0) ++ command_line.error_poison_system_directories = TRUE; ++ + while (ingroup) + { + lang_leave_group (); +-- +2.4.3 + diff --git a/package/binutils/2.26/0900-Correct-nios2-_gp-address-computation.patch b/package/binutils/2.26/0900-Correct-nios2-_gp-address-computation.patch new file mode 100644 index 0000000000..81986f51b9 --- /dev/null +++ b/package/binutils/2.26/0900-Correct-nios2-_gp-address-computation.patch @@ -0,0 +1,108 @@ +From 5eeb7401eed2f26d5fc255de816ca70a2cb9374e Mon Sep 17 00:00:00 2001 +From: Sandra Loosemore +Date: Sun, 27 Dec 2015 12:30:26 -0800 +Subject: [PATCH 900/901] Correct nios2 _gp address computation. + +2015-12-27 Sandra Loosemore + + bfd/ + * elf32-nios2.c (nios2_elf_assign_gp): Correct computation of _gp + address. + (nios2_elf32_relocate_section): Tidy code for R_NIOS2_GPREL error + messages. + +[Romain: + - backport upstream patch on 2.26 + - drop bfd/ChangeLog entry] +Signed-off-by: Romain Naour +--- + bfd/elf32-nios2.c | 31 +++++++++++++++++++++---------- + 1 file changed, 21 insertions(+), 10 deletions(-) + +diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c +index 6b29d8b..01ebd6e 100644 +--- a/bfd/elf32-nios2.c ++++ b/bfd/elf32-nios2.c +@@ -3086,7 +3086,15 @@ lookup: + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + gp_found = TRUE; +- *pgp = lh->u.def.value; ++ { ++ asection *sym_sec = lh->u.def.section; ++ bfd_vma sym_value = lh->u.def.value; ++ ++ if (sym_sec->output_section) ++ sym_value = (sym_value + sym_sec->output_offset ++ + sym_sec->output_section->vma); ++ *pgp = sym_value; ++ } + break; + case bfd_link_hash_indirect: + case bfd_link_hash_warning: +@@ -3719,7 +3727,6 @@ nios2_elf32_relocate_section (bfd *output_bfd, + struct elf32_nios2_link_hash_entry *eh; + bfd_vma relocation; + bfd_vma gp; +- bfd_vma reloc_address; + bfd_reloc_status_type r = bfd_reloc_ok; + const char *name = NULL; + int r_type; +@@ -3762,12 +3769,6 @@ nios2_elf32_relocate_section (bfd *output_bfd, + if (bfd_link_relocatable (info)) + continue; + +- if (sec && sec->output_section) +- reloc_address = (sec->output_section->vma + sec->output_offset +- + rel->r_offset); +- else +- reloc_address = 0; +- + if (howto) + { + switch (howto->type) +@@ -3816,6 +3817,15 @@ nios2_elf32_relocate_section (bfd *output_bfd, + /* Turns an absolute address into a gp-relative address. */ + if (!nios2_elf_assign_gp (output_bfd, &gp, info)) + { ++ bfd_vma reloc_address; ++ ++ if (sec && sec->output_section) ++ reloc_address = (sec->output_section->vma ++ + sec->output_offset ++ + rel->r_offset); ++ else ++ reloc_address = 0; ++ + format = _("global pointer relative relocation at address " + "0x%08x when _gp not defined\n"); + sprintf (msgbuf, format, reloc_address); +@@ -3825,7 +3835,7 @@ nios2_elf32_relocate_section (bfd *output_bfd, + else + { + bfd_vma symbol_address = rel->r_addend + relocation; +- relocation = relocation + rel->r_addend - gp; ++ relocation = symbol_address - gp; + rel->r_addend = 0; + if (((signed) relocation < -32768 + || (signed) relocation > 32767) +@@ -3833,6 +3843,8 @@ nios2_elf32_relocate_section (bfd *output_bfd, + || h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { ++ if (h) ++ name = h->root.root.string; + format = _("Unable to reach %s (at 0x%08x) from the " + "global pointer (at 0x%08x) because the " + "offset (%d) is out of the allowed range, " +@@ -3848,7 +3860,6 @@ nios2_elf32_relocate_section (bfd *output_bfd, + rel->r_offset, relocation, + rel->r_addend); + } +- + break; + case R_NIOS2_UJMP: + r = nios2_elf32_do_ujmp_relocate (input_bfd, howto, +-- +2.4.3 + diff --git a/package/binutils/2.26/0901-Fix-assertion-reduce-number-of-messages-about-FDE-en.patch b/package/binutils/2.26/0901-Fix-assertion-reduce-number-of-messages-about-FDE-en.patch new file mode 100644 index 0000000000..a490780f7e --- /dev/null +++ b/package/binutils/2.26/0901-Fix-assertion-reduce-number-of-messages-about-FDE-en.patch @@ -0,0 +1,67 @@ +From 39c481c2fb0e7fb127a15facf70b55d517462809 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Sat, 6 Feb 2016 00:35:31 +0100 +Subject: [PATCH 901/901] Fix assertion, reduce number of messages about FDE + encoding + +Patch by Nick Clifton [1] + +[1] https://sourceware.org/bugzilla/show_bug.cgi?id=19405 + +Signed-off-by: Romain Naour +--- + bfd/elf-eh-frame.c | 17 ++++++++++++++--- + bfd/elf32-nios2.c | 4 ++-- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c +index e303189..e79bff0 100644 +--- a/bfd/elf-eh-frame.c ++++ b/bfd/elf-eh-frame.c +@@ -1369,14 +1369,25 @@ _bfd_elf_discard_section_eh_frame + && ent->make_relative == 0) + || (ent->fde_encoding & 0x70) == DW_EH_PE_aligned)) + { ++ static int num_warnings_issued = 0; + /* If a shared library uses absolute pointers + which we cannot turn into PC relative, + don't create the binary search table, + since it is affected by runtime relocations. */ + hdr_info->u.dwarf.table = FALSE; +- (*info->callbacks->einfo) +- (_("%P: FDE encoding in %B(%A) prevents .eh_frame_hdr" +- " table being created.\n"), abfd, sec); ++ if (num_warnings_issued < 10) ++ { ++ (*info->callbacks->einfo) ++ (_("%P: FDE encoding in %B(%A) prevents .eh_frame_hdr" ++ " table being created.\n"), abfd, sec); ++ num_warnings_issued ++; ++ } ++ else if (num_warnings_issued == 10) ++ { ++ (*info->callbacks->einfo) ++ (_("%P: Further warnings about FDE encoding preventing .eh_frame_hdr generation dropped.\n")); ++ num_warnings_issued ++; ++ } + } + ent->removed = 0; + hdr_info->u.dwarf.fde_count++; +diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c +index 01ebd6e..d1b7f83 100644 +--- a/bfd/elf32-nios2.c ++++ b/bfd/elf32-nios2.c +@@ -1905,8 +1905,8 @@ nios2_elf32_install_imm16 (asection *sec, bfd_vma offset, bfd_vma value) + { + bfd_vma word = bfd_get_32 (sec->owner, sec->contents + offset); + +- BFD_ASSERT(value <= 0xffff); +- ++ BFD_ASSERT (value <= 0xffff || ((bfd_signed_vma) value) >= -0xffff); ++ + bfd_put_32 (sec->owner, word | ((value & 0xffff) << 6), + sec->contents + offset); + } +-- +2.4.3 + diff --git a/package/binutils/2.26/0902-xtensa-fix-signedness-of-gas-relocations.patch b/package/binutils/2.26/0902-xtensa-fix-signedness-of-gas-relocations.patch new file mode 100644 index 0000000000..4ba2f75cc8 --- /dev/null +++ b/package/binutils/2.26/0902-xtensa-fix-signedness-of-gas-relocations.patch @@ -0,0 +1,101 @@ +From eb3e02b484ff75f4a2f54192422a88baa275bdfc Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 2 Feb 2016 17:11:38 +0300 +Subject: [PATCH] xtensa: fix signedness of gas relocations + +Change 1058c7532d0b "Use signed data type for R_XTENSA_DIFF* relocation +offsets." changed signedness of BFD_RELOC_XTENSA_DIFF* relocations +substituted for BFD_RELOC_*. This made it impossible to encode arbitrary +8-, 16- and 32-bit values, which broke e.g. debug info encoding by .loc +directive. Revert this part and add test. + +gas/ +2016-02-03 Max Filippov + * config/tc-xtensa.c (md_apply_fix): Mark BFD_RELOC_XTENSA_DIFF* + substitutions for BFD_RELOC_* as unsigned. + +gas/testsuite/ +2016-02-03 Max Filippov + * gas/xtensa/all.exp: Add loc to list of xtensa tests. + * gas/xtensa/loc.d: New file: loc test result patterns. + * gas/xtensa/loc.s: New file: loc test. + +Signed-off-by: Max Filippov +[Rebase on 2.26] +Signed-off-by: Romain Naour +--- + gas/config/tc-xtensa.c | 6 +++--- + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/loc.d | 10 ++++++++++ + gas/testsuite/gas/xtensa/loc.s | 7 +++++++ + 4 files changed, 21 insertions(+), 3 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/loc.d + create mode 100644 gas/testsuite/gas/xtensa/loc.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index d707da8..f623add 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -5961,15 +5961,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) + { + case BFD_RELOC_8: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + case BFD_RELOC_16: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + case BFD_RELOC_32: + fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32; +- fixP->fx_signed = 1; ++ fixP->fx_signed = 0; + break; + default: + break; +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index db39629..4daeff2 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -101,6 +101,7 @@ if [istarget xtensa*-*-*] then { + run_dump_test "trampoline" + run_dump_test "first_frag_align" + run_dump_test "auto-litpools" ++ run_dump_test "loc" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/loc.d b/gas/testsuite/gas/xtensa/loc.d +new file mode 100644 +index 0000000..71983cc +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/loc.d +@@ -0,0 +1,10 @@ ++#as: ++#objdump: -r ++#name: .loc directive relocs ++ ++.*: +file format .*xtensa.* ++ ++RELOCATION RECORDS FOR \[\.debug_line\]: ++#... ++.*R_XTENSA_DIFF16.*\.text\+0x00009c42 ++#... +diff --git a/gas/testsuite/gas/xtensa/loc.s b/gas/testsuite/gas/xtensa/loc.s +new file mode 100644 +index 0000000..029e14e +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/loc.s +@@ -0,0 +1,7 @@ ++ .text ++ .file 1 "loc.s" ++ .loc 1 3 ++ nop ++ .space 40000 ++ .loc 1 5 ++ nop +-- +2.4.3 + diff --git a/package/binutils/2.26/0903-xtensa-fix-.init-.fini-literals-moving.patch b/package/binutils/2.26/0903-xtensa-fix-.init-.fini-literals-moving.patch new file mode 100644 index 0000000000..ead3e42b75 --- /dev/null +++ b/package/binutils/2.26/0903-xtensa-fix-.init-.fini-literals-moving.patch @@ -0,0 +1,149 @@ +From 7db2accc3fdea0aaa0c3a76a413d8e8030e022c3 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Tue, 16 Feb 2016 02:23:28 +0300 +Subject: [PATCH] xtensa: fix .init/.fini literals moving + +Despite the documentation and the comment in xtensa_move_literals, in +the presence of --text-section-literals and --auto-litpools literals are +moved from the separate literal sections into .init and .fini, because +the check in the xtensa_move_literals is incorrect. + +This moving was broken with introduction of auto litpools: some literals +now may be lost. This happens because literal frags emitted from .init +and .fini are not closed when new .literal_position marks new literal +pool. Then frag_align(2, 0, 0) changes type of the last literal frag to +rs_align. rs_align frags are skipped in the xtensa_move_literals. As a +result fixups against such literals are not moved out of .init.literal/ +.fini.literal sections producing the following assembler error: + + test.S: Warning: fixes not all moved from .init.literal + test.S: Internal error! + +Fix check for .init.literal/.fini.literal in the xtensa_move_literals +and don't let it move literals from there in the presence of +--text-section-literals or --auto-litpools. + +2016-02-17 Max Filippov +gas/ + * config/tc-xtensa.c (xtensa_move_literals): Fix check for + .init.literal/.fini.literal section name. + * testsuite/gas/xtensa/all.exp: Add init-fini-literals to the + list of xtensa tests. + * testsuite/gas/xtensa/init-fini-literals.d: New file: + init-fini-literals test result patterns. + * testsuite/gas/xtensa/init-fini-literals.s: New file: + init-fini-literals test. + +Signed-off-by: Max Filippov +--- +Backported from: 4111950f363221c4641dc2f33bea61cc94f34906 + + gas/config/tc-xtensa.c | 12 ++++++++++-- + gas/testsuite/gas/xtensa/all.exp | 1 + + gas/testsuite/gas/xtensa/init-fini-literals.d | 24 ++++++++++++++++++++++++ + gas/testsuite/gas/xtensa/init-fini-literals.s | 19 +++++++++++++++++++ + 4 files changed, 54 insertions(+), 2 deletions(-) + create mode 100644 gas/testsuite/gas/xtensa/init-fini-literals.d + create mode 100644 gas/testsuite/gas/xtensa/init-fini-literals.s + +diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c +index 36a06cc..5773634 100644 +--- a/gas/config/tc-xtensa.c ++++ b/gas/config/tc-xtensa.c +@@ -11061,6 +11061,10 @@ xtensa_move_literals (void) + fixS *fix, *next_fix, **fix_splice; + sym_list *lit; + struct litpool_seg *lps; ++ const char *init_name = INIT_SECTION_NAME; ++ const char *fini_name = FINI_SECTION_NAME; ++ int init_name_len = strlen(init_name); ++ int fini_name_len = strlen(fini_name); + + mark_literal_frags (literal_head->next); + +@@ -11171,9 +11175,13 @@ xtensa_move_literals (void) + + for (segment = literal_head->next; segment; segment = segment->next) + { ++ const char *seg_name = segment_name (segment->seg); ++ + /* Keep the literals for .init and .fini in separate sections. */ +- if (!strcmp (segment_name (segment->seg), INIT_SECTION_NAME) +- || !strcmp (segment_name (segment->seg), FINI_SECTION_NAME)) ++ if ((!memcmp (seg_name, init_name, init_name_len) && ++ !strcmp (seg_name + init_name_len, ".literal")) || ++ (!memcmp (seg_name, fini_name, fini_name_len) && ++ !strcmp (seg_name + fini_name_len, ".literal"))) + continue; + + frchain_from = seg_info (segment->seg)->frchainP; +diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp +index 7ff7bd7..6b67320 100644 +--- a/gas/testsuite/gas/xtensa/all.exp ++++ b/gas/testsuite/gas/xtensa/all.exp +@@ -102,6 +102,7 @@ if [istarget xtensa*-*-*] then { + run_dump_test "first_frag_align" + run_dump_test "auto-litpools" + run_dump_test "loc" ++ run_dump_test "init-fini-literals" + } + + if [info exists errorInfo] then { +diff --git a/gas/testsuite/gas/xtensa/init-fini-literals.d b/gas/testsuite/gas/xtensa/init-fini-literals.d +new file mode 100644 +index 0000000..19ed121 +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/init-fini-literals.d +@@ -0,0 +1,24 @@ ++#as: --text-section-literals ++#objdump: -r ++#name: check that literals for .init and .fini always go to separate sections ++ ++.*: +file format .*xtensa.* ++#... ++RELOCATION RECORDS FOR \[\.init\.literal\]: ++#... ++00000000 R_XTENSA_PLT init ++#... ++RELOCATION RECORDS FOR \[\.fini\.literal\]: ++#... ++00000000 R_XTENSA_PLT fini ++#... ++RELOCATION RECORDS FOR \[\.init\]: ++#... ++.* R_XTENSA_SLOT0_OP \.init\.literal ++.* R_XTENSA_SLOT0_OP \.init\.literal\+0x00000004 ++#... ++RELOCATION RECORDS FOR \[\.fini\]: ++#... ++.* R_XTENSA_SLOT0_OP \.fini\.literal ++.* R_XTENSA_SLOT0_OP \.fini\.literal\+0x00000004 ++#... +diff --git a/gas/testsuite/gas/xtensa/init-fini-literals.s b/gas/testsuite/gas/xtensa/init-fini-literals.s +new file mode 100644 +index 0000000..7c9ec17 +--- /dev/null ++++ b/gas/testsuite/gas/xtensa/init-fini-literals.s +@@ -0,0 +1,19 @@ ++ .section .init,"ax",@progbits ++ .literal_position ++ .literal .LC0, init@PLT ++ .literal_position ++ .literal .LC1, 1 ++ .align 4 ++ ++ l32r a2, .LC0 ++ l32r a2, .LC1 ++ ++ .section .fini,"ax",@progbits ++ .literal_position ++ .literal .LC2, fini@PLT ++ .literal_position ++ .literal .LC3, 1 ++ .align 4 ++ ++ l32r a2, .LC2 ++ l32r a2, .LC3 +-- +2.1.4 + diff --git a/package/binutils/arc-2015.12/0001-PR-other-56780.patch b/package/binutils/arc-2015.12/0001-PR-other-56780.patch new file mode 100644 index 0000000000..b418a2f4a9 --- /dev/null +++ b/package/binutils/arc-2015.12/0001-PR-other-56780.patch @@ -0,0 +1,236 @@ +From 7827cdf59a1894abe18aa20043a63c8c875c3fce Mon Sep 17 00:00:00 2001 +From: DJ Delorie +Date: Sat, 1 Jun 2013 01:01:44 +0000 +Subject: [PATCH] PR other/56780 merge from gcc + +binutils-gdb upstream a4818a052efb4cea976a03a2f7cb0b38b23d12d0 + +libiberty: fix --enable-install-libiberty flag [PR 56780] + +Commit 199570 fixed the --disable-install-libiberty behavior, but it also +added a bug where the enable path never works because the initial clear +of target_header_dir wasn't deleted. So we end up initializing properly +at the top only to reset it at the end all the time. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206367 138bc75d-0d04-0410-961f-82ee72b054a4 + +[Romain + rename patch name + squash the two upstream commits + Remove the ChangeLog] +Signed-off-by: Romain Naour +--- + libiberty/Makefile.in | 24 ++++++++++----------- + libiberty/configure | 57 +++++++++++++++++++++++++++----------------------- + libiberty/configure.ac | 47 ++++++++++++++++++++++------------------- + 3 files changed, 68 insertions(+), 60 deletions(-) + +diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in +index 0a5da31..4f40c72 100644 +--- a/libiberty/Makefile.in ++++ b/libiberty/Makefile.in +@@ -354,19 +354,19 @@ install-strip: install + # since it will be passed the multilib flags. + MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` + install_to_libdir: all +- ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR) +- $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n +- ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ) +- mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB) + if test -n "${target_header_dir}"; then \ +- case "${target_header_dir}" in \ +- /*) thd=${target_header_dir};; \ +- *) thd=${includedir}/${target_header_dir};; \ +- esac; \ +- ${mkinstalldirs} $(DESTDIR)$${thd}; \ +- for h in ${INSTALLED_HEADERS}; do \ +- ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ +- done; \ ++ ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \ ++ $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n; \ ++ ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ); \ ++ mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB); \ ++ case "${target_header_dir}" in \ ++ /*) thd=${target_header_dir};; \ ++ *) thd=${includedir}/${target_header_dir};; \ ++ esac; \ ++ ${mkinstalldirs} $(DESTDIR)$${thd}; \ ++ for h in ${INSTALLED_HEADERS}; do \ ++ ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ ++ done; \ + fi + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install + +diff --git a/libiberty/configure b/libiberty/configure +index 6e98352..44d1f78 100755 +--- a/libiberty/configure ++++ b/libiberty/configure +@@ -675,8 +675,8 @@ with_cross_host + with_newlib + enable_maintainer_mode + enable_multilib +-enable_largefile + enable_install_libiberty ++enable_largefile + ' + ac_precious_vars='build_alias + host_alias +@@ -1303,8 +1303,8 @@ Optional Features: + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-multilib build many library versions (default) ++ --enable-install-libiberty Install headers and library for end users + --disable-largefile omit support for large files +- --enable-install-libiberty Install headers for end users + + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +@@ -2784,6 +2784,35 @@ if test $cross_compiling = no && test $multilib = yes \ + cross_compiling=maybe + fi + ++# We may wish to install the target headers somewhere. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install libiberty headers and static library" >&5 ++$as_echo_n "checking whether to install libiberty headers and static library... " >&6; } ++ ++# Check whether --enable-install-libiberty was given. ++if test "${enable_install_libiberty+set}" = set; then : ++ enableval=$enable_install_libiberty; enable_install_libiberty=$enableval ++else ++ enable_install_libiberty=no ++fi ++ ++# Option parsed, now set things appropriately. ++case x"$enable_install_libiberty" in ++ xyes|x) ++ target_header_dir=libiberty ++ ;; ++ xno) ++ target_header_dir= ++ ;; ++ *) ++ # This could be sanity-checked in various ways... ++ target_header_dir="${enable_install_libiberty}" ++ ;; ++esac ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_install_libiberty" >&5 ++$as_echo "$enable_install_libiberty" >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: target_header_dir = $target_header_dir" >&5 ++$as_echo "$as_me: target_header_dir = $target_header_dir" >&6;} ++ + + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' +@@ -5475,7 +5504,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +@@ -5752,29 +5780,6 @@ _ACEOF + + esac + +- # We may wish to install the target headers somewhere. +- # Check whether --enable-install-libiberty was given. +-if test "${enable_install_libiberty+set}" = set; then : +- enableval=$enable_install_libiberty; enable_install_libiberty=$enableval +-else +- enable_install_libiberty=no +-fi +- +- # Option parsed, now set things appropriately. +- case x"$enable_install_libiberty" in +- xyes|x) +- target_header_dir=libiberty +- ;; +- xno) +- target_header_dir= +- ;; +- *) +- # This could be sanity-checked in various ways... +- target_header_dir="${enable_install_libiberty}" +- ;; +- esac +- +- + else + + # Not a target library, so we set things up to run the test suite. +diff --git a/libiberty/configure.ac b/libiberty/configure.ac +index 754b66a..04260ec 100644 +--- a/libiberty/configure.ac ++++ b/libiberty/configure.ac +@@ -128,6 +128,31 @@ if test $cross_compiling = no && test $multilib = yes \ + cross_compiling=maybe + fi + ++# We may wish to install the target headers somewhere. ++AC_MSG_CHECKING([whether to install libiberty headers and static library]) ++dnl install-libiberty is disabled by default ++ ++AC_ARG_ENABLE(install-libiberty, ++[ --enable-install-libiberty Install headers and library for end users], ++enable_install_libiberty=$enableval, ++enable_install_libiberty=no)dnl ++ ++# Option parsed, now set things appropriately. ++case x"$enable_install_libiberty" in ++ xyes|x) ++ target_header_dir=libiberty ++ ;; ++ xno) ++ target_header_dir= ++ ;; ++ *) ++ # This could be sanity-checked in various ways... ++ target_header_dir="${enable_install_libiberty}" ++ ;; ++esac ++AC_MSG_RESULT($enable_install_libiberty) ++AC_MSG_NOTICE([target_header_dir = $target_header_dir]) ++ + GCC_NO_EXECUTABLES + AC_PROG_CC + AC_SYS_LARGEFILE +@@ -379,7 +404,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +@@ -490,27 +514,6 @@ if test -n "${with_target_subdir}"; then + + esac + +- # We may wish to install the target headers somewhere. +- AC_ARG_ENABLE(install-libiberty, +- [ --enable-install-libiberty Install headers for end users], +- enable_install_libiberty=$enableval, +- enable_install_libiberty=no)dnl +- +- # Option parsed, now set things appropriately. +- case x"$enable_install_libiberty" in +- xyes|x) +- target_header_dir=libiberty +- ;; +- xno) +- target_header_dir= +- ;; +- *) +- # This could be sanity-checked in various ways... +- target_header_dir="${enable_install_libiberty}" +- ;; +- esac +- +- + else + + # Not a target library, so we set things up to run the test suite. +-- +1.9.3 + diff --git a/package/binutils/arc-2015.12/600-poison-system-directories.patch b/package/binutils/arc-2015.12/600-poison-system-directories.patch new file mode 100644 index 0000000000..8a3bdc647c --- /dev/null +++ b/package/binutils/arc-2015.12/600-poison-system-directories.patch @@ -0,0 +1,279 @@ +Patch adapted to binutils arc-4.8-R3 and extended to use +BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni. + +Signed-off-by: Thomas Petazzoni + +Upstream-Status: Inappropriate [distribution: codesourcery] + +Patch originally created by Mark Hatle, forward-ported to +binutils 2.21 by Scott Garman. + +purpose: warn for uses of system directories when cross linking + +Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 + +2008-07-02 Joseph Myers + + ld/ + * ld.h (args_type): Add error_poison_system_directories. + * ld.texinfo (--error-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.error_poison_system_directories. + * ldmain.c (main): Initialize + command_line.error_poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --error-poison-system-directories. + (parse_args): Handle new option. + +2007-06-13 Joseph Myers + + ld/ + * config.in: Regenerate. + * ld.h (args_type): Add poison_system_directories. + * ld.texinfo (--no-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.poison_system_directories. + * ldmain.c (main): Initialize + command_line.poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_NO_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --no-poison-system-directories. + (parse_args): Handle new option. + +2007-04-20 Joseph Myers + + Merge from Sourcery G++ binutils 2.17: + + 2007-03-20 Joseph Myers + Based on patch by Mark Hatle . + ld/ + * configure.in (--enable-poison-system-directories): New option. + * configure, config.in: Regenerate. + * ldfile.c (ldfile_add_library_path): If + ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib, + /usr/lib, /usr/local/lib or /usr/X11R6/lib. + +Signed-off-by: Mark Hatle +Signed-off-by: Scott Garman + +Index: b/ld/config.in +=================================================================== +--- a/ld/config.in ++++ b/ld/config.in +@@ -11,6 +11,9 @@ + language is requested. */ + #undef ENABLE_NLS + ++/* Define to warn for use of native system library directories */ ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES ++ + /* Additional extension a shared object might have. */ + #undef EXTRA_SHLIB_EXTENSION + +Index: b/ld/configure +=================================================================== +--- a/ld/configure ++++ b/ld/configure +@@ -773,6 +773,7 @@ + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_werror +@@ -1428,6 +1429,8 @@ + (and sometimes confusing) to the casual installer + --enable-targets alternative target configurations + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) ++ --enable-poison-system-directories ++ warn for use of native system library directories + --enable-gold[=ARG] build gold [ARG={default,yes,no}] + --enable-got= GOT handling scheme (target, single, negative, + multigot) +@@ -4338,7 +4341,18 @@ + fi + + ++# Check whether --enable-poison-system-directories was given. ++if test "${enable_poison_system_directories+set}" = set; then : ++ enableval=$enable_poison_system_directories; ++else ++ enable_poison_system_directories=no ++fi ++ ++if test "x${enable_poison_system_directories}" = "xyes"; then + ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h ++ ++fi + + # Check whether --enable-got was given. + if test "${enable_got+set}" = set; then : +Index: b/ld/configure.in +=================================================================== +--- a/ld/configure.in ++++ b/ld/configure.in +@@ -70,6 +70,16 @@ + AC_SUBST(TARGET_SYSTEM_ROOT) + AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) + ++AC_ARG_ENABLE([poison-system-directories], ++ AS_HELP_STRING([--enable-poison-system-directories], ++ [warn for use of native system library directories]),, ++ [enable_poison_system_directories=no]) ++if test "x${enable_poison_system_directories}" = "xyes"; then ++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], ++ [1], ++ [Define to warn for use of native system library directories]) ++fi ++ + dnl Use --enable-gold to decide if this linker should be the default. + dnl "install_as_default" is set to false if gold is the default linker. + dnl "installed_linker" is the installed BFD linker name. +Index: b/ld/ldfile.c +=================================================================== +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -116,6 +116,23 @@ + new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); + else + new_dirs->name = xstrdup (name); ++ ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES ++ if (command_line.poison_system_directories ++ && ((!strncmp (name, "/lib", 4)) ++ || (!strncmp (name, "/usr/lib", 8)) ++ || (!strncmp (name, "/usr/local/lib", 14)) ++ || (!strncmp (name, "/usr/X11R6/lib", 14)))) ++ { ++ if (command_line.error_poison_system_directories) ++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ else ++ einfo (_("%P: warning: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ } ++#endif ++ + } + + /* Try to open a BFD for a lang_input_statement. */ +Index: b/ld/ld.h +=================================================================== +--- a/ld/ld.h ++++ b/ld/ld.h +@@ -203,6 +203,14 @@ + /* If TRUE we'll just print the default output on stdout. */ + bfd_boolean print_output_format; + ++ /* If TRUE (the default) warn for uses of system directories when ++ cross linking. */ ++ bfd_boolean poison_system_directories; ++ ++ /* If TRUE (default FALSE) give an error for uses of system ++ directories when cross linking instead of a warning. */ ++ bfd_boolean error_poison_system_directories; ++ + /* Big or little endian as set on command line. */ + enum endian_enum endian; + +Index: b/ld/ldmain.c +=================================================================== +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -265,6 +265,8 @@ + command_line.warn_search_mismatch = TRUE; + command_line.check_section_addresses = -1; + command_line.disable_target_specific_optimizations = -1; ++ command_line.poison_system_directories = TRUE; ++ command_line.error_poison_system_directories = FALSE; + + /* We initialize DEMANGLING based on the environment variable + COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the +Index: b/ld/ld.texinfo +=================================================================== +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -2156,6 +2156,18 @@ + + Passing @code{none} for @var{style} disables the setting from any + @code{--build-id} options earlier on the command line. ++ ++@kindex --no-poison-system-directories ++@item --no-poison-system-directories ++Do not warn for @option{-L} options using system directories such as ++@file{/usr/lib} when cross linking. This option is intended for use ++in chroot environments when such directories contain the correct ++libraries for the target system rather than the host. ++ ++@kindex --error-poison-system-directories ++@item --error-poison-system-directories ++Give an error instead of a warning for @option{-L} options using ++system directories when cross linking. + @end table + + @c man end +Index: b/ld/lexsup.c +=================================================================== +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -498,6 +498,14 @@ + TWO_DASHES }, + { {"wrap", required_argument, NULL, OPTION_WRAP}, + '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES }, ++ { {"no-poison-system-directories", no_argument, NULL, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Do not warn for -L options using system directories"), ++ TWO_DASHES }, ++ { {"error-poison-system-directories", no_argument, NULL, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Give an error for -L options using system directories"), ++ TWO_DASHES }, + }; + + #define OPTION_COUNT ARRAY_SIZE (ld_options) +@@ -510,6 +518,7 @@ + int ingroup = 0; + char *default_dirlist = NULL; + char *shortopts; ++ char *BR_paranoid_env; + struct option *longopts; + struct option *really_longopts; + int last_optind; +@@ -1427,9 +1436,21 @@ + einfo (_("%P%X: --hash-size needs a numeric argument\n")); + } + break; ++ ++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES: ++ command_line.poison_system_directories = FALSE; ++ break; ++ ++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: ++ command_line.error_poison_system_directories = TRUE; ++ break; + } + } + ++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH"); ++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0) ++ command_line.error_poison_system_directories = TRUE; ++ + while (ingroup) + { + lang_leave_group (); +Index: b/ld/ldlex.h +=================================================================== +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -136,6 +136,8 @@ + #endif /* ENABLE_PLUGINS */ + OPTION_DEFAULT_SCRIPT, + OPTION_PRINT_OUTPUT_FORMAT, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, + }; + + /* The initial parser states. */ diff --git a/package/boost/0003-fix-libquadmath-issue.patch b/package/boost/0003-fix-libquadmath-issue.patch new file mode 100644 index 0000000000..49772e828e --- /dev/null +++ b/package/boost/0003-fix-libquadmath-issue.patch @@ -0,0 +1,91 @@ +From 74ff2db959c5fa75bec770c41ed2951a740fe936 Mon Sep 17 00:00:00 2001 +From: jzmaddock +Date: Fri, 1 Jan 2016 16:49:48 +0000 +Subject: [PATCH] Change config to not use it at all if we don't + have __has_include as GCC may be configured with --disable-libquadmath but + still signal that it supports __float128 + +Backported from: 74ff2db959c5fa75bec770c41ed2951a740fe936 + +[Jörg Krause: adjust pathes to match sourceforge release tarball] +Signed-off-by: Jörg Krause + +--- + boost/math/special_functions/fpclassify.hpp | 16 +++++++++++++--- + boost/math/tools/config.hpp | 12 ------------ + 2 files changed, 13 insertions(+), 15 deletions(-) + +diff --git a/boost/math/special_functions/fpclassify.hpp b/boost/math/special_functions/fpclassify.hpp +index 0a4e1ac..58fad13 100644 +--- a/boost/math/special_functions/fpclassify.hpp ++++ b/boost/math/special_functions/fpclassify.hpp +@@ -81,7 +81,12 @@ is used. + #include + #endif + #ifdef BOOST_MATH_USE_FLOAT128 ++#ifdef __has_include ++#if __has_include("quadmath.h") + #include "quadmath.h" ++#define BOOST_MATH_HAS_QUADMATH_H ++#endif ++#endif + #endif + + #ifdef BOOST_NO_STDC_NAMESPACE +@@ -124,9 +129,14 @@ inline bool is_nan_helper(T, const boost::false_type&) + { + return false; + } +-#ifdef BOOST_MATH_USE_FLOAT128 ++#if defined(BOOST_MATH_USE_FLOAT128) ++#if defined(BOOST_MATH_HAS_QUADMATH_H) + inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnanq(f); } + inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnanq(f); } ++#else ++inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnan(static_cast(f)); } ++inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnan(static_cast(f)); } ++#endif + #endif + } + +@@ -519,7 +529,7 @@ inline bool (isinf)(long double x) + return detail::isinf_impl(static_cast(x), method()); + } + #endif +-#ifdef BOOST_MATH_USE_FLOAT128 ++#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H) + template<> + inline bool (isinf)(__float128 x) + { +@@ -611,7 +621,7 @@ inline bool (isnan)(long double x) + return detail::isnan_impl(x, method()); + } + #endif +-#ifdef BOOST_MATH_USE_FLOAT128 ++#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H) + template<> + inline bool (isnan)(__float128 x) + { +diff --git a/boost/math/tools/config.hpp b/boost/math/tools/config.hpp +index ffd0ab4..75d29b6 100644 +--- a/boost/math/tools/config.hpp ++++ b/boost/math/tools/config.hpp +@@ -265,18 +265,6 @@ + # define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF + #endif + // +-// Test whether to support __float128, if we don't have quadmath.h then this can't currently work: +-// +-#ifndef BOOST_MATH_USE_FLOAT128 +-#ifdef __has_include +-#if ! __has_include("quadmath.h") +-#define BOOST_MATH_DISABLE_FLOAT128 +-#endif +-#elif !defined(BOOST_ARCH_X86) +-#define BOOST_MATH_DISABLE_FLOAT128 +-#endif +-#endif +-// + // And then the actual configuration: + // + #if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) \ diff --git a/package/boost/0004-fix-declaration-error-with-gcc-4-4.patch b/package/boost/0004-fix-declaration-error-with-gcc-4-4.patch new file mode 100644 index 0000000000..073ec041dc --- /dev/null +++ b/package/boost/0004-fix-declaration-error-with-gcc-4-4.patch @@ -0,0 +1,50 @@ +From a4e9686f8a0258bc30f9da2abab65673d6b9bd50 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jupp=20M=C3=BCller?= +Date: Wed, 23 Dec 2015 09:18:51 +0100 +Subject: [PATCH] Fix declaration changes meaning error with GCC 4.4.7 (#11856) + +Backported from a4e9686f8a0258bc30f9da2abab65673d6b9bd50 + +[Jörg Krause: adjust pathes to match sourceforge release tarball] +Signed-off-by: Jörg Krause + +--- + libs/container/src/pool_resource.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libs/container/src/pool_resource.cpp b/libs/container/src/pool_resource.cpp +index 4df7ee2..45f1564 100644 +--- a/libs/container/src/pool_resource.cpp ++++ b/libs/container/src/pool_resource.cpp +@@ -32,11 +32,11 @@ namespace pmr { + class pool_data_t + : public block_slist_base<> + { +- typedef block_slist_base<> block_slist_base; ++ typedef block_slist_base<> block_slist_base_t; + + public: + explicit pool_data_t(std::size_t initial_blocks_per_chunk) +- : block_slist_base(), next_blocks_per_chunk(initial_blocks_per_chunk) ++ : block_slist_base_t(), next_blocks_per_chunk(initial_blocks_per_chunk) + { slist_algo::init_header(&free_slist); } + + void *allocate_block() BOOST_NOEXCEPT +@@ -59,7 +59,7 @@ class pool_data_t + void release(memory_resource &upstream) + { + slist_algo::init_header(&free_slist); +- this->block_slist_base::release(upstream); ++ this->block_slist_base_t::release(upstream); + next_blocks_per_chunk = pool_options_minimum_max_blocks_per_chunk; + } + +@@ -72,7 +72,7 @@ class pool_data_t + + //Minimum block size is at least max_align, so all pools allocate sizes that are multiple of max_align, + //meaning that all blocks are max_align-aligned. +- char *p = static_cast(block_slist_base::allocate(blocks_per_chunk*pool_block, mr)); ++ char *p = static_cast(block_slist_base_t::allocate(blocks_per_chunk*pool_block, mr)); + + //Create header types. This is no-throw + for(std::size_t i = 0, max = blocks_per_chunk; i != max; ++i){ diff --git a/package/boost/0005-fix-undeclared-isnan.patch b/package/boost/0005-fix-undeclared-isnan.patch new file mode 100644 index 0000000000..95d8fedc78 --- /dev/null +++ b/package/boost/0005-fix-undeclared-isnan.patch @@ -0,0 +1,32 @@ +From fbd1393858719c7bda7d251f742950c1bc691ea8 Mon Sep 17 00:00:00 2001 +From: Kohei Takahashi +Date: Wed, 6 Jan 2016 19:39:55 +0900 +Subject: [PATCH] Qualify std:: for isnan in some situation. + +Because isnan is implemented as a macro and libstdc++ undef it within + (at least FreeBSD 10). + +Backported from fbd1393858719c7bda7d251f742950c1bc691ea8 + +[Jörg Krause: adjust pathes to match sourceforge release tarball] +Signed-off-by: Jörg Krause + +--- + boost/math/special_functions/fpclassify.hpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/boost/math/special_functions/fpclassify.hpp b/boost/math/special_functions/fpclassify.hpp +index 58fad13..d83e111 100644 +--- a/boost/math/special_functions/fpclassify.hpp ++++ b/boost/math/special_functions/fpclassify.hpp +@@ -133,6 +133,10 @@ inline bool is_nan_helper(T, const boost::false_type&) + #if defined(BOOST_MATH_HAS_QUADMATH_H) + inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnanq(f); } + inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnanq(f); } ++#elif defined(BOOST_GNU_STDLIB) && BOOST_GNU_STDLIB && \ ++ _GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC ++inline bool is_nan_helper(__float128 f, const boost::true_type&) { return std::isnan(static_cast(f)); } ++inline bool is_nan_helper(__float128 f, const boost::false_type&) { return std::isnan(static_cast(f)); } + #else + inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnan(static_cast(f)); } + inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnan(static_cast(f)); } diff --git a/package/boost/0006-fenv.patch b/package/boost/0006-fenv.patch new file mode 100644 index 0000000000..95c769aea2 --- /dev/null +++ b/package/boost/0006-fenv.patch @@ -0,0 +1,37 @@ +Disable fenv.h in certain configurations + +The boost build system does not properly test whether fenv.h is +available, and if it is, if it supports all the features used by +Boost. This causes build failures with uClibc (reported upstream at +https://svn.boost.org/trac/boost/ticket/11756) but also with glibc on +specific architectures that don't have a full fenv implementation, +such as NIOSII or Microblaze. + +To address this, we forcefully disable the use of fenv support in the +affected configurations. + +Signed-off-by: Bernd Kuhls +[Thomas: add Microblaze/NIOSII exclusions.] +Signed-off-by: Thomas Petazzoni + +Index: b/boost/config/platform/linux.hpp +=================================================================== +--- a/boost/config/platform/linux.hpp ++++ b/boost/config/platform/linux.hpp +@@ -47,6 +47,16 @@ + #endif + + // ++// uClibc has no support for fenv.h, and also a few architectures ++// don't have fenv.h support at all (or incomplete support) even with ++// glibc. ++ ++// ++#if defined(__UCLIBC__) || defined(__nios2__) || defined(__microblaze__) ++# define BOOST_NO_FENV_H ++#endif ++ ++// + // If glibc is past version 2 then we definitely have + // gettimeofday, earlier versions may or may not have it: + // diff --git a/package/boost/0007-fix-getchar-with-uclibc-and-gcc-bug-58952.patch b/package/boost/0007-fix-getchar-with-uclibc-and-gcc-bug-58952.patch new file mode 100644 index 0000000000..960f0ea2f9 --- /dev/null +++ b/package/boost/0007-fix-getchar-with-uclibc-and-gcc-bug-58952.patch @@ -0,0 +1,45 @@ +From 4f1c6784b37a11c78fe84bb238fb7cc377ce0d36 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Wed, 30 Mar 2016 23:28:33 +0200 +Subject: [PATCH] Fix for uClibc and gcc <= 4.8.2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +getchar() is defined as a macro in uClibc. This hits gcc bug 58952 [1] for all +gcc version <= 4.8.2 and building boost/test fails: + +./boost/test/impl/unit_test_main.ipp: In function 'int boost::unit_test::unit_test_main(boost::unit_test::init_unit_test_func, int, char**)': +./boost/test/impl/unit_test_main.ipp:194:18: error: expected unqualified-id before '(' token + +To allow building boost/test with uClibc based toolchains with gcc <= 4.8.2 use +parenthesis for std::getchar. + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58952 + +Upstream status: Pending +https://github.com/boostorg/test/pull/97 + +Signed-off-by: Jörg Krause +--- + include/boost/test/impl/unit_test_main.ipp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/boost/test/impl/unit_test_main.ipp b/boost/test/impl/unit_test_main.ipp +index 1f30c02..db61930 100644 +--- a/boost/test/impl/unit_test_main.ipp ++++ b/boost/test/impl/unit_test_main.ipp +@@ -191,7 +191,9 @@ unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ) + if( runtime_config::get( runtime_config::WAIT_FOR_DEBUGGER ) ) { + results_reporter::get_stream() << "Press any key to continue..." << std::endl; + +- std::getchar(); ++ // getchar is defined as a macro in uClibc. Use parenthesis to fix ++ // gcc bug 58952 for gcc <= 4.8.2. ++ (std::getchar)(); + results_reporter::get_stream() << "Continuing..." << std::endl; + } + +-- +2.7.4 + diff --git a/package/bridge-utils/0002-fix-for-kernel-headers-3.8+.patch b/package/bridge-utils/0002-fix-for-kernel-headers-3.8+.patch new file mode 100644 index 0000000000..0455a9085c --- /dev/null +++ b/package/bridge-utils/0002-fix-for-kernel-headers-3.8+.patch @@ -0,0 +1,30 @@ +commit 5eebb7f9288b7881ffb929b1fd494fe3ac3be27d +Author: Russell Senior +Date: Wed Mar 6 12:49:42 2013 -0800 + + bridge-utils: Fix compile against linux-3.8.x + + Linux 3.8 has a header, include/uapi/linux/if_bridge.h that uses a + struct in6_addr but doesn't define it. The trivial seeming fix of + including the header that does define it causes more problems. The + problem was discussed on mailing lists in January 2013. The final + suggestion I found was here: + + http://www.redhat.com/archives/libvir-list/2013-January/msg01253.html + + This is intended to implement that suggestion. + + Signed-off-by: Russell Senior + +diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h +index 39964f2..dd14bae 100644 +--- a/libbridge/libbridge.h ++++ b/libbridge/libbridge.h +@@ -20,6 +20,7 @@ + #define _LIBBRIDGE_H + + #include ++#include + #include + #include + diff --git a/package/bridge-utils/0003-sysfs-write-fixes.patch b/package/bridge-utils/0003-sysfs-write-fixes.patch new file mode 100644 index 0000000000..a7ff1979f5 --- /dev/null +++ b/package/bridge-utils/0003-sysfs-write-fixes.patch @@ -0,0 +1,81 @@ +commit bb9970a9df95837e39d680021b1f73d231e85406 +Author: Stephen Hemminger +Date: Tue May 3 09:52:43 2011 -0700 + + Check error returns from write to sysfs + + Add helper function to check write to sysfs files. + + Fix incorrect sysfs path in br_set. + +[Thomas De Schampheleire: update commit message only] +Signed-off-by: Thomas De Schampheleire + +diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c +index aa8bc36..1e83925 100644 +--- a/libbridge/libbridge_devif.c ++++ b/libbridge/libbridge_devif.c +@@ -280,25 +280,38 @@ fallback: + return old_get_port_info(brname, port, info); + } + ++static int set_sysfs(const char *path, unsigned long value) ++{ ++ int fd, ret = 0, cc; ++ char buf[32]; ++ ++ fd = open(path, O_WRONLY); ++ if (fd < 0) ++ return -1; ++ ++ cc = snprintf(buf, sizeof(buf), "%lu\n", value); ++ if (write(fd, buf, cc) < 0) ++ ret = -1; ++ close(fd); ++ ++ return ret; ++} ++ + + static int br_set(const char *bridge, const char *name, + unsigned long value, unsigned long oldcode) + { + int ret; + char path[SYSFS_PATH_MAX]; +- FILE *f; + +- snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/%s", bridge, name); ++ snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge/%s", ++ bridge, name); + +- f = fopen(path, "w"); +- if (f) { +- ret = fprintf(f, "%ld\n", value); +- fclose(f); +- } else { ++ if ((ret = set_sysfs(path, value)) < 0) { + /* fallback to old ioctl */ + struct ifreq ifr; + unsigned long args[4] = { oldcode, value, 0, 0 }; +- ++ + strncpy(ifr.ifr_name, bridge, IFNAMSIZ); + ifr.ifr_data = (char *) &args; + ret = ioctl(br_socket_fd, SIOCDEVPRIVATE, &ifr); +@@ -348,14 +361,10 @@ static int port_set(const char *bridge, const char *ifname, + { + int ret; + char path[SYSFS_PATH_MAX]; +- FILE *f; + + snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brport/%s", ifname, name); +- f = fopen(path, "w"); +- if (f) { +- ret = fprintf(f, "%ld\n", value); +- fclose(f); +- } else { ++ ++ if ((ret = set_sysfs(path, value)) < 0) { + int index = get_portno(bridge, ifname); + + if (index < 0) diff --git a/package/btrfs-progs/0001-configure-refactor-backtrace-detection.patch b/package/btrfs-progs/0001-configure-refactor-backtrace-detection.patch new file mode 100644 index 0000000000..0f834ded94 --- /dev/null +++ b/package/btrfs-progs/0001-configure-refactor-backtrace-detection.patch @@ -0,0 +1,132 @@ +From 9bef473d17ec01efe760462271791dfaaea280c0 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 29 Jul 2015 22:35:19 +0200 +Subject: [PATCH 1/3] configure: refactor backtrace() detection + +The current code assumes that if __GLIBC__ is not defined, backtrace +support is not available, and defines BTRFS_DISABLE_BACKTRACE. + +However, this macro is already defined by the configure.ac script when +--disable-backtrace is passed. This means that if you are using a C +library like musl which does not define __GLIBC__, and you pass +--disable-backtrace, you get a macro redefinition. + +Instead of relying on __GLIBC__, this commit implements a proper +configure.ac based detection of backtrace support: + + * If the user passes --enable-backtrace, we check if the backtrace() + function is available. If not, we abort the configure process with + an error. Otherwise we enable backtrace support by defining + HAVE_BACKTRACE. + + * If the user passes --disable-backtrace, then we don't enable + backtrace support. + + * If the user passes nothing special, we auto-detect: if backtrace() + is available, we use it, otherwise we simply warn at configure time + but not fail. + +Upstream-status: pending +Signed-off-by: Thomas Petazzoni +Signed-off-by: Brendan Heading +--- + configure.ac | 32 ++++++++++++++++++++++---------- + kerncompat.h | 9 ++++----- + 2 files changed, 26 insertions(+), 15 deletions(-) + +diff --git a/configure.ac b/configure.ac +index c3a22d1..e936a10 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -63,22 +63,34 @@ AC_DEFUN([PKG_STATIC], [ + fi + ]) + +- ++# Provide a --{enable,disable}-backtrace option. If not passed, set ++# enable_backtrace to 'auto' so that we try to enable backtrace ++# support if available, but if not available, we gracefully fallback ++# without backtrace support. + AC_ARG_ENABLE([backtrace], + AS_HELP_STRING([--disable-backtrace], [disable btrfs backtrace]), +- [], [enable_backtrace=yes] ++ [enable_backtrace=${enableval}], [enable_backtrace=auto] + ) + +-AS_IF([test "x$enable_backtrace" = xno], [ +- AC_DEFINE([BTRFS_DISABLE_BACKTRACE], [1], [disable backtrace stuff in kerncompat.h ]) +-]) +- +-if test "x$enable_backtrace" = xyes; then +- AC_CHECK_HEADERS([execinfo.h]) +- AC_CHECK_FUNCS([backtrace backtrace_symbols_fd], [], +- AC_MSG_ERROR([standard library does not have backtrace support])) ++# Backtrace support requested (enable_backtrace is either 'yes' or ++# 'auto'), so check for needed headers and functions. ++if test "x$enable_backtrace" != xno; then ++ AC_CHECK_HEADERS([execinfo.h]) ++ AC_CHECK_FUNCS([backtrace backtrace_symbols_fd]) + fi + ++if test "x$ac_cv_func_backtrace" = xno; then ++ # If backtrace support was requested but not available, we fail if ++ # --enable-backtrace was passed, or we simply warn if we're ++ # auto-detecting. ++ if test "x$enable_backtrace" = xyes ; then ++ AC_MSG_ERROR([standard library does not have backtrace support]) ++ elif test "x$enable_backtrace" = xauto ; then ++ AC_MSG_WARN([standard library does not have backtrace support, disabled]) ++ fi ++else ++ AC_DEFINE([HAVE_BACKTRACE], [1], [Enable backtrace support]) ++fi + + AC_ARG_ENABLE([documentation], + AS_HELP_STRING([--disable-documentation], [do not build domumentation]), +diff --git a/kerncompat.h b/kerncompat.h +index 5d92856..8318665 100644 +--- a/kerncompat.h ++++ b/kerncompat.h +@@ -33,11 +33,10 @@ + #include + + #ifndef __GLIBC__ +-#define BTRFS_DISABLE_BACKTRACE + #define __always_inline __inline __attribute__ ((__always_inline__)) + #endif + +-#ifndef BTRFS_DISABLE_BACKTRACE ++#ifdef HAVE_BACKTRACE + #include + #endif + +@@ -65,7 +64,7 @@ + #define ULONG_MAX (~0UL) + #endif + +-#ifndef BTRFS_DISABLE_BACKTRACE ++#ifdef HAVE_BACKTRACE + #define MAX_BACKTRACE 16 + static inline void print_trace(void) + { +@@ -285,7 +284,7 @@ static inline long IS_ERR(const void *ptr) + #define vmalloc(x) malloc(x) + #define vfree(x) free(x) + +-#ifndef BTRFS_DISABLE_BACKTRACE ++#ifdef HAVE_BACKTRACE + #define BUG_ON(c) assert_trace(#c, __FILE__, __func__, __LINE__, !(c)) + #else + #define BUG_ON(c) assert(!(c)) +@@ -293,7 +292,7 @@ static inline long IS_ERR(const void *ptr) + + #define WARN_ON(c) BUG_ON(c) + +-#ifndef BTRFS_DISABLE_BACKTRACE ++#ifdef HAVE_BACKTRACE + #define ASSERT(c) assert_trace(#c, __FILE__, __func__, __LINE__, (c)) + #else + #define ASSERT(c) assert(c) +-- +2.4.3 + diff --git a/package/btrfs-progs/0002-configure-refactor-always_inline-detection.patch b/package/btrfs-progs/0002-configure-refactor-always_inline-detection.patch new file mode 100644 index 0000000000..f54d2501a2 --- /dev/null +++ b/package/btrfs-progs/0002-configure-refactor-always_inline-detection.patch @@ -0,0 +1,42 @@ +From 1d99ae25bb1bd4879c6f20f607faf3040018ee84 Mon Sep 17 00:00:00 2001 +From: Brendan Heading +Date: Thu, 30 Jul 2015 15:44:52 +0100 +Subject: [PATCH 2/3] configure: refactor always_inline detection + +Use configure.ac to detect the availability of the always_inline glibc +macro, and define it only if it does not exist. + +Signed-off-by: Brendan Heading +--- + configure.ac | 1 + + kerncompat.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index e936a10..d3d81a1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -41,6 +41,7 @@ AC_PATH_PROG([RMDIR], [rmdir], [rmdir]) + + AC_CHECK_FUNCS([openat], [], + [AC_MSG_ERROR([cannot find openat() function])]) ++AC_CHECK_DECLS([__always_inline]) + + m4_ifndef([PKG_PROG_PKG_CONFIG], + [m4_fatal([Could not locate the pkg-config autoconf +diff --git a/kerncompat.h b/kerncompat.h +index 8318665..757b9b4 100644 +--- a/kerncompat.h ++++ b/kerncompat.h +@@ -32,7 +32,7 @@ + + #include + +-#ifndef __GLIBC__ ++#ifndef HAVE_DECL___ALWAYS_INLINE + #define __always_inline __inline __attribute__ ((__always_inline__)) + #endif + +-- +2.4.3 + diff --git a/package/btrfs-progs/0003-compile-fix-undefined-PATH_MAX-under-musl.patch b/package/btrfs-progs/0003-compile-fix-undefined-PATH_MAX-under-musl.patch new file mode 100644 index 0000000000..35260148b2 --- /dev/null +++ b/package/btrfs-progs/0003-compile-fix-undefined-PATH_MAX-under-musl.patch @@ -0,0 +1,67 @@ +From 3197a4b058615d81aa4623fb5a52e57d7fbc3af2 Mon Sep 17 00:00:00 2001 +From: Brendan Heading +Date: Thu, 30 Jul 2015 15:47:16 +0100 +Subject: [PATCH 3/3] compile: fix undefined PATH_MAX under musl + +musl's strict implementation requires #include for PATH_MAX. + +Upstream-status: submitted +Signed-off-by: Brendan Heading +--- + cmds-inspect.c | 1 + + cmds-receive.c | 1 + + cmds-scrub.c | 1 + + cmds-send.c | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/cmds-inspect.c b/cmds-inspect.c +index 71451fe..9712581 100644 +--- a/cmds-inspect.c ++++ b/cmds-inspect.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include "kerncompat.h" + #include "ioctl.h" +diff --git a/cmds-receive.c b/cmds-receive.c +index 071bea9..d4b3103 100644 +--- a/cmds-receive.c ++++ b/cmds-receive.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #include + #include +diff --git a/cmds-scrub.c b/cmds-scrub.c +index b7aa809..5a85dc4 100644 +--- a/cmds-scrub.c ++++ b/cmds-scrub.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #include "ctree.h" + #include "ioctl.h" +diff --git a/cmds-send.c b/cmds-send.c +index 20bba18..a0b7f95 100644 +--- a/cmds-send.c ++++ b/cmds-send.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include "ctree.h" + #include "ioctl.h" +-- +2.4.3 + diff --git a/package/busybox/0003-ash-recursive-heredocs.patch b/package/busybox/0003-ash-recursive-heredocs.patch new file mode 100644 index 0000000000..f054a90375 --- /dev/null +++ b/package/busybox/0003-ash-recursive-heredocs.patch @@ -0,0 +1,84 @@ +From 4194c2875310c13ee3ca2bb0e1aea6a2ae67c55a Mon Sep 17 00:00:00 2001 +From: Ron Yorston +Date: Thu, 29 Oct 2015 16:44:56 +0000 +Subject: [PATCH] ash: fix error during recursive processing of here document + +Save the value of the checkkwd flag to prevent it being clobbered +during recursion. + +Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git +by Herbert Xu. + +function old new delta +readtoken 190 203 +13 +------------------------------------------------------------------------------ +(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes + +Signed-off-by: Ron Yorston +Signed-off-by: Denys Vlasenko +Signed-off-by: Mike Frysinger +(cherry picked from commit 713f07d906d9171953be0c12e2369869855b6ca6) +Signed-off-by: Gustavo Zacarias +--- + shell/ash.c | 5 +++-- + shell/ash_test/ash-heredoc/heredoc3.right | 1 + + shell/ash_test/ash-heredoc/heredoc3.tests | 9 +++++++++ + 3 files changed, 13 insertions(+), 2 deletions(-) + create mode 100644 shell/ash_test/ash-heredoc/heredoc3.right + create mode 100755 shell/ash_test/ash-heredoc/heredoc3.tests + +diff --git a/shell/ash.c b/shell/ash.c +index 8a1628e..256e933 100644 +--- a/shell/ash.c ++++ b/shell/ash.c +@@ -11893,6 +11893,7 @@ static int + readtoken(void) + { + int t; ++ int kwd = checkkwd; + #if DEBUG + smallint alreadyseen = tokpushback; + #endif +@@ -11906,7 +11907,7 @@ readtoken(void) + /* + * eat newlines + */ +- if (checkkwd & CHKNL) { ++ if (kwd & CHKNL) { + while (t == TNL) { + parseheredoc(); + t = xxreadtoken(); +@@ -11920,7 +11921,7 @@ readtoken(void) + /* + * check for keywords + */ +- if (checkkwd & CHKKWD) { ++ if (kwd & CHKKWD) { + const char *const *pp; + + pp = findkwd(wordtext); +diff --git a/shell/ash_test/ash-heredoc/heredoc3.right b/shell/ash_test/ash-heredoc/heredoc3.right +new file mode 100644 +index 0000000..ce01362 +--- /dev/null ++++ b/shell/ash_test/ash-heredoc/heredoc3.right +@@ -0,0 +1 @@ ++hello +diff --git a/shell/ash_test/ash-heredoc/heredoc3.tests b/shell/ash_test/ash-heredoc/heredoc3.tests +new file mode 100755 +index 0000000..96c227c +--- /dev/null ++++ b/shell/ash_test/ash-heredoc/heredoc3.tests +@@ -0,0 +1,9 @@ ++echo hello >greeting ++cat </dev/null ++rm greeting +-- +2.7.4 + diff --git a/package/busybox/0004-fix-CVE-2016-2147.patch b/package/busybox/0004-fix-CVE-2016-2147.patch new file mode 100644 index 0000000000..bd1e47ecf4 --- /dev/null +++ b/package/busybox/0004-fix-CVE-2016-2147.patch @@ -0,0 +1,73 @@ +From 3c4de6e36c4d387a648622e7b828a05f2b1b47e6 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Fri, 26 Feb 2016 15:54:56 +0100 +Subject: [PATCH] udhcpc: fix OPTION_6RD parsing (could overflow its malloced + buffer) + +Signed-off-by: Denys Vlasenko +Signed-off-by: Mike Frysinger +(cherry picked from commit 352f79acbd759c14399e39baef21fc4ffe180ac2) +Signed-off-by: Gustavo Zacarias +--- + networking/udhcp/common.c | 15 +++++++++++++-- + networking/udhcp/dhcpc.c | 4 ++-- + 2 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c +index bc41c8d..680852c 100644 +--- a/networking/udhcp/common.c ++++ b/networking/udhcp/common.c +@@ -142,7 +142,7 @@ const char dhcp_option_strings[] ALIGN1 = + * udhcp_str2optset: to determine how many bytes to allocate. + * xmalloc_optname_optval: to estimate string length + * from binary option length: (option[LEN] / dhcp_option_lengths[opt_type]) +- * is the number of elements, multiply in by one element's string width ++ * is the number of elements, multiply it by one element's string width + * (len_of_option_as_string[opt_type]) and you know how wide string you need. + */ + const uint8_t dhcp_option_lengths[] ALIGN1 = { +@@ -162,7 +162,18 @@ const uint8_t dhcp_option_lengths[] ALIGN1 = { + [OPTION_S32] = 4, + /* Just like OPTION_STRING, we use minimum length here */ + [OPTION_STATIC_ROUTES] = 5, +- [OPTION_6RD] = 22, /* ignored by udhcp_str2optset */ ++ [OPTION_6RD] = 12, /* ignored by udhcp_str2optset */ ++ /* The above value was chosen as follows: ++ * len_of_option_as_string[] for this option is >60: it's a string of the form ++ * "32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 ". ++ * Each additional ipv4 address takes 4 bytes in binary option and appends ++ * another "255.255.255.255 " 16-byte string. We can set [OPTION_6RD] = 4 ++ * but this severely overestimates string length: instead of 16 bytes, ++ * it adds >60 for every 4 bytes in binary option. ++ * We cheat and declare here that option is in units of 12 bytes. ++ * This adds more than 60 bytes for every three ipv4 addresses - more than enough. ++ * (Even 16 instead of 12 should work, but let's be paranoid). ++ */ + }; + + +diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c +index 915f659..2332b57 100644 +--- a/networking/udhcp/dhcpc.c ++++ b/networking/udhcp/dhcpc.c +@@ -113,7 +113,7 @@ static const uint8_t len_of_option_as_string[] = { + [OPTION_IP ] = sizeof("255.255.255.255 "), + [OPTION_IP_PAIR ] = sizeof("255.255.255.255 ") * 2, + [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "), +- [OPTION_6RD ] = sizeof("32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), ++ [OPTION_6RD ] = sizeof("132 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), + [OPTION_STRING ] = 1, + [OPTION_STRING_HOST ] = 1, + #if ENABLE_FEATURE_UDHCP_RFC3397 +@@ -220,7 +220,7 @@ static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_ + type = optflag->flags & OPTION_TYPE_MASK; + optlen = dhcp_option_lengths[type]; + upper_length = len_of_option_as_string[type] +- * ((unsigned)(len + optlen - 1) / (unsigned)optlen); ++ * ((unsigned)(len + optlen) / (unsigned)optlen); + + dest = ret = xmalloc(upper_length + strlen(opt_name) + 2); + dest += sprintf(ret, "%s=", opt_name); +-- +2.7.4 + diff --git a/package/busybox/0005-fix-CVE-2016-2148.patch b/package/busybox/0005-fix-CVE-2016-2148.patch new file mode 100644 index 0000000000..93eff484d4 --- /dev/null +++ b/package/busybox/0005-fix-CVE-2016-2148.patch @@ -0,0 +1,56 @@ +From 3a76bb5136d05f94ee62e377aa723e63444912c7 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Thu, 10 Mar 2016 11:47:58 +0100 +Subject: [PATCH] udhcp: fix a SEGV on malformed RFC1035-encoded domain name + +Signed-off-by: Denys Vlasenko +Signed-off-by: Mike Frysinger +(cherry picked from commit d474ffc68290e0a83651c4432eeabfa62cd51e87) +Signed-off-by: Gustavo Zacarias +--- + networking/udhcp/domain_codec.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c +index c1325d8..8429367 100644 +--- a/networking/udhcp/domain_codec.c ++++ b/networking/udhcp/domain_codec.c +@@ -63,11 +63,10 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre) + if (crtpos + *c + 1 > clen) /* label too long? abort */ + return NULL; + if (dst) +- memcpy(dst + len, c + 1, *c); ++ /* \3com ---> "com." */ ++ ((char*)mempcpy(dst + len, c + 1, *c))[0] = '.'; + len += *c + 1; + crtpos += *c + 1; +- if (dst) +- dst[len - 1] = '.'; + } else { + /* NUL: end of current domain name */ + if (retpos == 0) { +@@ -78,7 +77,10 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre) + crtpos = retpos; + retpos = depth = 0; + } +- if (dst) ++ if (dst && len != 0) ++ /* \4host\3com\0\4host and we are at \0: ++ * \3com was converted to "com.", change dot to space. ++ */ + dst[len - 1] = ' '; + } + +@@ -228,6 +230,9 @@ int main(int argc, char **argv) + int len; + uint8_t *encoded; + ++ uint8_t str[6] = { 0x00, 0x00, 0x02, 0x65, 0x65, 0x00 }; ++ printf("NUL:'%s'\n", dname_dec(str, 6, "")); ++ + #define DNAME_DEC(encoded,pre) dname_dec((uint8_t*)(encoded), sizeof(encoded), (pre)) + printf("'%s'\n", DNAME_DEC("\4host\3com\0", "test1:")); + printf("test2:'%s'\n", DNAME_DEC("\4host\3com\0\4host\3com\0", "")); +-- +2.7.4 + diff --git a/package/conntrack-tools/0001-src-fix-build-with-musl-libc.patch b/package/conntrack-tools/0001-src-fix-build-with-musl-libc.patch new file mode 100644 index 0000000000..5881f98721 --- /dev/null +++ b/package/conntrack-tools/0001-src-fix-build-with-musl-libc.patch @@ -0,0 +1,37 @@ +From d7b20d9bbed23a7a7e40af2f5e78f37ff67e8d93 Mon Sep 17 00:00:00 2001 +From: Rodrigo Rebello +Date: Mon, 23 Nov 2015 02:12:48 -0200 +Subject: [PATCH] src: fix build with musl libc + +The GNU version of 'struct tcphdr' is not exposed by musl libc headers +unless _GNU_SOURCE is defined. Without this definition, the build fails +with: + + rpc.c: In function 'rpc_helper_cb': + rpc.c:351:15: error: 'struct tcphdr' has no member named 'doff' + offset += th->doff * 4; + ^ + +Upstream status: sent +http://patchwork.ozlabs.org/patch/547376/ + +Signed-off-by: Rodrigo Rebello +--- + src/helpers/rpc.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/helpers/rpc.c b/src/helpers/rpc.c +index 82493c2..3a7b337 100644 +--- a/src/helpers/rpc.c ++++ b/src/helpers/rpc.c +@@ -28,6 +28,7 @@ + + #include + #include ++#define _GNU_SOURCE + #include + #include + +-- +2.1.4 + diff --git a/package/cups/0004-remove-pie.patch b/package/cups/0004-remove-pie.patch new file mode 100644 index 0000000000..3d81941ef4 --- /dev/null +++ b/package/cups/0004-remove-pie.patch @@ -0,0 +1,21 @@ +Remove PIE flags from the build + +Generating a statically linked binary built with PIE requires the +Scrt1.o file, which isn't part of Buildroot uClibc toolchains. To +solve this, we simply disable the PIE flags. + +Signed-off-by: Thomas Petazzoni + +Index: b/Makedefs.in +=================================================================== +--- a/Makedefs.in ++++ b/Makedefs.in +@@ -142,7 +142,7 @@ + IPPFIND_MAN = @IPPFIND_MAN@ + LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \ + -L../scheduler @LDARCHFLAGS@ \ +- @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM) ++ @LDFLAGS@ @RELROFLAGS@ $(OPTIM) + LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(LIBZ) + LINKCUPSIMAGE = @LINKCUPSIMAGE@ + LIBS = $(LINKCUPS) $(COMMONLIBS) diff --git a/package/dhcp/0001-dhcp-cross-compile.patch b/package/dhcp/0001-dhcp-cross-compile.patch new file mode 100644 index 0000000000..95b468915f --- /dev/null +++ b/package/dhcp/0001-dhcp-cross-compile.patch @@ -0,0 +1,34 @@ +dhcp cross compile support integration + +Allow BINDCONFIG to be initialized in environment passed to configure. + +Allow archiver to be determined during configure. + +This patch is submitted upstream as part of a cross compiling enhancement +suggestion to dhcp-suggest@isc.org. Reference ISC-Bugs #41502. + +Signed-off-by: Doug Kehn + +Index: dhcp-4.3.3-P1/configure.ac +=================================================================== +--- dhcp-4.3.3-P1.orig/configure.ac ++++ dhcp-4.3.3-P1/configure.ac +@@ -33,7 +33,7 @@ if test "$GCC" = "yes"; then + fi + + # We can have some flags to pass to bind configure +-BINDCONFIG= ++BINDCONFIG="$BINDCONFIG" + AC_SUBST(BINDCONFIG) + + # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides +@@ -43,6 +43,9 @@ AC_SUBST(BINDCONFIG) + # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API. + AC_USE_SYSTEM_EXTENSIONS + ++AC_CHECK_TOOL(AR,ar) ++AC_SUBST(AR) ++ + AC_PROG_RANLIB + AC_CONFIG_HEADERS([includes/config.h]) + diff --git a/package/dhcp/0003-bind-host-cc.patch b/package/dhcp/0003-bind-host-cc.patch new file mode 100644 index 0000000000..96c144fffb --- /dev/null +++ b/package/dhcp/0003-bind-host-cc.patch @@ -0,0 +1,40 @@ +ensure host compiler is used + +dns/Makefile.in patch is derived from: +http://wiki.beyondlogic.org/patches/dhcp-4.3.0b1.bind_arm-linux-gnueabi.patch + +This patch is already accepted upstream and will be included in the next +release: +--[snip]-- +From Francis Dupont via RT +To rdkehn@yahoo.com + +Message body +It was fixed on the master branch sometimes ago. +Quoting master RELNOTES: + +- Made the embedded bind libraries able to be cross compiled + (please refer to the bind9 documentation to learn how to cross + compile DHCP and its bind library dependency). + [ISC-Bugs #38836] + +This is in the Changes since 4.3.3 so for the next release. +--[snip]-- + +Signed-off-by: Doug Kehn + +Index: dhcp-4.3.3-P1/bind/bind-9.9.7-P3/lib/export/dns/Makefile.in +=================================================================== +--- dhcp-4.3.3-P1.orig/bind/bind-9.9.7-P3/lib/export/dns/Makefile.in ++++ dhcp-4.3.3-P1/bind/bind-9.9.7-P3/lib/export/dns/Makefile.in +@@ -168,7 +168,9 @@ code.h: gen + ./gen -s ${srcdir} > code.h + + gen: ${srcdir}/gen.c +- ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS} ++ ${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \ ++ ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c \ ++ ${BUILD_LIBS} + + #We don't need rbtdb64 for this library + #rbtdb64.@O@: rbtdb.c diff --git a/package/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch b/package/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch new file mode 100644 index 0000000000..34ebc240b5 --- /dev/null +++ b/package/dosfstools/0001-mkfs.fat-fix-incorrect-int-type.patch @@ -0,0 +1,45 @@ +From 7a589ef6dab52ad32a296939f0ed2acb4d76b2a7 Mon Sep 17 00:00:00 2001 +From: "Yann E. MORIN" +Date: Sun, 16 Aug 2015 15:55:43 +0200 +Subject: [PATCH] mkfs.fat: fix incorrect int type + +u_int32_t is not a stanard type, while uint32_t is. This fixes builds +with the musl C library, which only defines so-called "clean" headers; +build failures are like (back-quotes and elision manually added for +readability): + + http://autobuild.buildroot.org/results/a09/a0923d7f6d4dbae02eba4c5024bbdae3a52aa85a/build-end.log + + /home/peko/autobuild/instance-1/output/host/usr/bin/x86_64-linux-gcc -D_LARGEFILE_SOURCE \ + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -D_GNU_SOURCE -D_LARGEFILE_SOURCE \ + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o mkfs.fat.o src/mkfs.fat.c + src/mkfs.fat.c: In function 'main': + src/mkfs.fat.c:1415:18: error: 'u_int32_t' undeclared (first use in this function) + volume_id = (u_int32_t) ((create_timeval.tv_sec << 20) | create_timeval.tv_usec); [...] + ^ + src/mkfs.fat.c:1415:18: note: each undeclared identifier is reported only once for each + function it appears in + +Signed-off-by: "Yann E. MORIN" +--- +Upstream status: applied: https://github.com/dosfstools/dosfstools/pull/9 +--- + src/mkfs.fat.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c +index b38d116..dddbe24 100644 +--- a/src/mkfs.fat.c ++++ b/src/mkfs.fat.c +@@ -1412,7 +1412,7 @@ int main(int argc, char **argv) + + gettimeofday(&create_timeval, NULL); + create_time = create_timeval.tv_sec; +- volume_id = (u_int32_t) ((create_timeval.tv_sec << 20) | create_timeval.tv_usec); /* Default volume ID = creation time, fudged for more uniqueness */ ++ volume_id = (uint32_t) ((create_timeval.tv_sec << 20) | create_timeval.tv_usec); /* Default volume ID = creation time, fudged for more uniqueness */ + check_atari(); + + printf("mkfs.fat " VERSION " (" VERSION_DATE ")\n"); +-- +1.9.1 + diff --git a/package/elementary/Config.in b/package/elementary/Config.in new file mode 100644 index 0000000000..f356784731 --- /dev/null +++ b/package/elementary/Config.in @@ -0,0 +1,15 @@ +config BR2_PACKAGE_ELEMENTARY + bool "elementary" + depends on BR2_PACKAGE_EFL + depends on BR2_TOOLCHAIN_HAS_THREADS # elm_store.c + depends on !BR2_STATIC_LIBS + help + Elementary is a widget toolkit and EFL wrapper and convenience + library to make it easy to build applications and tools with UIs + with less code. + + https://enlightenment.org + +comment "elementary needs a toolchain w/ threads, dynamic library" + depends on BR2_PACKAGE_EFL + depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS diff --git a/package/elementary/elementary.hash b/package/elementary/elementary.hash new file mode 100644 index 0000000000..ecdbc8e5bd --- /dev/null +++ b/package/elementary/elementary.hash @@ -0,0 +1,2 @@ +# From https://download.enlightenment.org/rel/libs/elementary/elementary-1.15.3.tar.xz.sha256 +sha256 474a9175061021ce8cbcfdbde6162316fc0d927b21118d1ab549377ebc802a93 elementary-1.15.3.tar.xz diff --git a/package/elementary/elementary.mk b/package/elementary/elementary.mk new file mode 100644 index 0000000000..7de0c7b343 --- /dev/null +++ b/package/elementary/elementary.mk @@ -0,0 +1,37 @@ +################################################################################ +# +# elementary +# +################################################################################ + +ELEMENTARY_VERSION = 1.15.3 +ELEMENTARY_SOURCE = elementary-$(ELEMENTARY_VERSION).tar.xz +ELEMENTARY_SITE = http://download.enlightenment.org/rel/libs/elementary +ELEMENTARY_LICENSE = LGPLv2.1 +ELEMENTARY_LICENSE_FILES = COPYING + +ELEMENTARY_INSTALL_STAGING = YES + +ELEMENTARY_DEPENDENCIES = host-pkgconf host-efl host-elementary efl + +ELEMENTARY_CONF_OPTS = \ + --with-edje-cc=$(HOST_DIR)/usr/bin/edje_cc \ + --with-eet-eet=$(HOST_DIR)/usr/bin/eet \ + --with-eolian-gen=$(HOST_DIR)/usr/bin/eolian_gen \ + --with-eldbus_codegen=$(HOST_DIR)/usr/bin/eldbus-codegen \ + --with-elm-prefs-cc=$(HOST_DIR)/usr/bin/elm_prefs_cc \ + --with-doxygen=no \ + --disable-elementary-test + +# We need a host package in order to provide elm_prefs_cc and +# elementary_codegen. +HOST_ELEMENTARY_DEPENDENCIES = host-pkgconf host-efl +HOST_ELEMENTARY_CONF_OPTS = \ + --with-edje-cc=$(HOST_DIR)/usr/bin/edje_cc \ + --with-eet-eet=$(HOST_DIR)/usr/bin/eet \ + --with-eolian-gen=$(HOST_DIR)/usr/bin/eolian_gen \ + --with-doxygen=no \ + --disable-elementary-test + +$(eval $(autotools-package)) +$(eval $(host-autotools-package)) diff --git a/package/elfutils/0001-argp-support.patch b/package/elfutils/0001-argp-support.patch new file mode 100644 index 0000000000..1a74b35ffd --- /dev/null +++ b/package/elfutils/0001-argp-support.patch @@ -0,0 +1,93 @@ +Allow the usage of an external implementation of the argp functions + +uClibc lack the argp family of functions that glibc has. Therefore, we +add a check in the configure script to see if argp_parse is available +in the C library. If not, we look if it is available in the additional +'argp' library. If so, we link against that library. If not, we error +out. + +This allows to build elfutils against uClibc with an external argp +library. + +Based on the former patch by Thomas Petazzoni. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Vicente Olivert Riera + +diff -rup a/configure.ac b/configure.ac +--- a/configure.ac 2015-01-06 11:30:02.170052875 +0000 ++++ b/configure.ac 2015-01-06 11:31:10.122219826 +0000 +@@ -253,6 +253,13 @@ AC_SUBST([LIBEBL_SUBDIR]) + AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR") + AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.]) + ++AC_CHECK_FUNC([argp_parse]) ++if test "$ac_cv_func_argp_parse" != yes; then ++ AC_CHECK_LIB([argp],[argp_parse],ARGP_LIBS=-largp, ++ AC_MSG_ERROR([No argp_parse function available.])) ++fi ++AC_SUBST(ARGP_LIBS) ++ + dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am + dnl conditional and config.h USE_ZLIB/USE_BZLIB #define. + save_LIBS="$LIBS" +diff -rup a/libdw/Makefile.am b/libdw/Makefile.am +--- a/libdw/Makefile.am 2014-12-19 20:43:11.000000000 +0000 ++++ b/libdw/Makefile.am 2015-01-06 11:32:21.075438524 +0000 +@@ -112,7 +112,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l + -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ + -Wl,--version-script,$<,--no-undefined \ + -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ +- -ldl $(zip_LIBS) ++ -ldl $(zip_LIBS) $(ARGP_LIBS) + @$(textrel_check) + ln -fs $@ $@.$(VERSION) + +diff -rup a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am 2015-01-06 11:30:02.430057339 +0000 ++++ b/src/Makefile.am 2015-01-06 11:34:53.061049752 +0000 +@@ -94,27 +94,29 @@ readelf_no_Werror = yes + strings_no_Werror = yes + addr2line_no_Wformat = yes + +-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl ++readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS) + nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \ +- $(demanglelib) +-size_LDADD = $(libelf) $(libeu) +-strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl +-ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl ++ $(demanglelib) $(ARGP_LIBS) ++size_LDADD = $(libelf) $(libeu) $(ARGP_LIBS) ++strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS) ++ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS) + if NATIVE_LD + # -ldl is always needed for libebl. + ld_LDADD += libld_elf.a + endif + ld_LDFLAGS = -rdynamic +-elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl +-findtextrel_LDADD = $(libdw) $(libelf) +-addr2line_LDADD = $(libdw) $(libelf) +-elfcmp_LDADD = $(libebl) $(libelf) -ldl +-objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) -ldl +-ranlib_LDADD = libar.a $(libelf) $(libeu) +-strings_LDADD = $(libelf) $(libeu) +-ar_LDADD = libar.a $(libelf) $(libeu) +-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl +-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(demanglelib) ++elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(ARGP_LIBS) ++findtextrel_LDADD = $(libdw) $(libelf) $(ARGP_LIBS) ++addr2line_LDADD = $(libdw) $(libelf) $(ARGP_LIBS) ++elfcmp_LDADD = $(libebl) $(libelf) -ldl $(ARGP_LIBS) ++objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) -ldl \ ++ $(ARGP_LIBS) ++ranlib_LDADD = libar.a $(libelf) $(libeu) $(ARGP_LIBS) ++strings_LDADD = $(libelf) $(libeu) $(ARGP_LIBS) ++ar_LDADD = libar.a $(libelf) $(libeu) $(ARGP_LIBS) ++unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(ARGP_LIBS) ++stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl \ ++ $(demanglelib) $(ARGP_LIBS) + + ldlex.o: ldscript.c + ldlex_no_Werror = yes diff --git a/package/elfutils/0007-Allow-disabling-symbol-versioning-at-configure-time.patch b/package/elfutils/0007-Allow-disabling-symbol-versioning-at-configure-time.patch new file mode 100644 index 0000000000..7378f26a01 --- /dev/null +++ b/package/elfutils/0007-Allow-disabling-symbol-versioning-at-configure-time.patch @@ -0,0 +1,139 @@ +From bafacacaf7659a4933604662daba26a480b29a8d Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 23 Apr 2015 20:46:59 +0200 +Subject: [PATCH] Allow disabling symbol versioning at configure time + +Due to missing symbol versioning support in uClibc calls to versioned +functions that internally call different version of themselves results +in infinite recursion. + +Introduce macro SYMBOL_VERSIONING and use it instead of plain SHARED to +decide whether symbol versioning is needed. Control this macro +definition with new configure option --disable-symbol-versioning. + +Signed-off-by: Max Filippov +Signed-off-by: Mark Wielaard +--- +Backported from: bafacacaf7659a4933604662daba26a480b29a8d +Changes to ChangeLogs are dropped. + + config/eu.am | 10 ++++++++-- + configure.ac | 7 +++++++ + lib/eu-config.h | 6 +++--- + libdwfl/core-file.c | 2 +- + libdwfl/dwfl_module_build_id.c | 2 +- + libdwfl/dwfl_report_elf.c | 2 +- + +diff --git a/config/eu.am b/config/eu.am +index faf8add..6103a3e 100644 +--- a/config/eu.am ++++ b/config/eu.am +@@ -38,16 +38,22 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ + + COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE)) + ++DEFS.os = -DPIC -DSHARED ++if SYMBOL_VERSIONING ++DEFS.os += -DSYMBOL_VERSIONING ++else ++endif ++ + %.os: %.c %.o + if AMDEP +- if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ ++ if $(COMPILE.os) -c -o $@ -fpic $(DEFS.os) -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ + rm -f "$(DEPDIR)/$*.Tpo"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi + else +- $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $< ++ $(COMPILE.os) -c -o $@ -fpic $(DEFS.os) $< + endif + + CLEANFILES = *.gcno *.gcda +diff --git a/configure.ac b/configure.ac +index ed2c964..be01573 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -241,6 +241,13 @@ AS_HELP_STRING([--disable-textrelcheck], + [Disable textrelcheck being a fatal error])) + AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"]) + ++AC_ARG_ENABLE([symbol-versioning], ++AS_HELP_STRING([--disable-symbol-versioning], ++ [Disable symbol versioning in shared objects])) ++AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"]) ++AS_IF([test "x$enable_symbol_versioning" = "xno"], ++ [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])]) ++ + dnl The directories with content. + + dnl Documentation. +diff --git a/lib/eu-config.h b/lib/eu-config.h +index 3afff26..5bb21c1 100644 +--- a/lib/eu-config.h ++++ b/lib/eu-config.h +@@ -163,7 +163,7 @@ asm (".section predict_data, \"aw\"; .previous\n" + #define ELFUTILS_HEADER(name) + + +-#ifdef SHARED ++#ifdef SYMBOL_VERSIONING + # define OLD_VERSION(name, version) \ + asm (".globl _compat." #version "." #name "\n" \ + "_compat." #version "." #name " = " #name "\n" \ +@@ -181,8 +181,8 @@ asm (".section predict_data, \"aw\"; .previous\n" + # define OLD_VERSION(name, version) /* Nothing for static linking. */ + # define NEW_VERSION(name, version) /* Nothing for static linking. */ + # define COMPAT_VERSION_NEWPROTO(name, version, prefix) \ +- error "should use #ifdef SHARED" +-# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SHARED" ++ error "should use #ifdef SYMBOL_VERSIONING" ++# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SYMBOL_VERSIONING" + #endif + + +diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c +index 324e9d2..bbe0899 100644 +--- a/libdwfl/core-file.c ++++ b/libdwfl/core-file.c +@@ -588,7 +588,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable) + INTDEF (dwfl_core_file_report) + NEW_VERSION (dwfl_core_file_report, ELFUTILS_0.158) + +-#ifdef SHARED ++#ifdef SYMBOL_VERSIONING + int _compat_without_executable_dwfl_core_file_report (Dwfl *dwfl, Elf *elf); + COMPAT_VERSION_NEWPROTO (dwfl_core_file_report, ELFUTILS_0.146, + without_executable) +diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c +index 350bbf8..c9a42ca 100644 +--- a/libdwfl/dwfl_module_build_id.c ++++ b/libdwfl/dwfl_module_build_id.c +@@ -101,7 +101,7 @@ dwfl_module_build_id (Dwfl_Module *mod, + INTDEF (dwfl_module_build_id) + NEW_VERSION (dwfl_module_build_id, ELFUTILS_0.138) + +-#ifdef SHARED ++#ifdef SYMBOL_VERSIONING + COMPAT_VERSION (dwfl_module_build_id, ELFUTILS_0.130, vaddr_at_end) + + int +diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c +index 3a4ae2e..624284c 100644 +--- a/libdwfl/dwfl_report_elf.c ++++ b/libdwfl/dwfl_report_elf.c +@@ -321,7 +321,7 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, + INTDEF (dwfl_report_elf) + NEW_VERSION (dwfl_report_elf, ELFUTILS_0.156) + +-#ifdef SHARED ++#ifdef SYMBOL_VERSIONING + Dwfl_Module * + _compat_without_add_p_vaddr_dwfl_report_elf (Dwfl *dwfl, const char *name, + const char *file_name, int fd, +-- +1.8.1.4 + diff --git a/package/emlog/0001-Fix-access-to-the-dentry.patch b/package/emlog/0001-Fix-access-to-the-dentry.patch new file mode 100644 index 0000000000..07dd5ec92f --- /dev/null +++ b/package/emlog/0001-Fix-access-to-the-dentry.patch @@ -0,0 +1,57 @@ +From 33d34a10fdc01c5716aebdb93c34fdfd7557adc0 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 22 Dec 2015 17:39:35 +0100 +Subject: [PATCH] Fix access to the dentry + +Since Linux 2.6.20, the dentry pointer is no longer stored in +file->f_dentry, but in file->f_path.dentry. Until Linux 3.19, there +was a compatibility macro which made the change transparent, but this +macro has now been removed. + +Since we probably don't care about compatibility with kernels older +than 2.6.20, this commit takes the simple approach of using +file->f_path.dentry. This will work with any kernel >= 2.6.20. + +Submitted upstream at https://github.com/nicupavel/emlog/pull/3. + +Signed-off-by: Thomas Petazzoni +--- + emlog.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/emlog.c b/emlog.c +index 41a67e2..1ef3d80 100644 +--- a/emlog.c ++++ b/emlog.c +@@ -292,8 +292,8 @@ static ssize_t emlog_read(struct file *file, char __user *buffer, /* The bu + struct emlog_info *einfo; + + /* get the metadata about this emlog */ +- if ((einfo = get_einfo(file->f_dentry->d_inode)) == NULL) { +- pr_err("can not fetch einfo for inode %ld.\n", (long)(file->f_dentry->d_inode->i_ino)); ++ if ((einfo = get_einfo(file->f_path.dentry->d_inode)) == NULL) { ++ pr_err("can not fetch einfo for inode %ld.\n", (long)(file->f_path.dentry->d_inode->i_ino)); + return -EIO; + } + +@@ -368,7 +368,7 @@ static ssize_t emlog_write(struct file *file, + struct emlog_info *einfo; + + /* get the metadata about this emlog */ +- if ((einfo = get_einfo(file->f_dentry->d_inode)) == NULL) ++ if ((einfo = get_einfo(file->f_path.dentry->d_inode)) == NULL) + return -EIO; + + /* if the message is longer than the buffer, just take the beginning +@@ -403,7 +403,7 @@ static unsigned int emlog_poll(struct file *file, struct poll_table_struct * wai + struct emlog_info *einfo; + + /* get the metadata about this emlog */ +- if ((einfo = get_einfo(file->f_dentry->d_inode)) == NULL) ++ if ((einfo = get_einfo(file->f_path.dentry->d_inode)) == NULL) + return -EIO; + + poll_wait(file, EMLOG_READQ(einfo), wait); +-- +2.6.4 + diff --git a/package/expat/0001-fix-CVE-2016-0718.patch b/package/expat/0001-fix-CVE-2016-0718.patch new file mode 100644 index 0000000000..8530a0e5a1 --- /dev/null +++ b/package/expat/0001-fix-CVE-2016-0718.patch @@ -0,0 +1,757 @@ +From cdfcb1b5c95e93b00ae9e9d25708b4a3bee72c15 Mon Sep 17 00:00:00 2001 +From: Sebastian Pipping +Date: Mon, 2 May 2016 00:02:44 +0200 +Subject: [PATCH] Address CVE-2016-0718 (/patch/ version 2.2.1) + +* Out of bounds memory access when doing text conversion on malformed input +* Integer overflow related to memory allocation + +Reported by Gustavo Grieco + +Patch credits go to +* Christian Heimes +* Karl Waclawek +* Gustavo Grieco +* Sebastian Pipping +* Pascal Cuoq + +Signed-off-by: Gustavo Zacarias +--- + lib/xmlparse.c | 34 +++++++++----- + lib/xmltok.c | 115 +++++++++++++++++++++++++++++++++++------------- + lib/xmltok.h | 10 ++++- + lib/xmltok_impl.c | 62 +++++++++++++------------- + 4 files changed, 146 insertions(+), 75 deletions(-) + +diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c +index e308c79..13e080d 100644 +--- a/lib/xmlparse.c ++++ b/lib/xmlparse.c +@@ -2426,11 +2426,11 @@ doContent(XML_Parser parser, + for (;;) { + int bufSize; + int convLen; +- XmlConvert(enc, ++ const enum XML_Convert_Result convert_res = XmlConvert(enc, + &fromPtr, rawNameEnd, + (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); + convLen = (int)(toPtr - (XML_Char *)tag->buf); +- if (fromPtr == rawNameEnd) { ++ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) { + tag->name.strLen = convLen; + break; + } +@@ -2651,11 +2651,11 @@ doContent(XML_Parser parser, + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; +- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); ++ const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = s; + charDataHandler(handlerArg, dataBuf, + (int)(dataPtr - (ICHAR *)dataBuf)); +- if (s == next) ++ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) + break; + *eventPP = s; + } +@@ -3261,11 +3261,11 @@ doCdataSection(XML_Parser parser, + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; +- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); ++ const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = next; + charDataHandler(handlerArg, dataBuf, + (int)(dataPtr - (ICHAR *)dataBuf)); +- if (s == next) ++ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) + break; + *eventPP = s; + } +@@ -5342,6 +5342,7 @@ reportDefault(XML_Parser parser, const ENCODING *enc, + const char *s, const char *end) + { + if (MUST_CONVERT(enc, s)) { ++ enum XML_Convert_Result convert_res; + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { +@@ -5354,11 +5355,11 @@ reportDefault(XML_Parser parser, const ENCODING *enc, + } + do { + ICHAR *dataPtr = (ICHAR *)dataBuf; +- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); ++ convert_res = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = s; + defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); + *eventPP = s; +- } while (s != end); ++ } while ((convert_res != XML_CONVERT_COMPLETED) && (convert_res != XML_CONVERT_INPUT_INCOMPLETE)); + } + else + defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); +@@ -6163,8 +6164,8 @@ poolAppend(STRING_POOL *pool, const ENCODING *enc, + if (!pool->ptr && !poolGrow(pool)) + return NULL; + for (;;) { +- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); +- if (ptr == end) ++ const enum XML_Convert_Result convert_res = XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); ++ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) + break; + if (!poolGrow(pool)) + return NULL; +@@ -6248,8 +6249,13 @@ poolGrow(STRING_POOL *pool) + } + } + if (pool->blocks && pool->start == pool->blocks->s) { +- int blockSize = (int)(pool->end - pool->start)*2; +- BLOCK *temp = (BLOCK *) ++ BLOCK *temp; ++ int blockSize = (int)((unsigned)(pool->end - pool->start)*2U); ++ ++ if (blockSize < 0) ++ return XML_FALSE; ++ ++ temp = (BLOCK *) + pool->mem->realloc_fcn(pool->blocks, + (offsetof(BLOCK, s) + + blockSize * sizeof(XML_Char))); +@@ -6264,6 +6270,10 @@ poolGrow(STRING_POOL *pool) + else { + BLOCK *tem; + int blockSize = (int)(pool->end - pool->start); ++ ++ if (blockSize < 0) ++ return XML_FALSE; ++ + if (blockSize < INIT_BLOCK_SIZE) + blockSize = INIT_BLOCK_SIZE; + else +diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c +index bf09dfc..cb98ce1 100644 +--- a/lib/xmltok.c ++++ b/lib/xmltok.c +@@ -318,39 +318,55 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ + UTF8_cval4 = 0xf0 + }; + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + utf8_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) + { ++ enum XML_Convert_Result res = XML_CONVERT_COMPLETED; + char *to; + const char *from; + if (fromLim - *fromP > toLim - *toP) { + /* Avoid copying partial characters. */ ++ res = XML_CONVERT_OUTPUT_EXHAUSTED; + for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) + if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) + break; + } +- for (to = *toP, from = *fromP; from != fromLim; from++, to++) ++ for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) + *to = *from; + *fromP = from; + *toP = to; ++ ++ if ((to == toLim) && (from < fromLim)) ++ return XML_CONVERT_OUTPUT_EXHAUSTED; ++ else ++ return res; + } + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + utf8_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) + { ++ enum XML_Convert_Result res = XML_CONVERT_COMPLETED; + unsigned short *to = *toP; + const char *from = *fromP; +- while (from != fromLim && to != toLim) { ++ while (from < fromLim && to < toLim) { + switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { + case BT_LEAD2: ++ if (fromLim - from < 2) { ++ res = XML_CONVERT_INPUT_INCOMPLETE; ++ break; ++ } + *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); + from += 2; + break; + case BT_LEAD3: ++ if (fromLim - from < 3) { ++ res = XML_CONVERT_INPUT_INCOMPLETE; ++ break; ++ } + *to++ = (unsigned short)(((from[0] & 0xf) << 12) + | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); + from += 3; +@@ -358,8 +374,14 @@ utf8_toUtf16(const ENCODING *enc, + case BT_LEAD4: + { + unsigned long n; +- if (to + 1 == toLim) ++ if (toLim - to < 2) { ++ res = XML_CONVERT_OUTPUT_EXHAUSTED; + goto after; ++ } ++ if (fromLim - from < 4) { ++ res = XML_CONVERT_INPUT_INCOMPLETE; ++ goto after; ++ } + n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) + | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); + n -= 0x10000; +@@ -377,6 +399,7 @@ utf8_toUtf16(const ENCODING *enc, + after: + *fromP = from; + *toP = to; ++ return res; + } + + #ifdef XML_NS +@@ -425,7 +448,7 @@ static const struct normal_encoding internal_utf8_encoding = { + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) + }; + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + latin1_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +@@ -433,30 +456,35 @@ latin1_toUtf8(const ENCODING *enc, + for (;;) { + unsigned char c; + if (*fromP == fromLim) +- break; ++ return XML_CONVERT_COMPLETED; + c = (unsigned char)**fromP; + if (c & 0x80) { + if (toLim - *toP < 2) +- break; ++ return XML_CONVERT_OUTPUT_EXHAUSTED; + *(*toP)++ = (char)((c >> 6) | UTF8_cval2); + *(*toP)++ = (char)((c & 0x3f) | 0x80); + (*fromP)++; + } + else { + if (*toP == toLim) +- break; ++ return XML_CONVERT_OUTPUT_EXHAUSTED; + *(*toP)++ = *(*fromP)++; + } + } + } + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + latin1_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) + { +- while (*fromP != fromLim && *toP != toLim) ++ while (*fromP < fromLim && *toP < toLim) + *(*toP)++ = (unsigned char)*(*fromP)++; ++ ++ if ((*toP == toLim) && (*fromP < fromLim)) ++ return XML_CONVERT_OUTPUT_EXHAUSTED; ++ else ++ return XML_CONVERT_COMPLETED; + } + + #ifdef XML_NS +@@ -483,13 +511,18 @@ static const struct normal_encoding latin1_encoding = { + STANDARD_VTABLE(sb_) + }; + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + ascii_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) + { +- while (*fromP != fromLim && *toP != toLim) ++ while (*fromP < fromLim && *toP < toLim) + *(*toP)++ = *(*fromP)++; ++ ++ if ((*toP == toLim) && (*fromP < fromLim)) ++ return XML_CONVERT_OUTPUT_EXHAUSTED; ++ else ++ return XML_CONVERT_COMPLETED; + } + + #ifdef XML_NS +@@ -536,13 +569,14 @@ unicode_byte_type(char hi, char lo) + } + + #define DEFINE_UTF16_TO_UTF8(E) \ +-static void PTRCALL \ ++static enum XML_Convert_Result PTRCALL \ + E ## toUtf8(const ENCODING *enc, \ + const char **fromP, const char *fromLim, \ + char **toP, const char *toLim) \ + { \ +- const char *from; \ +- for (from = *fromP; from != fromLim; from += 2) { \ ++ const char *from = *fromP; \ ++ fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \ ++ for (; from < fromLim; from += 2) { \ + int plane; \ + unsigned char lo2; \ + unsigned char lo = GET_LO(from); \ +@@ -552,7 +586,7 @@ E ## toUtf8(const ENCODING *enc, \ + if (lo < 0x80) { \ + if (*toP == toLim) { \ + *fromP = from; \ +- return; \ ++ return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + *(*toP)++ = lo; \ + break; \ +@@ -562,7 +596,7 @@ E ## toUtf8(const ENCODING *enc, \ + case 0x4: case 0x5: case 0x6: case 0x7: \ + if (toLim - *toP < 2) { \ + *fromP = from; \ +- return; \ ++ return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ + *(*toP)++ = ((lo & 0x3f) | 0x80); \ +@@ -570,7 +604,7 @@ E ## toUtf8(const ENCODING *enc, \ + default: \ + if (toLim - *toP < 3) { \ + *fromP = from; \ +- return; \ ++ return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ + *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ +@@ -580,7 +614,11 @@ E ## toUtf8(const ENCODING *enc, \ + case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ + if (toLim - *toP < 4) { \ + *fromP = from; \ +- return; \ ++ return XML_CONVERT_OUTPUT_EXHAUSTED; \ ++ } \ ++ if (fromLim - from < 4) { \ ++ *fromP = from; \ ++ return XML_CONVERT_INPUT_INCOMPLETE; \ + } \ + plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ + *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ +@@ -596,20 +634,32 @@ E ## toUtf8(const ENCODING *enc, \ + } \ + } \ + *fromP = from; \ ++ if (from < fromLim) \ ++ return XML_CONVERT_INPUT_INCOMPLETE; \ ++ else \ ++ return XML_CONVERT_COMPLETED; \ + } + + #define DEFINE_UTF16_TO_UTF16(E) \ +-static void PTRCALL \ ++static enum XML_Convert_Result PTRCALL \ + E ## toUtf16(const ENCODING *enc, \ + const char **fromP, const char *fromLim, \ + unsigned short **toP, const unsigned short *toLim) \ + { \ ++ enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \ ++ fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \ + /* Avoid copying first half only of surrogate */ \ + if (fromLim - *fromP > ((toLim - *toP) << 1) \ +- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ ++ && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \ + fromLim -= 2; \ +- for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ ++ res = XML_CONVERT_INPUT_INCOMPLETE; \ ++ } \ ++ for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \ + *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ ++ if ((*toP == toLim) && (*fromP < fromLim)) \ ++ return XML_CONVERT_OUTPUT_EXHAUSTED; \ ++ else \ ++ return res; \ + } + + #define SET2(ptr, ch) \ +@@ -1288,7 +1338,7 @@ unknown_isInvalid(const ENCODING *enc, const char *p) + return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; + } + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + unknown_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +@@ -1299,21 +1349,21 @@ unknown_toUtf8(const ENCODING *enc, + const char *utf8; + int n; + if (*fromP == fromLim) +- break; ++ return XML_CONVERT_COMPLETED; + utf8 = uenc->utf8[(unsigned char)**fromP]; + n = *utf8++; + if (n == 0) { + int c = uenc->convert(uenc->userData, *fromP); + n = XmlUtf8Encode(c, buf); + if (n > toLim - *toP) +- break; ++ return XML_CONVERT_OUTPUT_EXHAUSTED; + utf8 = buf; + *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] + - (BT_LEAD2 - 2)); + } + else { + if (n > toLim - *toP) +- break; ++ return XML_CONVERT_OUTPUT_EXHAUSTED; + (*fromP)++; + } + do { +@@ -1322,13 +1372,13 @@ unknown_toUtf8(const ENCODING *enc, + } + } + +-static void PTRCALL ++static enum XML_Convert_Result PTRCALL + unknown_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) + { + const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); +- while (*fromP != fromLim && *toP != toLim) { ++ while (*fromP < fromLim && *toP < toLim) { + unsigned short c = uenc->utf16[(unsigned char)**fromP]; + if (c == 0) { + c = (unsigned short) +@@ -1340,6 +1390,11 @@ unknown_toUtf16(const ENCODING *enc, + (*fromP)++; + *(*toP)++ = c; + } ++ ++ if ((*toP == toLim) && (*fromP < fromLim)) ++ return XML_CONVERT_OUTPUT_EXHAUSTED; ++ else ++ return XML_CONVERT_COMPLETED; + } + + ENCODING * +@@ -1503,7 +1558,7 @@ initScan(const ENCODING * const *encodingTable, + { + const ENCODING **encPtr; + +- if (ptr == end) ++ if (ptr >= end) + return XML_TOK_NONE; + encPtr = enc->encPtr; + if (ptr + 1 == end) { +diff --git a/expat/lib/xmltok.h b/expat/lib/xmltok.h +index ca867aa..752007e 100644 +--- a/lib/xmltok.h ++++ b/lib/xmltok.h +@@ -130,6 +130,12 @@ typedef int (PTRCALL *SCANNER)(const ENCODING *, + const char *, + const char **); + ++enum XML_Convert_Result { ++ XML_CONVERT_COMPLETED = 0, ++ XML_CONVERT_INPUT_INCOMPLETE = 1, ++ XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */ ++}; ++ + struct encoding { + SCANNER scanners[XML_N_STATES]; + SCANNER literalScanners[XML_N_LITERAL_TYPES]; +@@ -158,12 +164,12 @@ struct encoding { + const char *ptr, + const char *end, + const char **badPtr); +- void (PTRCALL *utf8Convert)(const ENCODING *enc, ++ enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + char **toP, + const char *toLim); +- void (PTRCALL *utf16Convert)(const ENCODING *enc, ++ enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + unsigned short **toP, +diff --git a/expat/lib/xmltok_impl.c b/expat/lib/xmltok_impl.c +index 9c2895b..6c5a3ba 100644 +--- a/lib/xmltok_impl.c ++++ b/lib/xmltok_impl.c +@@ -93,13 +93,13 @@ static int PTRCALL + PREFIX(scanComment)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) + { +- if (ptr != end) { ++ if (ptr < end) { + if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + ptr += MINBPC(enc); +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + INVALID_CASES(ptr, nextTokPtr) + case BT_MINUS: +@@ -147,7 +147,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_PERCNT: + if (ptr + MINBPC(enc) == end) +@@ -233,7 +233,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_S: case BT_CR: case BT_LF: +@@ -242,7 +242,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, + return XML_TOK_INVALID; + } + ptr += MINBPC(enc); +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + INVALID_CASES(ptr, nextTokPtr) + case BT_QUEST: +@@ -305,7 +305,7 @@ static int PTRCALL + PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) + { +- if (ptr == end) ++ if (ptr >= end) + return XML_TOK_NONE; + if (MINBPC(enc) > 1) { + size_t n = end - ptr; +@@ -348,7 +348,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, + ptr += MINBPC(enc); + break; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + #define LEAD_CASE(n) \ + case BT_LEAD ## n: \ +@@ -391,11 +391,11 @@ PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_S: case BT_CR: case BT_LF: +- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { ++ for (ptr += MINBPC(enc); ptr < end; ptr += MINBPC(enc)) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_S: case BT_CR: case BT_LF: + break; +@@ -432,7 +432,7 @@ static int PTRCALL + PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) + { +- if (ptr != end) { ++ if (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_DIGIT: + case BT_HEX: +@@ -441,7 +441,7 @@ PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { ++ for (ptr += MINBPC(enc); ptr < end; ptr += MINBPC(enc)) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_DIGIT: + case BT_HEX: +@@ -464,7 +464,7 @@ static int PTRCALL + PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) + { +- if (ptr != end) { ++ if (ptr < end) { + if (CHAR_MATCHES(enc, ptr, ASCII_x)) + return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); + switch (BYTE_TYPE(enc, ptr)) { +@@ -474,7 +474,7 @@ PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { ++ for (ptr += MINBPC(enc); ptr < end; ptr += MINBPC(enc)) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_DIGIT: + break; +@@ -506,7 +506,7 @@ PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_SEMI: +@@ -529,7 +529,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, + #ifdef XML_NS + int hadColon = 0; + #endif +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + #ifdef XML_NS +@@ -716,7 +716,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, + hadColon = 0; + #endif + /* we have a start-tag */ +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + #ifdef XML_NS +@@ -740,7 +740,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, + case BT_S: case BT_CR: case BT_LF: + { + ptr += MINBPC(enc); +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + case BT_GT: +@@ -785,7 +785,7 @@ static int PTRCALL + PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) + { +- if (ptr == end) ++ if (ptr >= end) + return XML_TOK_NONE; + if (MINBPC(enc) > 1) { + size_t n = end - ptr; +@@ -832,7 +832,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, + ptr += MINBPC(enc); + break; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + #define LEAD_CASE(n) \ + case BT_LEAD ## n: \ +@@ -895,7 +895,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_SEMI: +@@ -921,7 +921,7 @@ PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_CR: case BT_LF: case BT_S: +@@ -941,7 +941,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc, + const char *ptr, const char *end, + const char **nextTokPtr) + { +- while (ptr != end) { ++ while (ptr < end) { + int t = BYTE_TYPE(enc, ptr); + switch (t) { + INVALID_CASES(ptr, nextTokPtr) +@@ -973,7 +973,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) + { + int tok; +- if (ptr == end) ++ if (ptr >= end) + return XML_TOK_NONE; + if (MINBPC(enc) > 1) { + size_t n = end - ptr; +@@ -1141,7 +1141,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_GT: case BT_RPAR: case BT_COMMA: +@@ -1204,10 +1204,10 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) + { + const char *start; +- if (ptr == end) ++ if (ptr >= end) + return XML_TOK_NONE; + start = ptr; +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + #define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; +@@ -1262,10 +1262,10 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) + { + const char *start; +- if (ptr == end) ++ if (ptr >= end) + return XML_TOK_NONE; + start = ptr; +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + #define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; +@@ -1326,7 +1326,7 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, + end = ptr + n; + } + } +- while (ptr != end) { ++ while (ptr < end) { + switch (BYTE_TYPE(enc, ptr)) { + INVALID_CASES(ptr, nextTokPtr) + case BT_LT: +@@ -1373,7 +1373,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, + { + ptr += MINBPC(enc); + end -= MINBPC(enc); +- for (; ptr != end; ptr += MINBPC(enc)) { ++ for (; ptr < end; ptr += MINBPC(enc)) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_DIGIT: + case BT_HEX: +@@ -1760,7 +1760,7 @@ PREFIX(updatePosition)(const ENCODING *enc, + case BT_CR: + pos->lineNumber++; + ptr += MINBPC(enc); +- if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) ++ if (ptr < end && BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC(enc); + pos->columnNumber = (XML_Size)-1; + break; +-- +2.8.2 + diff --git a/package/f2fs-tools/0001-configure-add-check-for-fallocate.patch b/package/f2fs-tools/0001-configure-add-check-for-fallocate.patch new file mode 100644 index 0000000000..b7ead76cff --- /dev/null +++ b/package/f2fs-tools/0001-configure-add-check-for-fallocate.patch @@ -0,0 +1,46 @@ +From 265d97d02e8ef373653c76a339869985eb3ba27a Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Tue, 10 Mar 2015 15:10:35 -0300 +Subject: [PATCH] configure: add check for fallocate + +We need to check for fallocate() rather than just linux/falloc.h + +FALLOC_FL_PUNCH_HOLE since in uClibc we've got both but still not +fallocate() itself since it's only implemented in newer unreleased +versions. + +Status: sent upstream. + +Signed-off-by: Gustavo Zacarias +--- + configure.ac | 1 + + mkfs/f2fs_format_utils.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index ae451b8..900b84a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -68,6 +68,7 @@ AC_TYPE_SIZE_T + # Checks for library functions. + AC_FUNC_GETMNTENT + AC_CHECK_FUNCS_ONCE([ ++ fallocate + getmntent + memset + ]) +diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c +index a0f85f5..ddeafeb 100644 +--- a/mkfs/f2fs_format_utils.c ++++ b/mkfs/f2fs_format_utils.c +@@ -46,7 +46,7 @@ int f2fs_trim_device() + #if defined(WITH_BLKDISCARD) && defined(BLKDISCARD) + MSG(0, "Info: Discarding device\n"); + if (S_ISREG(stat_buf.st_mode)) { +-#ifdef FALLOC_FL_PUNCH_HOLE ++#if defined(HAVE_FALLOCATE) && defined(FALLOC_FL_PUNCH_HOLE) + if (fallocate(config.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, + range[0], range[1]) < 0) { + MSG(0, "Info: fallocate(PUNCH_HOLE|KEEP_SIZE) is failed\n"); +-- +2.0.5 + diff --git a/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch b/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch new file mode 100644 index 0000000000..a51a7d3c9c --- /dev/null +++ b/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch @@ -0,0 +1,63 @@ +From 74f1c9b43b191a9d6b494e90a4a11677fca33c13 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 11 Sep 2011 19:04:51 +0200 +Subject: [PATCH 01/13] Support raw dvdsub palette as stored on normal dvd's + +This is how the palette is stored on dvd's. Currently +only xbmc passes the palette information to libavcodec +this way. + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c +index 39604f3..a711e16 100644 +--- a/libavcodec/dvdsubdec.c ++++ b/libavcodec/dvdsubdec.c +@@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * + } + } + ++static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values) ++{ ++ uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; ++ uint8_t r, g, b; ++ int i, y, cb, cr, a; ++ int r_add, g_add, b_add; ++ ++ for (i = num_values; i > 0; i--) { ++ a = *ayvu++; ++ y = *ayvu++; ++ cr = *ayvu++; ++ cb = *ayvu++; ++ YUV_TO_RGB1_CCIR(cb, cr); ++ YUV_TO_RGB2_CCIR(r, g, b, y); ++ *argb++ = (a << 24) | (r << 16) | (g << 8) | b; ++ } ++} ++ + static int decode_run_2bit(GetBitContext *gb, int *color) + { + unsigned int v, t; +@@ -697,6 +715,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) + parse_ifo_palette(ctx, ctx->ifo_str); + if (ctx->palette_str) + parse_palette(ctx, ctx->palette_str); ++ ++ if (!ctx->has_palette && avctx->extradata_size == 64) { ++ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16); ++ ctx->has_palette = 1; ++ } ++ + if (ctx->has_palette) { + int i; + av_log(avctx, AV_LOG_DEBUG, "palette:"); +-- +2.1.0 + diff --git a/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch b/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch new file mode 100644 index 0000000000..034413405f --- /dev/null +++ b/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch @@ -0,0 +1,32 @@ +From 54200b3e6009c6870e33c02c8bbcf023fcd92cac Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Mon, 28 Jun 2010 01:55:31 -0400 +Subject: [PATCH 03/13] if av_read_packet returns AVERROR_IO, we are done. + ffmpeg's codecs might or might not handle returning any completed demuxed + packets correctly + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/utils.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libavformat/utils.c b/libavformat/utils.c +index ae6347a..3e8af50 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -1304,6 +1304,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) + if (ret < 0) { + if (ret == AVERROR(EAGAIN)) + return ret; ++ if (ret == AVERROR(EIO)) ++ return ret; + /* flush the parsers */ + for (i = 0; i < s->nb_streams; i++) { + st = s->streams[i]; +-- +2.1.0 + diff --git a/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch b/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch new file mode 100644 index 0000000000..bc6a2d456d --- /dev/null +++ b/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch @@ -0,0 +1,47 @@ +From e9236f6fe3fae1ad4a3a2b6b63db493b083f0b21 Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Mon, 28 Jun 2010 02:10:50 -0400 +Subject: [PATCH 04/13] added: Ticket #7187, TV Teletext support for DVB EBU + Teletext streams + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavcodec/avcodec.h | 4 ++++ + libavformat/mpegts.c | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h +index dabae1b..dd6ef3f 100644 +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -520,6 +520,10 @@ enum AVCodecID { + AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), + AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska + ++ /* data codecs */ ++ AV_CODEC_ID_VBI_DATA= 0x17500, ++ AV_CODEC_ID_VBI_TELETEXT, ++ + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 97da0a3..5dd28f1 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -729,6 +729,8 @@ static const StreamType DESC_types[] = { + { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, + { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, + { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ ++ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */ ++ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */ + { 0 }, + }; + +-- +2.1.0 + diff --git a/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch b/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch new file mode 100644 index 0000000000..feb58f7b25 --- /dev/null +++ b/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch @@ -0,0 +1,46 @@ +From 1f48ee2290e9041b0371eb9a9cb742e9568930a1 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 18 Sep 2011 19:16:34 +0200 +Subject: [PATCH 05/13] Don't accept mpegts PMT that isn't current + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 5dd28f1..9f85aed 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -572,6 +572,7 @@ typedef struct SectionHeader { + uint8_t tid; + uint16_t id; + uint8_t version; ++ uint8_t current; + uint8_t sec_num; + uint8_t last_sec_num; + } SectionHeader; +@@ -643,6 +644,7 @@ static int parse_section_header(SectionHeader *h, + val = get8(pp, p_end); + if (val < 0) + return val; ++ h->current = val & 0x1; + h->version = (val >> 1) & 0x1f; + val = get8(pp, p_end); + if (val < 0) +@@ -1968,6 +1970,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len + return; + if (ts->skip_changes) + return; ++ if (!h->current) ++ return; + + ts->stream->ts_id = h->id; + +-- +2.1.0 + diff --git a/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch b/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch new file mode 100644 index 0000000000..0418f25eb1 --- /dev/null +++ b/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch @@ -0,0 +1,48 @@ +From db98fbe37f2f7175ff03b8d582e940518ddf3642 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 18 Sep 2011 19:17:23 +0200 +Subject: [PATCH 06/13] Don't reparse PMT unless it's version has changed + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 9f85aed..25007a6 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -88,6 +88,7 @@ struct MpegTSFilter { + int es_id; + int last_cc; /* last cc code (-1 if first packet) */ + int64_t last_pcr; ++ int last_version; /* last version of data on this pid */ + enum MpegTSFilterType type; + union { + MpegTSPESFilter pes_filter; +@@ -450,6 +451,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, + filter->es_id = -1; + filter->last_cc = -1; + filter->last_pcr= -1; ++ filter->last_version = -1; + + return filter; + } +@@ -1972,6 +1974,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len + return; + if (!h->current) + return; ++ if (h->version == filter->last_version) ++ return; ++ filter->last_version = h->version; ++ av_dlog(ts->stream, "version=%d\n", filter->last_version); + + ts->stream->ts_id = h->id; + +-- +2.1.0 + diff --git a/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch b/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch new file mode 100644 index 0000000000..259b35939e --- /dev/null +++ b/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch @@ -0,0 +1,105 @@ +From fdd8caea6535434a877587f5325e914ba50ed17f Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Fri, 9 Jul 2010 16:43:31 -0400 +Subject: [PATCH 07/13] Read PID timestamps as well as PCR timestamps to find + location in mpegts stream + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 46 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 25007a6..d5a8a45 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -2459,6 +2459,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { + av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); + } + ++static int parse_timestamp(int64_t *ts, const uint8_t *buf) ++{ ++ int afc, flags; ++ const uint8_t *p; ++ ++ if(!(buf[1] & 0x40)) /* must be a start packet */ ++ return -1; ++ ++ afc = (buf[3] >> 4) & 3; ++ p = buf + 4; ++ if (afc == 0 || afc == 2) /* invalid or only adaption field */ ++ return -1; ++ if (afc == 3) ++ p += p[0] + 1; ++ if (p >= buf + TS_PACKET_SIZE) ++ return -1; ++ ++ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */ ++ return -1; ++ ++ flags = p[3] | 0x100; /* stream type */ ++ if (!((flags >= 0x1c0 && flags <= 0x1df) || ++ (flags >= 0x1e0 && flags <= 0x1ef) || ++ (flags == 0x1bd) || (flags == 0x1fd))) ++ return -1; ++ ++ flags = p[7]; ++ if ((flags & 0xc0) == 0x80) { ++ *ts = ff_parse_pes_pts(p+9); ++ return 0; ++ } else if ((flags & 0xc0) == 0xc0) { ++ *ts = ff_parse_pes_pts(p+9+5); ++ return 0; ++ } ++ return -1; ++} ++ ++ + static int mpegts_read_header(AVFormatContext *s) + { + MpegTSContext *ts = s->priv_data; +@@ -2658,6 +2696,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, + uint8_t buf[TS_PACKET_SIZE]; + int pcr_l, pcr_pid = + ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; ++ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid; + int pos47 = ts->pos47_full % ts->raw_packet_size; + pos = + ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * +@@ -2679,6 +2718,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, + *ppos = pos; + return timestamp; + } ++ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) && ++ parse_timestamp(×tamp, buf) == 0) { ++ *ppos = pos; ++ return timestamp; ++ } + pos += ts->raw_packet_size; + } + +@@ -2778,7 +2822,7 @@ AVInputFormat ff_mpegts_demuxer = { + .read_header = mpegts_read_header, + .read_packet = mpegts_read_packet, + .read_close = mpegts_read_close, +- .read_timestamp = mpegts_get_dts, ++ .read_timestamp = mpegts_get_pcr, + .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, + .priv_class = &mpegts_class, + }; +@@ -2790,7 +2834,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { + .read_header = mpegts_read_header, + .read_packet = mpegts_raw_read_packet, + .read_close = mpegts_read_close, +- .read_timestamp = mpegts_get_dts, ++ .read_timestamp = mpegts_get_pcr, + .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, + .priv_class = &mpegtsraw_class, + }; +-- +2.1.0 + diff --git a/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch b/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch new file mode 100644 index 0000000000..0b80c113e1 --- /dev/null +++ b/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch @@ -0,0 +1,74 @@ +From c57e5b8154f5fe1457f4c64e04885a2cdfb37f51 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sat, 22 Oct 2011 19:01:38 +0200 +Subject: [PATCH 08/13] Get stream durations using read_timestamp + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/libavformat/utils.c b/libavformat/utils.c +index 3e8af50..f4fb172 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -2356,6 +2356,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) + #define DURATION_MAX_READ_SIZE 250000LL + #define DURATION_MAX_RETRY 4 + ++static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset) ++{ ++ AVStream *st; ++ int i, step= 1024; ++ int64_t ts, pos; ++ ++ for(i=0;inb_streams;i++) { ++ st = ic->streams[i]; ++ ++ pos = 0; ++ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE); ++ if (ts == AV_NOPTS_VALUE) ++ continue; ++ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE) ++ st->start_time = ts; ++ ++ pos = avio_size(ic->pb) - 1; ++ do { ++ pos -= step; ++ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step); ++ step += step; ++ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE); ++ ++ if (ts == AV_NOPTS_VALUE) ++ continue; ++ ++ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE) ++ st->duration = ts - st->start_time; ++ } ++ ++ fill_all_stream_timings(ic); ++ ++ avio_seek(ic->pb, old_offset, SEEK_SET); ++} ++ + /* only usable for MPEG-PS streams */ + static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) + { +@@ -2506,6 +2541,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) + * the components */ + fill_all_stream_timings(ic); + ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; ++ } else if (ic->iformat->read_timestamp && ++ file_size && ic->pb->seekable) { ++ /* get accurate estimate from the PTSes */ ++ av_estimate_timings_from_pts2(ic, old_offset); + } else { + /* less precise: use bitrate info */ + estimate_timings_from_bit_rate(ic); +-- +2.1.0 + diff --git a/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch b/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch new file mode 100644 index 0000000000..fb0aad1e13 --- /dev/null +++ b/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch @@ -0,0 +1,33 @@ +From 4bcec3ef0042244b0ade00d132368d0872f73c72 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Wed, 8 Dec 2010 14:03:43 +0000 +Subject: [PATCH 09/13] changed: allow 4 second skew between streams in mov + before attempting to seek + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mov.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 8d66c0a..127ffd9 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -4028,8 +4028,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) + if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || + (s->pb->seekable && + ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && +- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || +- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { ++ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) || ++ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) { + sample = current_sample; + best_dts = dts; + *st = avst; +-- +2.1.0 + diff --git a/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch b/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch new file mode 100644 index 0000000000..d13d0730b8 --- /dev/null +++ b/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch @@ -0,0 +1,44 @@ +From cb7c19124165508ae5f38a385a14f9c13b096a27 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Fri, 26 Nov 2010 20:56:48 +0000 +Subject: [PATCH 10/13] fixed: memleak in mpegts demuxer on some malformed (??) + mpegts files with too large pes packets + +at-visions sample file brokenStream.mpg + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index d5a8a45..e070f1f 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -832,6 +832,10 @@ static void reset_pes_packet_state(PESContext *pes) + + static void new_pes_packet(PESContext *pes, AVPacket *pkt) + { ++ if(pkt->data) { ++ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index); ++ av_free_packet(pkt); ++ } + av_init_packet(pkt); + + pkt->buf = pes->buffer; +@@ -2649,6 +2653,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) + + pkt->size = -1; + ts->pkt = pkt; ++ ts->pkt->data = NULL; ++ + ret = handle_packets(ts, 0); + if (ret < 0) { + av_free_packet(ts->pkt); +-- +2.1.0 + diff --git a/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch b/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch new file mode 100644 index 0000000000..7c81f1d5fd --- /dev/null +++ b/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch @@ -0,0 +1,30 @@ +From c315a758a292200c22925603682e259849d6d558 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Mon, 28 Jun 2010 21:26:54 +0000 +Subject: [PATCH 11/13] Speed up mpegts av_find_stream_info + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index e070f1f..dd9e129 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -994,7 +994,7 @@ static int mpegts_push_data(MpegTSFilter *filter, + goto skip; + + /* stream not present in PMT */ +- if (!pes->st) { ++ if (ts->auto_guess && !pes->st) { + if (ts->skip_changes) + goto skip; + +-- +2.1.0 + diff --git a/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch b/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch new file mode 100644 index 0000000000..f346da131f --- /dev/null +++ b/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch @@ -0,0 +1,77 @@ +From 939ebbbc46ca9995637415594f1815633587104f Mon Sep 17 00:00:00 2001 +From: marc +Date: Mon, 18 Feb 2013 17:18:18 +0000 +Subject: [PATCH 12/13] dxva-h264 Fix dxva playback of streams that don't start + with an I-Frame. + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavcodec/dxva2_h264.c | 8 ++++++++ + libavcodec/h264.c | 1 + + libavcodec/h264.h | 2 ++ + libavcodec/h264_slice.c | 1 + + 4 files changed, 12 insertions(+) + +diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c +index 6deccc3..85b25fd 100644 +--- a/libavcodec/dxva2_h264.c ++++ b/libavcodec/dxva2_h264.c +@@ -451,6 +451,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx) + + if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) + return -1; ++ ++ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs ++ if (!h->got_first_iframe) { ++ if (!(ctx_pic->pp.wBitFields & (1 << 15))) ++ return -1; ++ h->got_first_iframe = 1; ++ } ++ + ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, + &ctx_pic->pp, sizeof(ctx_pic->pp), + &ctx_pic->qm, sizeof(ctx_pic->qm), +diff --git a/libavcodec/h264.c b/libavcodec/h264.c +index 222bf58..ea2ec17 100644 +--- a/libavcodec/h264.c ++++ b/libavcodec/h264.c +@@ -1085,6 +1085,7 @@ void ff_h264_flush_change(H264Context *h) + h->mmco_reset = 1; + for (i = 0; i < h->nb_slice_ctx; i++) + h->slice_ctx[i].list_count = 0; ++ h->got_first_iframe = 0; + } + + /* forget old pics after a seek */ +diff --git a/libavcodec/h264.h b/libavcodec/h264.h +index b94f06b..bc9458b 100644 +--- a/libavcodec/h264.h ++++ b/libavcodec/h264.h +@@ -741,6 +741,8 @@ typedef struct H264Context { + int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag + int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag + ++ int got_first_iframe; ++ + // Timestamp stuff + int sei_buffering_period_present; ///< Buffering period SEI flag + int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs +diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c +index 53f61ca..b171d78 100644 +--- a/libavcodec/h264_slice.c ++++ b/libavcodec/h264_slice.c +@@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) + ff_h264_free_tables(h, 0); + h->first_field = 0; + h->prev_interlaced_frame = 1; ++ h->got_first_iframe = 0; + + init_scan_tables(h); + ret = ff_h264_alloc_tables(h); +-- +2.1.0 + diff --git a/package/fio/0001-Fix-compile-of-test-programs-on-archs-that-use-arch_.patch b/package/fio/0001-Fix-compile-of-test-programs-on-archs-that-use-arch_.patch new file mode 100644 index 0000000000..f9f48263a2 --- /dev/null +++ b/package/fio/0001-Fix-compile-of-test-programs-on-archs-that-use-arch_.patch @@ -0,0 +1,126 @@ +From 71471cb1d05f3877c8fb935fbf70a6bae789ac49 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Thu, 10 Mar 2016 08:09:41 -0700 +Subject: [PATCH] Fix compile of test programs on archs that use arch_flags at + runtime + +SuperH compile currently fails with: + +gettime.o: In function fio_gettime': +/home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:163: undefined reference to arch_flags' +gettime.o: In function utime_since_now': +/home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:164: undefined reference to arch_flags' +gettime.o: In function mtime_since_now': +/home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:164: undefined reference to arch_flags' +gettime.o: In function time_since_now': +/home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:164: undefined reference to arch_flags' +mutex.o: In function fio_mutex_up': +/home/thomas/projets/buildroot/output/build/fio-fio-2.7/mutex.c:189: undefined reference to arch_flags' +collect2: error: ld returned 1 exit status +Makefile:375: recipe for target 't/stest' failed +make[2]: *** [t/stest] Error 1 +make[2]: *** Waiting for unfinished jobs.... + +Fix that by ensuring we have a stub arch.o with the necessary arch flags +for the standalone test programs. + +Signed-off-by: Jens Axboe +--- + Makefile | 6 +++--- + t/arch.c | 5 +++++ + t/dedupe.c | 1 + + t/lfsr-test.c | 2 ++ + t/stest.c | 2 ++ + 5 files changed, 13 insertions(+), 3 deletions(-) + create mode 100644 t/arch.c + +diff --git a/Makefile b/Makefile +index 6b4c9db..a2502dc 100644 +--- a/Makefile ++++ b/Makefile +@@ -191,7 +191,7 @@ endif + -include $(OBJS:.o=.d) + + T_SMALLOC_OBJS = t/stest.o +-T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o t/debug.o ++T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o t/debug.o t/arch.o + T_SMALLOC_PROGS = t/stest + + T_IEEE_OBJS = t/ieee754.o +@@ -208,7 +208,7 @@ T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o + T_AXMAP_PROGS = t/axmap + + T_LFSR_TEST_OBJS = t/lfsr-test.o +-T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o t/log.o t/debug.o ++T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o t/log.o t/debug.o t/arch.o + T_LFSR_TEST_PROGS = t/lfsr-test + + T_GEN_RAND_OBJS = t/gen-rand.o +@@ -223,7 +223,7 @@ endif + + T_DEDUPE_OBJS = t/dedupe.o + T_DEDUPE_OBJS += lib/rbtree.o t/log.o mutex.o smalloc.o gettime.o crc/md5.o \ +- lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o \ ++ lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o t/arch.o \ + crc/murmur3.o crc/crc32c.o crc/crc32c-intel.o crc/fnv.o + T_DEDUPE_PROGS = t/fio-dedupe + +diff --git a/t/arch.c b/t/arch.c +new file mode 100644 +index 0000000..befb7c7 +--- /dev/null ++++ b/t/arch.c +@@ -0,0 +1,5 @@ ++#include "../arch/arch.h" ++ ++unsigned long arch_flags = 0; ++int tsc_reliable; ++int arch_random; +diff --git a/t/dedupe.c b/t/dedupe.c +index 3a66820..7856da1 100644 +--- a/t/dedupe.c ++++ b/t/dedupe.c +@@ -537,6 +537,7 @@ int main(int argc, char *argv[]) + uint64_t nextents = 0, nchunks = 0; + int c, ret; + ++ arch_init(argv); + debug_init(); + + while ((c = getopt(argc, argv, "b:t:d:o:c:p:B:")) != -1) { +diff --git a/t/lfsr-test.c b/t/lfsr-test.c +index 4352b89..bad5097 100644 +--- a/t/lfsr-test.c ++++ b/t/lfsr-test.c +@@ -38,6 +38,8 @@ int main(int argc, char *argv[]) + void *v = NULL, *v_start; + double total, mean; + ++ arch_init(argv); ++ + /* Read arguments */ + switch (argc) { + case 5: if (strncmp(argv[4], "verify", 7) == 0) +diff --git a/t/stest.c b/t/stest.c +index fb51989..0e0d8b0 100644 +--- a/t/stest.c ++++ b/t/stest.c +@@ -4,6 +4,7 @@ + + #include "../smalloc.h" + #include "../flist.h" ++#include "../arch/arch.h" + #include "debug.h" + + #define MAGIC1 0xa9b1c8d2 +@@ -69,6 +70,7 @@ static int do_specific_alloc(unsigned long size) + + int main(int argc, char *argv[]) + { ++ arch_init(argv); + sinit(); + debug_init(); + +-- +2.6.4 + diff --git a/package/flac/0001-configure-don-t-try-to-unset-g-from-CFLAGS.patch b/package/flac/0001-configure-don-t-try-to-unset-g-from-CFLAGS.patch new file mode 100644 index 0000000000..3aff5a8c95 --- /dev/null +++ b/package/flac/0001-configure-don-t-try-to-unset-g-from-CFLAGS.patch @@ -0,0 +1,27 @@ +The sed expression is wrong, any flags with '-g' in any position gets +zapped, for example: + +-mfloat-gprs=double (for powerpc e500) -> -mfloatprs=double. + +Which gives build errors and is perfectly valid in real use scenarios to +switch from e500v1 (single precision) code to e500v2 (double precision) code. + +Signed-off-by: Gustavo Zacarias + +diff -Nura flac-1.3.1.orig/configure flac-1.3.1/configure +--- flac-1.3.1.orig/configure 2014-11-27 20:43:29.921303105 -0300 ++++ flac-1.3.1/configure 2014-11-27 20:45:33.460250179 -0300 +@@ -19870,11 +19870,10 @@ + + if test "x$debug" = xtrue; then + CPPFLAGS="-DDEBUG $CPPFLAGS" +- CFLAGS=$(echo "$CFLAGS" | sed 's/-g//') +- CFLAGS="-g $CFLAGS" ++ CFLAGS=$(echo "-g $CFLAGS") + else + CPPFLAGS="-DNDEBUG $CPPFLAGS" +- CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//') ++ CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//') + CFLAGS="-O3 -funroll-loops $CFLAGS" + fi + diff --git a/package/flac/0002-sigemptyset.patch b/package/flac/0002-sigemptyset.patch new file mode 100644 index 0000000000..9cbc338a67 --- /dev/null +++ b/package/flac/0002-sigemptyset.patch @@ -0,0 +1,18 @@ +Fix musl compile since it does not define __sigemptyset + +Downloaded from +http://git.alpinelinux.org/cgit/aports/commit/main/flac/sigemptyset.patch?id=49fd0f4cebc46e2753d6a60e450078446f7f18a7 + +Signed-off-by: Bernd Kuhls + +--- ./src/libFLAC/cpu.c.orig ++++ ./src/libFLAC/cpu.c +@@ -243,7 +243,7 @@ + struct sigaction sigill_save; + struct sigaction sigill_sse; + sigill_sse.sa_sigaction = sigill_handler_sse_os; +- __sigemptyset(&sigill_sse.sa_mask); ++ sigemptyset(&sigill_sse.sa_mask); + sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ + if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) + { diff --git a/package/gcc/4.7.4/100-uclibc-conf.patch b/package/gcc/4.7.4/100-uclibc-conf.patch new file mode 100644 index 0000000000..6bad179e62 --- /dev/null +++ b/package/gcc/4.7.4/100-uclibc-conf.patch @@ -0,0 +1,13 @@ +--- gcc/gcc/config/--- gcc/contrib/regression/objs-gcc.sh ++++ gcc/contrib/regression/objs-gcc.sh +@@ -105,6 +105,10 @@ + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 diff --git a/package/gcc/4.7.4/1000-powerpc-link-with-math-lib.patch.conditional b/package/gcc/4.7.4/1000-powerpc-link-with-math-lib.patch.conditional new file mode 100644 index 0000000000..2554263a00 --- /dev/null +++ b/package/gcc/4.7.4/1000-powerpc-link-with-math-lib.patch.conditional @@ -0,0 +1,127 @@ +http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html + +On glibc the libc.so carries a copy of the math function copysignl() but +on uClibc math functions like copysignl() live in libm. Since libgcc_s +contains unresolved symbols, any attempt to link against libgcc_s +without explicitely specifying -lm fails, resulting in a broken +bootstrap of the compiler. + +Forward ported to gcc 4.7.3 + +Signed-off-by: Gustavo Zacarias + +diff -Nura gcc-4.7.3.orig/libgcc/config/t-slibgcc gcc-4.7.3/libgcc/config/t-slibgcc +--- gcc-4.7.3.orig/libgcc/config/t-slibgcc 2013-04-11 15:23:46.491571116 -0300 ++++ gcc-4.7.3/libgcc/config/t-slibgcc 2013-04-11 15:25:06.241141824 -0300 +@@ -27,7 +27,7 @@ + SHLIB_OBJS = @shlib_objs@ + SHLIB_DIR = @multilib_dir@ + SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@ +-SHLIB_LC = -lc ++SHLIB_LC = @libgcc_libm@ -lc + SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK) + SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \ + $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) +diff -Nura gcc-4.7.3.orig/libgcc/configure gcc-4.7.3/libgcc/configure +--- gcc-4.7.3.orig/libgcc/configure 2013-04-11 15:23:46.551573051 -0300 ++++ gcc-4.7.3/libgcc/configure 2013-04-11 15:25:06.243141875 -0300 +@@ -563,6 +563,7 @@ + tmake_file + sfp_machine_header + set_use_emutls ++LIBGCC_LIBM + set_have_cc_tls + vis_hide + fixed_point +@@ -4445,6 +4446,37 @@ + fi + fi + ++# On powerpc libgcc_s references copysignl which is a libm function but ++# glibc apparently also provides it via libc as opposed to uClibc where ++# it lives in libm. ++echo "$as_me:$LINENO: checking for library containing copysignl" >&5 ++echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6 ++if test "${libgcc_cv_copysignl_lib+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++ echo '#include ' > conftest.c ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c ++ libgcc_cv_copysignl_lib="-lc" ++ if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } ++ then ++ libgcc_cv_copysignl_lib="-lm" ++ fi ++ rm -f conftest.* ++ ++fi ++echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5 ++echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6 ++ ++case /${libgcc_cv_copysignl_lib}/ in ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;; ++ *) LIBGCC_LIBM= ;; ++esac + + # Conditionalize the makefile for this target machine. + tmake_file_= +diff -Nura gcc-4.7.3.orig/libgcc/configure.ac gcc-4.7.3/libgcc/configure.ac +--- gcc-4.7.3.orig/libgcc/configure.ac 2013-04-11 15:23:46.551573051 -0300 ++++ gcc-4.7.3/libgcc/configure.ac 2013-04-11 15:25:06.244141901 -0300 +@@ -324,6 +324,27 @@ + fi + AC_SUBST(set_have_cc_tls) + ++# On powerpc libgcc_s references copysignl which is a libm function but ++# glibc apparently also provides it via libc as opposed to uClibc where ++# it lives in libm. ++AC_CACHE_CHECK ++ libgcc_cv_copysignl_lib, ++ echo '#include ' > conftest.c ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c ++ libgcc_cv_copysignl_lib="-lc" ++ if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD) ++ then ++ libgcc_cv_copysignl_lib="-lm" ++ fi ++ rm -f conftest.* ++ ]) ++ ++case /${libgcc_cv_copysignl_lib}/ in ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;; ++ *) LIBGCC_LIBM= ;; ++esac ++AC_SUBST(LIBGCC_LIBM) ++ + # See if we have emulated thread-local storage. + GCC_CHECK_EMUTLS + set_use_emutls= +diff -Nura gcc-4.7.3.orig/libgcc/Makefile.in gcc-4.7.3/libgcc/Makefile.in +--- gcc-4.7.3.orig/libgcc/Makefile.in 2013-04-11 15:23:46.537572599 -0300 ++++ gcc-4.7.3/libgcc/Makefile.in 2013-04-11 15:25:06.241141824 -0300 +@@ -41,6 +41,7 @@ + decimal_float = @decimal_float@ + enable_decimal_float = @enable_decimal_float@ + fixed_point = @fixed_point@ ++LIBGCC_LIBM = @LIBGCC_LIBM@ + + host_noncanonical = @host_noncanonical@ + target_noncanonical = @target_noncanonical@ +@@ -928,9 +929,10 @@ + @multilib_dir@,$(MULTIDIR),$(subst \ + @shlib_objs@,$(objects) libgcc.a,$(subst \ + @shlib_base_name@,libgcc_s,$(subst \ ++ @libgcc_libm@,$(LIBGCC_LIBM),$(subst \ + @shlib_map_file@,$(mapfile),$(subst \ + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \ +- @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))) ++ @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))) + + libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts) + # @multilib_flags@ is still needed because this may use diff --git a/package/gcc/4.7.4/111-pr65730.patch b/package/gcc/4.7.4/111-pr65730.patch new file mode 100644 index 0000000000..f195e308da --- /dev/null +++ b/package/gcc/4.7.4/111-pr65730.patch @@ -0,0 +1,37 @@ +From b9a7775674d91c7af8043a83211ffeaa576327d7 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 10 Apr 2015 17:46:30 +0300 +Subject: [PATCH] Fix PR target/65730 + +2015-05-20 Max Filippov +gcc/ + * config/xtensa/xtensa.c (init_alignment_context): Replace MULT + by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT). + +Signed-off-by: Max Filippov +--- +Backported from: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223452 +Changes to ChangeLog are dropped. + + gcc/config/xtensa/xtensa.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c +index eb039ba..7296e36 100644 +--- a/gcc/config/xtensa/xtensa.c ++++ b/gcc/config/xtensa/xtensa.c +@@ -1461,8 +1461,9 @@ init_alignment_context (struct alignment_context *ac, rtx mem) + if (ac->shift != NULL_RTX) + { + /* Shift is the byte count, but we need the bitcount. */ +- ac->shift = expand_simple_binop (SImode, MULT, ac->shift, +- GEN_INT (BITS_PER_UNIT), ++ gcc_assert (exact_log2 (BITS_PER_UNIT) >= 0); ++ ac->shift = expand_simple_binop (SImode, ASHIFT, ac->shift, ++ GEN_INT (exact_log2 (BITS_PER_UNIT)), + NULL_RTX, 1, OPTAB_DIRECT); + ac->modemask = expand_simple_binop (SImode, ASHIFT, + GEN_INT (GET_MODE_MASK (mode)), +-- +1.8.1.4 + diff --git a/package/gcc/4.7.4/130-pr43538.patch b/package/gcc/4.7.4/130-pr43538.patch new file mode 100644 index 0000000000..19e57bb059 --- /dev/null +++ b/package/gcc/4.7.4/130-pr43538.patch @@ -0,0 +1,25 @@ +From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001 +From: glisse +Date: Fri, 25 Apr 2014 08:03:08 +0000 +Subject: [PATCH] 2014-04-25 Marc Glisse + + PR target/43538 + * mt-gnu: Don't reset CXXFLAGS_FOR_TARGET. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4 +Signed-off-by: Max Filippov +--- + config/mt-gnu | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/mt-gnu b/config/mt-gnu +index 15bf417..5c696f5 100644 +--- a/config/mt-gnu ++++ b/config/mt-gnu +@@ -1 +1 @@ +-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE ++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE +-- +2.1.4 + diff --git a/package/gcc/4.7.4/301-missing-execinfo_h.patch b/package/gcc/4.7.4/301-missing-execinfo_h.patch new file mode 100644 index 0000000000..0e2092f3fb --- /dev/null +++ b/package/gcc/4.7.4/301-missing-execinfo_h.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500 ++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500 +@@ -500,7 +500,7 @@ + #ifdef __linux__ + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/package/gcc/4.7.4/305-libmudflap-susv3-legacy.patch b/package/gcc/4.7.4/305-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000000..374b1f8659 --- /dev/null +++ b/package/gcc/4.7.4/305-libmudflap-susv3-legacy.patch @@ -0,0 +1,49 @@ +Index: gcc-4.2/libmudflap/mf-hooks2.c +=================================================================== +--- gcc-4.2/libmudflap/mf-hooks2.c (revision 119834) ++++ gcc-4.2/libmudflap/mf-hooks2.c (working copy) +@@ -427,7 +427,7 @@ + { + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region"); +- bzero (s, n); ++ memset (s, 0, n); + } + + +@@ -437,7 +437,7 @@ + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src"); + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest"); +- bcopy (src, dest, n); ++ memmove (dest, src, n); + } + + +@@ -447,7 +447,7 @@ + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg"); + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg"); +- return bcmp (s1, s2, n); ++ return n == 0 ? 0 : memcmp (s1, s2, n); + } + + +@@ -456,7 +456,7 @@ + size_t n = strlen (s); + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region"); +- return index (s, c); ++ return strchr (s, c); + } + + +@@ -465,7 +465,7 @@ + size_t n = strlen (s); + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region"); +- return rindex (s, c); ++ return strrchr (s, c); + } + + /* XXX: stpcpy, memccpy */ diff --git a/package/gcc/4.7.4/810-arm-softfloat-libgcc.patch b/package/gcc/4.7.4/810-arm-softfloat-libgcc.patch new file mode 100644 index 0000000000..a3d7db014d --- /dev/null +++ b/package/gcc/4.7.4/810-arm-softfloat-libgcc.patch @@ -0,0 +1,25 @@ +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -57,7 +57,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +--- a/libgcc/config/arm/t-linux ++++ b/libgcc/config/arm/t-linux +@@ -1,6 +1,10 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _arm_addsubdf3 _arm_addsubsf3 ++ _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. diff --git a/package/gcc/4.7.4/830-arm_unbreak_armv4t.patch b/package/gcc/4.7.4/830-arm_unbreak_armv4t.patch new file mode 100644 index 0000000000..37f8f2a54d --- /dev/null +++ b/package/gcc/4.7.4/830-arm_unbreak_armv4t.patch @@ -0,0 +1,13 @@ +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html + +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + /* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ diff --git a/package/gcc/4.7.4/843-gcc-4.7.3-Fix-PR-target-58595.patch b/package/gcc/4.7.4/843-gcc-4.7.3-Fix-PR-target-58595.patch new file mode 100644 index 0000000000..656952cded --- /dev/null +++ b/package/gcc/4.7.4/843-gcc-4.7.3-Fix-PR-target-58595.patch @@ -0,0 +1,102 @@ +commit 4fa1f8926227d4e79975b674dc4292b9bec4b137 +Author: jakub +Date: Thu Mar 6 12:07:07 2014 +0000 + + PR target/58595 + * config/arm/arm.c (arm_tls_symbol_p): Remove. + (arm_legitimize_address): Call legitimize_tls_address for any + arm_tls_referenced_p expression, handle constant addend. Call it + before testing for !TARGET_ARM. + (thumb_legitimize_address): Don't handle arm_tls_symbol_p here. + + * gcc.dg/tls/pr58595.c: New test. + + + git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208380 138bc75d-0d04-0410-961f-82ee72b054a4 + +diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c +index ce24bfe..af5666b 100644 +--- a/gcc/config/arm/arm.c ++++ b/gcc/config/arm/arm.c +@@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); + static void arm_option_override (void); + static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode); + static bool arm_cannot_copy_insn_p (rtx); +-static bool arm_tls_symbol_p (rtx x); + static int arm_issue_rate (void); + static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; + static bool arm_output_addr_const_extra (FILE *, rtx); +@@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg) + rtx + arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) + { ++ if (arm_tls_referenced_p (x)) ++ { ++ rtx addend = NULL; ++ ++ if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS) ++ { ++ addend = XEXP (XEXP (x, 0), 1); ++ x = XEXP (XEXP (x, 0), 0); ++ } ++ ++ if (GET_CODE (x) != SYMBOL_REF) ++ return x; ++ ++ gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0); ++ ++ x = legitimize_tls_address (x, NULL_RTX); ++ ++ if (addend) ++ { ++ x = gen_rtx_PLUS (SImode, x, addend); ++ orig_x = x; ++ } ++ else ++ return x; ++ } ++ + if (!TARGET_ARM) + { + /* TODO: legitimize_address for Thumb2. */ +@@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) + return thumb_legitimize_address (x, orig_x, mode); + } + +- if (arm_tls_symbol_p (x)) +- return legitimize_tls_address (x, NULL_RTX); +- + if (GET_CODE (x) == PLUS) + { + rtx xop0 = XEXP (x, 0); +@@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) + rtx + thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) + { +- if (arm_tls_symbol_p (x)) +- return legitimize_tls_address (x, NULL_RTX); +- + if (GET_CODE (x) == PLUS + && CONST_INT_P (XEXP (x, 1)) + && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode) +@@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_p, + + /* Test for various thread-local symbols. */ + +-/* Return TRUE if X is a thread-local symbol. */ +- +-static bool +-arm_tls_symbol_p (rtx x) +-{ +- if (! TARGET_HAVE_TLS) +- return false; +- +- if (GET_CODE (x) != SYMBOL_REF) +- return false; +- +- return SYMBOL_REF_TLS_MODEL (x) != 0; +-} +- + /* Helper for arm_tls_referenced_p. */ + + static int diff --git a/package/gcc/4.7.4/844-gcc-fix-build-with-gcc5.patch b/package/gcc/4.7.4/844-gcc-fix-build-with-gcc5.patch new file mode 100644 index 0000000000..b076e5438e --- /dev/null +++ b/package/gcc/4.7.4/844-gcc-fix-build-with-gcc5.patch @@ -0,0 +1,42 @@ +From 4fb4acf88912dd978bb63ecab79641a5795ce84f Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Mon, 27 Jul 2015 15:05:14 +0200 +Subject: [PATCH] gcc: fix build with gcc5 + +gcc < 4.8 doesn't build with gcc5. + +Patch is from DragonFlyBSD github [1] + +[1] https://github.com/DragonFlyBSD/DPorts/issues/136 + +Signed-off-by: Romain Naour +--- + gcc/cp/cfns.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h +index 62cdfab..4f63cc4 100644 +--- a/gcc/cp/cfns.h ++++ b/gcc/cp/cfns.h +@@ -53,6 +53,9 @@ __inline + static unsigned int hash (const char *, unsigned int); + #ifdef __GNUC__ + __inline ++#ifdef __GNUC_STDC_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif + #endif + const char * libc_name_p (const char *, unsigned int); + /* maximum key range = 391, duplicates = 0 */ +@@ -96,7 +99,7 @@ hash (register const char *str, register unsigned int len) + 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 400, 400, 400, 400, 400 + }; +- register int hval = len; ++ register int hval = (int)len; + + switch (hval) + { +-- +2.4.3 + diff --git a/package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch b/package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch new file mode 100644 index 0000000000..79cd7a932a --- /dev/null +++ b/package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch @@ -0,0 +1,273 @@ +Allow C99-depending features of libstdc++ with uClibc + +The libstdc++ code is fairly restrictive on how it checks for C99 +compatibility: it requires *complete* C99 support to enable certain +features. For example, uClibc provides a good number of C99 features, +but not C99 complex number support. For this reason, libstdc++ +completely disables many the standard C++ methods that can in fact +work because uClibc provides the necessary functions. + +This patch is similar and highly inspired from +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in +a way that doesn't involve changing the configure.ac script, as +autoreconfiguring gcc is complicated. It simply relies on the fact +that uClibc defines the __UCLIBC__ definition. + +Signed-off-by: Thomas Petazzoni + +Index: b/libstdc++-v3/config/locale/generic/c_locale.h +=================================================================== +--- a/libstdc++-v3/config/locale/generic/c_locale.h ++++ b/libstdc++-v3/config/locale/generic/c_locale.h +@@ -71,7 +71,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +Index: b/libstdc++-v3/config/locale/gnu/c_locale.h +=================================================================== +--- a/libstdc++-v3/config/locale/gnu/c_locale.h ++++ b/libstdc++-v3/config/locale/gnu/c_locale.h +@@ -89,7 +89,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +Index: b/libstdc++-v3/include/bits/basic_string.h +=================================================================== +--- a/libstdc++-v3/include/bits/basic_string.h ++++ b/libstdc++-v3/include/bits/basic_string.h +@@ -2806,7 +2806,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99) \ ++#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + + #include +Index: b/libstdc++-v3/include/bits/locale_facets.tcc +=================================================================== +--- a/libstdc++-v3/include/bits/locale_facets.tcc ++++ b/libstdc++-v3/include/bits/locale_facets.tcc +@@ -989,7 +989,7 @@ + char __fbuf[16]; + __num_base::_S_format_float(__io, __fbuf, __mod); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough (most probably sufficient + // for non-ios_base::fixed outputs) + int __cs_size = __max_digits * 3; +Index: b/libstdc++-v3/include/bits/locale_facets_nonio.tcc +=================================================================== +--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc ++++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc +@@ -572,7 +572,7 @@ + { + const locale __loc = __io.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough. + int __cs_size = 64; + char* __cs = static_cast(__builtin_alloca(__cs_size)); +Index: b/libstdc++-v3/include/c_compatibility/math.h +=================================================================== +--- a/libstdc++-v3/include/c_compatibility/math.h ++++ b/libstdc++-v3/include/c_compatibility/math.h +@@ -57,7 +57,7 @@ + using std::floor; + using std::fmod; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::fpclassify; + using std::isfinite; + using std::isinf; +Index: b/libstdc++-v3/include/c_compatibility/wchar.h +=================================================================== +--- a/libstdc++-v3/include/c_compatibility/wchar.h ++++ b/libstdc++-v3/include/c_compatibility/wchar.h +@@ -103,7 +103,7 @@ + using std::wmemset; + using std::wcsftime; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/c_global/cstdlib +=================================================================== +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -146,7 +146,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +Index: b/libstdc++-v3/include/c_global/cwchar +=================================================================== +--- a/libstdc++-v3/include/c_global/cwchar ++++ b/libstdc++-v3/include/c_global/cwchar +@@ -234,7 +234,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +@@ -291,7 +291,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/c_std/cstdio +=================================================================== +--- a/libstdc++-v3/include/c_std/cstdio ++++ b/libstdc++-v3/include/c_std/cstdio +@@ -140,7 +140,7 @@ + using ::vsprintf; + } // namespace std + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf +Index: b/libstdc++-v3/include/c_std/cstdlib +=================================================================== +--- a/libstdc++-v3/include/c_std/cstdlib ++++ b/libstdc++-v3/include/c_std/cstdlib +@@ -143,7 +143,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +Index: b/libstdc++-v3/include/c_std/cwchar +=================================================================== +--- a/libstdc++-v3/include/c_std/cwchar ++++ b/libstdc++-v3/include/c_std/cwchar +@@ -230,7 +230,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +Index: b/libstdc++-v3/include/ext/vstring.h +=================================================================== +--- a/libstdc++-v3/include/ext/vstring.h ++++ b/libstdc++-v3/include/ext/vstring.h +@@ -2537,7 +2537,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99)) ++#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))) + + #include + +Index: b/libstdc++-v3/include/tr1/cstdio +=================================================================== +--- a/libstdc++-v3/include/tr1/cstdio ++++ b/libstdc++-v3/include/tr1/cstdio +@@ -33,7 +33,7 @@ + + #include + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +Index: b/libstdc++-v3/include/tr1/cstdlib +=================================================================== +--- a/libstdc++-v3/include/tr1/cstdlib ++++ b/libstdc++-v3/include/tr1/cstdlib +@@ -35,7 +35,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +Index: b/libstdc++-v3/include/tr1/cwchar +=================================================================== +--- a/libstdc++-v3/include/tr1/cwchar ++++ b/libstdc++-v3/include/tr1/cwchar +@@ -52,7 +52,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/tr1/stdlib.h +=================================================================== +--- a/libstdc++-v3/include/tr1/stdlib.h ++++ b/libstdc++-v3/include/tr1/stdlib.h +@@ -33,7 +33,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + using std::tr1::atoll; + using std::tr1::strtoll; +Index: b/libstdc++-v3/src/c++11/debug.cc +=================================================================== +--- a/libstdc++-v3/src/c++11/debug.cc ++++ b/libstdc++-v3/src/c++11/debug.cc +@@ -783,7 +783,7 @@ + int __n __attribute__ ((__unused__)), + const char* __fmt, _Tp __s) const throw () + { +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + std::snprintf(__buf, __n, __fmt, __s); + #else + std::sprintf(__buf, __fmt, __s); +Index: b/libstdc++-v3/include/c_global/cstdio +=================================================================== +--- a/libstdc++-v3/include/c_global/cstdio ++++ b/libstdc++-v3/include/c_global/cstdio +@@ -140,7 +140,7 @@ + using ::vsprintf; + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/package/gcc/4.7.4/851-PR-other-56780.patch b/package/gcc/4.7.4/851-PR-other-56780.patch new file mode 100644 index 0000000000..a4ae830975 --- /dev/null +++ b/package/gcc/4.7.4/851-PR-other-56780.patch @@ -0,0 +1,244 @@ +From 4e318d50b876def5f97e2031926354055e442ca3 Mon Sep 17 00:00:00 2001 +From: ian +Date: Sat, 1 Jun 2013 00:20:49 +0000 +Subject: [PATCH] PR other/56780 + +* libiberty/configure.ac: Move test for --enable-install-libiberty +outside of the 'with_target_subdir' test so that it actually gets +run. Add output messages to show the test result. +* libiberty/configure: Regenerate. +* libiberty/Makefile.in (install_to_libdir): Place the +installation of the libiberty library in the same guard as that +used for the headers to prevent it being installed unless +requested via --enable-install-libiberty. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199570 138bc75d-0d04-0410-961f-82ee72b054a4 + +libiberty: fix --enable-install-libiberty flag [PR 56780] + +Commit 199570 fixed the --disable-install-libiberty behavior, but it also +added a bug where the enable path never works because the initial clear +of target_header_dir wasn't deleted. So we end up initializing properly +at the top only to reset it at the end all the time. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206367 138bc75d-0d04-0410-961f-82ee72b054a4 + +[Romain + squash the two upstream commits + Remove the ChangeLog] +Signed-off-by: Romain Naour +--- + libiberty/Makefile.in | 24 ++++++++++----------- + libiberty/configure | 57 +++++++++++++++++++++++++++----------------------- + libiberty/configure.ac | 47 ++++++++++++++++++++++------------------- + 3 files changed, 68 insertions(+), 60 deletions(-) + +diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in +index 5280bc1..a69c6b6 100644 +--- a/libiberty/Makefile.in ++++ b/libiberty/Makefile.in +@@ -353,19 +353,19 @@ install-strip: install + # since it will be passed the multilib flags. + MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` + install_to_libdir: all +- ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR) +- $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n +- ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ) +- mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB) + if test -n "${target_header_dir}"; then \ +- case "${target_header_dir}" in \ +- /*) thd=${target_header_dir};; \ +- *) thd=${includedir}/${target_header_dir};; \ +- esac; \ +- ${mkinstalldirs} $(DESTDIR)$${thd}; \ +- for h in ${INSTALLED_HEADERS}; do \ +- ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ +- done; \ ++ ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \ ++ $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n; \ ++ ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ); \ ++ mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB); \ ++ case "${target_header_dir}" in \ ++ /*) thd=${target_header_dir};; \ ++ *) thd=${includedir}/${target_header_dir};; \ ++ esac; \ ++ ${mkinstalldirs} $(DESTDIR)$${thd}; \ ++ for h in ${INSTALLED_HEADERS}; do \ ++ ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ ++ done; \ + fi + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install + +diff --git a/libiberty/configure b/libiberty/configure +index 6e98352..44d1f78 100755 +--- a/libiberty/configure ++++ b/libiberty/configure +@@ -675,8 +675,8 @@ with_cross_host + with_newlib + enable_maintainer_mode + enable_multilib +-enable_largefile + enable_install_libiberty ++enable_largefile + ' + ac_precious_vars='build_alias + host_alias +@@ -1303,8 +1303,8 @@ Optional Features: + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-multilib build many library versions (default) ++ --enable-install-libiberty Install headers and library for end users + --disable-largefile omit support for large files +- --enable-install-libiberty Install headers for end users + + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +@@ -2784,6 +2784,35 @@ if test $cross_compiling = no && test $multilib = yes \ + cross_compiling=maybe + fi + ++# We may wish to install the target headers somewhere. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install libiberty headers and static library" >&5 ++$as_echo_n "checking whether to install libiberty headers and static library... " >&6; } ++ ++# Check whether --enable-install-libiberty was given. ++if test "${enable_install_libiberty+set}" = set; then : ++ enableval=$enable_install_libiberty; enable_install_libiberty=$enableval ++else ++ enable_install_libiberty=no ++fi ++ ++# Option parsed, now set things appropriately. ++case x"$enable_install_libiberty" in ++ xyes|x) ++ target_header_dir=libiberty ++ ;; ++ xno) ++ target_header_dir= ++ ;; ++ *) ++ # This could be sanity-checked in various ways... ++ target_header_dir="${enable_install_libiberty}" ++ ;; ++esac ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_install_libiberty" >&5 ++$as_echo "$enable_install_libiberty" >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: target_header_dir = $target_header_dir" >&5 ++$as_echo "$as_me: target_header_dir = $target_header_dir" >&6;} ++ + + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' +@@ -5475,7 +5504,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +@@ -5752,29 +5780,6 @@ _ACEOF + + esac + +- # We may wish to install the target headers somewhere. +- # Check whether --enable-install-libiberty was given. +-if test "${enable_install_libiberty+set}" = set; then : +- enableval=$enable_install_libiberty; enable_install_libiberty=$enableval +-else +- enable_install_libiberty=no +-fi +- +- # Option parsed, now set things appropriately. +- case x"$enable_install_libiberty" in +- xyes|x) +- target_header_dir=libiberty +- ;; +- xno) +- target_header_dir= +- ;; +- *) +- # This could be sanity-checked in various ways... +- target_header_dir="${enable_install_libiberty}" +- ;; +- esac +- +- + else + + # Not a target library, so we set things up to run the test suite. +diff --git a/libiberty/configure.ac b/libiberty/configure.ac +index 754b66a..04260ec 100644 +--- a/libiberty/configure.ac ++++ b/libiberty/configure.ac +@@ -128,6 +128,31 @@ if test $cross_compiling = no && test $multilib = yes \ + cross_compiling=maybe + fi + ++# We may wish to install the target headers somewhere. ++AC_MSG_CHECKING([whether to install libiberty headers and static library]) ++dnl install-libiberty is disabled by default ++ ++AC_ARG_ENABLE(install-libiberty, ++[ --enable-install-libiberty Install headers and library for end users], ++enable_install_libiberty=$enableval, ++enable_install_libiberty=no)dnl ++ ++# Option parsed, now set things appropriately. ++case x"$enable_install_libiberty" in ++ xyes|x) ++ target_header_dir=libiberty ++ ;; ++ xno) ++ target_header_dir= ++ ;; ++ *) ++ # This could be sanity-checked in various ways... ++ target_header_dir="${enable_install_libiberty}" ++ ;; ++esac ++AC_MSG_RESULT($enable_install_libiberty) ++AC_MSG_NOTICE([target_header_dir = $target_header_dir]) ++ + GCC_NO_EXECUTABLES + AC_PROG_CC + AC_SYS_LARGEFILE +@@ -379,7 +404,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +@@ -490,27 +514,6 @@ if test -n "${with_target_subdir}"; then + + esac + +- # We may wish to install the target headers somewhere. +- AC_ARG_ENABLE(install-libiberty, +- [ --enable-install-libiberty Install headers for end users], +- enable_install_libiberty=$enableval, +- enable_install_libiberty=no)dnl +- +- # Option parsed, now set things appropriately. +- case x"$enable_install_libiberty" in +- xyes|x) +- target_header_dir=libiberty +- ;; +- xno) +- target_header_dir= +- ;; +- *) +- # This could be sanity-checked in various ways... +- target_header_dir="${enable_install_libiberty}" +- ;; +- esac +- +- + else + + # Not a target library, so we set things up to run the test suite. +-- +2.4.3 + diff --git a/package/gcc/4.7.4/900-musl-support.patch b/package/gcc/4.7.4/900-musl-support.patch new file mode 100644 index 0000000000..bf8fbc079a --- /dev/null +++ b/package/gcc/4.7.4/900-musl-support.patch @@ -0,0 +1,587 @@ +Add musl support to gcc + +This patch comes from the musl-cross project at +https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version: + + * the config.sub modifications have been removed, because Buildroot + already overwrites all config.sub with a more recent config.sub + that has musl support. + + * change to ensure that a dummy dynamic linker path + MUSL_DYNAMIC_LINKER is defined for all architectures, + otherwise building gcc for architectures not supported by musl was + causing build failure. Bug reported upstream at + https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on. + + * change the USE_PT_GNU_EH_FRAME logic to keep the existing gcc logic + and only add the musl one as an addition, not as a replacement. Not + doing this breaks C++ exception handling with glibc, because + USE_PT_GNU_EH_FRAME doesn't get defined due to the configure script + not testing dl_iterate_phdr() on any system except Solaris. + +Signed-off-by: Thomas Petazzoni +--- + +# HG changeset patch +# Parent f50bb54f331f73405131a30b4f353cfda1c70304 +Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one. + +Index: b/libstdc++-v3/configure.host +=================================================================== +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -243,6 +243,13 @@ + os_include_dir="os/bsd/freebsd" + ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) ++ # check for musl by target ++ case "${host_os}" in ++ *-musl*) ++ os_include_dir="os/generic" ++ ;; ++ *) ++ + if [ "$uclibc" = "yes" ]; then + os_include_dir="os/uclibc" + elif [ "$bionic" = "yes" ]; then +@@ -251,6 +258,9 @@ + os_include_dir="os/gnu-linux" + fi + ;; ++ ++ esac ++ ;; + hpux*) + os_include_dir="os/hpux" + ;; +Index: b/gcc/config.gcc +=================================================================== +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -522,7 +522,7 @@ + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" + + # Common parts for widely ported systems. + case ${target} in +@@ -625,6 +625,9 @@ + *-*-*uclibc*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" + ;; ++ *-*-*musl*) ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" ++ ;; + *) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" + ;; +@@ -2091,6 +2094,10 @@ + powerpc*-*-linux*paired*) + tm_file="${tm_file} rs6000/750cl.h" ;; + esac ++ case ${target} in ++ *-linux*-musl*) ++ enable_secureplt=yes ;; ++ esac + if test x${enable_secureplt} = xyes; then + tm_file="rs6000/secureplt.h ${tm_file}" + fi +Index: b/gcc/config/linux.h +=================================================================== +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -33,10 +33,12 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ +@@ -54,18 +56,21 @@ + uClibc or Bionic is the default C library and whether + -muclibc or -mglibc or -mbionic has been passed to change the default. */ + +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" + + #if DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) + #elif DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) + #elif DEFAULT_LIBC == LIBC_BIONIC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) + #else + #error "Unsupported DEFAULT_LIBC" + #endif /* DEFAULT_LIBC */ +@@ -83,23 +88,32 @@ + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" + ++/* Musl dynamic linker paths must be defined on a per-architecture ++ basis, for each architecture supported by Musl. However, in order ++ to let other architectures continue to build with other C ++ libraries, we provide a dummy definition of the following defines. */ ++#define MUSL_DYNAMIC_LINKER "invalid" ++#define MUSL_DYNAMIC_LINKER32 "invalid" ++#define MUSL_DYNAMIC_LINKER64 "invalid" ++#define MUSL_DYNAMIC_LINKERX32 "invalid" ++ + #define GNU_USER_DYNAMIC_LINKER \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ +- BIONIC_DYNAMIC_LINKER) ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + #define GNU_USER_DYNAMIC_LINKER32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ +- BIONIC_DYNAMIC_LINKER32) ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ +- BIONIC_DYNAMIC_LINKER64) ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + #define GNU_USER_DYNAMIC_LINKERX32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ +- BIONIC_DYNAMIC_LINKERX32) ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) + + /* Determine whether the entire c99 runtime + is present in the runtime library. */ + #undef TARGET_C99_FUNCTIONS +-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC) ++#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL) + + /* Whether we have sincos that follows the GNU extension. */ + #undef TARGET_HAS_SINCOS +@@ -108,3 +122,74 @@ + /* Whether we have Bionic libc runtime */ + #undef TARGET_HAS_BIONIC + #define TARGET_HAS_BIONIC (OPTION_BIONIC) ++ ++/* musl avoids problematic includes by rearranging the include directories. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif +Index: b/gcc/config/linux.opt +=================================================================== +--- a/gcc/config/linux.opt ++++ b/gcc/config/linux.opt +@@ -30,3 +30,7 @@ + muclibc + Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic) + Use uClibc C library ++ ++mmusl ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc) ++Use musl C library +Index: b/gcc/ginclude/stddef.h +=================================================================== +--- a/gcc/ginclude/stddef.h ++++ b/gcc/ginclude/stddef.h +@@ -184,6 +184,7 @@ + #ifndef _GCC_SIZE_T + #ifndef _SIZET_ + #ifndef __size_t ++#ifndef __DEFINED_size_t /* musl */ + #define __size_t__ /* BeOS */ + #define __SIZE_T__ /* Cray Unicos/Mk */ + #define _SIZE_T +@@ -200,6 +201,7 @@ + #define ___int_size_t_h + #define _GCC_SIZE_T + #define _SIZET_ ++#define __DEFINED_size_t /* musl */ + #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ + || defined(__FreeBSD_kernel__) + /* __size_t is a typedef on FreeBSD 5, must not trash it. */ +@@ -215,6 +217,7 @@ + typedef long ssize_t; + #endif /* __BEOS__ */ + #endif /* !(defined (__GNUG__) && defined (size_t)) */ ++#endif /* __DEFINED_size_t */ + #endif /* __size_t */ + #endif /* _SIZET_ */ + #endif /* _GCC_SIZE_T */ +Index: b/libgomp/config/posix/time.c +=================================================================== +--- a/libgomp/config/posix/time.c ++++ b/libgomp/config/posix/time.c +@@ -28,6 +28,8 @@ + The following implementation uses the most simple POSIX routines. + If present, POSIX 4 clocks should be used instead. */ + ++#define _POSIX_C_SOURCE 199309L /* for clocks */ ++ + #include "libgomp.h" + #include + #if TIME_WITH_SYS_TIME +Index: b/libgcc/unwind-dw2-fde-dip.c +=================================================================== +--- a/libgcc/unwind-dw2-fde-dip.c ++++ b/libgcc/unwind-dw2-fde-dip.c +@@ -71,6 +71,13 @@ + # define USE_PT_GNU_EH_FRAME + #endif + ++/* For musl libc, TARGET_DL_ITERATE_PHDR gets defined by the configure ++ script. */ ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ ++ && defined(TARGET_DL_ITERATE_PHDR) ++# define USE_PT_GNU_EH_FRAME ++#endif ++ + #if defined(USE_PT_GNU_EH_FRAME) + + #include +Index: b/gcc/configure +=================================================================== +--- a/gcc/configure ++++ b/gcc/configure +@@ -26906,6 +26910,9 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +Index: b/gcc/configure.ac +=================================================================== +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -4767,6 +4771,9 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +Index: b/fixincludes/mkfixinc.sh +=================================================================== +--- a/fixincludes/mkfixinc.sh ++++ b/fixincludes/mkfixinc.sh +@@ -20,7 +20,8 @@ + powerpc-*-eabi* | \ + powerpc-*-rtems* | \ + powerpcle-*-eabisim* | \ +- powerpcle-*-eabi* ) ++ powerpcle-*-eabi* | \ ++ *-musl* ) + # IF there is no include fixing, + # THEN create a no-op fixer and exit + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target} +Index: b/gcc/config/i386/linux.h +=================================================================== +--- a/gcc/config/i386/linux.h ++++ b/gcc/config/i386/linux.h +@@ -22,3 +22,5 @@ + + #define GNU_USER_LINK_EMULATION "elf_i386" + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" +Index: b/gcc/config/i386/linux64.h +=================================================================== +--- a/gcc/config/i386/linux64.h ++++ b/gcc/config/i386/linux64.h +@@ -31,3 +31,10 @@ + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER32 ++#undef MUSL_DYNAMIC_LINKER64 ++#undef MUSL_DYNAMIC_LINKERX32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" +Index: b/libitm/config/linux/x86/tls.h +=================================================================== +--- a/libitm/config/linux/x86/tls.h ++++ b/libitm/config/linux/x86/tls.h +@@ -25,16 +25,19 @@ + #ifndef LIBITM_X86_TLS_H + #define LIBITM_X86_TLS_H 1 + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + /* Use slots in the TCB head rather than __thread lookups. + GLIBC has reserved words 10 through 13 for TM. */ + #define HAVE_ARCH_GTM_THREAD 1 + #define HAVE_ARCH_GTM_THREAD_DISP 1 + #endif ++#endif + + #include "config/generic/tls.h" + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + namespace GTM HIDDEN { + + #ifdef __x86_64__ +@@ -101,5 +104,6 @@ + + } // namespace GTM + #endif /* >= GLIBC 2.10 */ ++#endif + + #endif // LIBITM_X86_TLS_H +Index: b/gcc/config/arm/linux-eabi.h +=================================================================== +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -64,6 +64,23 @@ + #undef GLIBC_DYNAMIC_LINKER + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3" + ++/* For ARM musl currently supports four dynamic linkers: ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB ++ musl does not support the legacy OABI mode. ++ All the dynamic linkers live in /lib. ++ We default to soft-float, EL. */ ++#undef MUSL_DYNAMIC_LINKER ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" ++#endif ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC +Index: b/libitm/config/arm/hwcap.cc +=================================================================== +--- a/libitm/config/arm/hwcap.cc ++++ b/libitm/config/arm/hwcap.cc +@@ -40,7 +40,11 @@ + + #ifdef __linux__ + #include ++#ifdef __GLIBC__ + #include ++#else ++#include ++#endif + #include + + static void __attribute__((constructor)) +Index: b/gcc/config/mips/linux.h +=================================================================== +--- a/gcc/config/mips/linux.h ++++ b/gcc/config/mips/linux.h +@@ -19,3 +19,11 @@ + . */ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" ++ ++#if TARGET_ENDIAN_DEFAULT == 0 /* LE */ ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}" ++#endif ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" +Index: b/gcc/config/rs6000/linux64.h +=================================================================== +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -362,17 +362,23 @@ + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1" + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" ++#undef MUSL_DYNAMIC_LINKER32 ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER32 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + + + #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \ +Index: b/gcc/config/rs6000/secureplt.h +=================================================================== +--- a/gcc/config/rs6000/secureplt.h ++++ b/gcc/config/rs6000/secureplt.h +@@ -18,3 +18,4 @@ + . */ + + #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt" ++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt" +Index: b/gcc/config/rs6000/sysv4.h +=================================================================== +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -566,6 +566,9 @@ + #ifndef CC1_SECURE_PLT_DEFAULT_SPEC + #define CC1_SECURE_PLT_DEFAULT_SPEC "" + #endif ++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC ++#define LINK_SECURE_PLT_DEFAULT_SPEC "" ++#endif + + /* Pass -G xxx to the compiler and set correct endian mode. */ + #define CC1_SPEC "%{G*} %(cc1_cpu) \ +@@ -626,7 +629,8 @@ + %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \ + %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ + %{mcall-i960-old: --oformat elf32-powerpcle} \ +- }}}}" ++ }}}} \ ++%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}" + + /* Any specific OS flags. */ + #define LINK_OS_SPEC "\ +@@ -804,15 +808,19 @@ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + + #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ +@@ -938,6 +946,7 @@ + { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \ + { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \ + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ ++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \ + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ +Index: b/gcc/config/mips/linux64.h +=================================================================== +--- a/gcc/config/mips/linux64.h ++++ b/gcc/config/mips/linux64.h +@@ -30,4 +30,4 @@ + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" + #define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ +- BIONIC_DYNAMIC_LINKERN32) ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKER) diff --git a/package/gcc/4.9.3/100-uclibc-conf.patch b/package/gcc/4.9.3/100-uclibc-conf.patch new file mode 100644 index 0000000000..d56bf0a194 --- /dev/null +++ b/package/gcc/4.9.3/100-uclibc-conf.patch @@ -0,0 +1,15 @@ +Index: gcc-4.8.0/contrib/regression/objs-gcc.sh +=================================================================== +--- gcc-4.8.0.orig/contrib/regression/objs-gcc.sh 2009-04-09 17:00:19.000000000 +0200 ++++ gcc-4.8.0/contrib/regression/objs-gcc.sh 2013-03-23 17:39:04.000000000 +0100 +@@ -106,6 +106,10 @@ + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 diff --git a/package/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional b/package/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional new file mode 100644 index 0000000000..b7094fe652 --- /dev/null +++ b/package/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional @@ -0,0 +1,122 @@ +http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html + +On glibc the libc.so carries a copy of the math function copysignl() but +on uClibc math functions like copysignl() live in libm. Since libgcc_s +contains unresolved symbols, any attempt to link against libgcc_s +without explicitely specifying -lm fails, resulting in a broken +bootstrap of the compiler. + +Forward port to gcc 4.5.1 by Gustavo Zacarias + +--- + libgcc/Makefile.in | 4 +++- + libgcc/configure | 32 ++++++++++++++++++++++++++++++++ + libgcc/configure.ac | 21 +++++++++++++++++++++ + 3 files changed, 56 insertions(+), 1 deletion(-) + +Index: gcc-4.8.0/libgcc/Makefile.in +=================================================================== +--- gcc-4.8.0.orig/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100 ++++ gcc-4.8.0/libgcc/Makefile.in 2013-03-24 09:12:43.000000000 +0100 +@@ -41,6 +41,7 @@ + decimal_float = @decimal_float@ + enable_decimal_float = @enable_decimal_float@ + fixed_point = @fixed_point@ ++LIBGCC_LIBM = @LIBGCC_LIBM@ + + host_noncanonical = @host_noncanonical@ + target_noncanonical = @target_noncanonical@ +@@ -927,9 +928,10 @@ + @multilib_dir@,$(MULTIDIR),$(subst \ + @shlib_objs@,$(objects) libgcc.a,$(subst \ + @shlib_base_name@,libgcc_s,$(subst \ ++ @libgcc_libm@,$(LIBGCC_LIBM),$(subst \ + @shlib_map_file@,$(mapfile),$(subst \ + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \ +- @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))) ++ @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))) + + libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts) + # @multilib_flags@ is still needed because this may use +Index: gcc-4.8.0/libgcc/configure +=================================================================== +--- gcc-4.8.0.orig/libgcc/configure 2012-11-05 00:08:42.000000000 +0100 ++++ gcc-4.8.0/libgcc/configure 2013-03-24 09:12:43.000000000 +0100 +@@ -564,6 +564,7 @@ + tmake_file + sfp_machine_header + set_use_emutls ++LIBGCC_LIBM + set_have_cc_tls + vis_hide + fixed_point +@@ -4481,6 +4482,37 @@ + fi + fi + ++# On powerpc libgcc_s references copysignl which is a libm function but ++# glibc apparently also provides it via libc as opposed to uClibc where ++# it lives in libm. ++echo "$as_me:$LINENO: checking for library containing copysignl" >&5 ++echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6 ++if test "${libgcc_cv_copysignl_lib+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++ echo '#include ' > conftest.c ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c ++ libgcc_cv_copysignl_lib="-lc" ++ if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } ++ then ++ libgcc_cv_copysignl_lib="-lm" ++ fi ++ rm -f conftest.* ++ ++fi ++echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5 ++echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6 ++ ++case /${libgcc_cv_copysignl_lib}/ in ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;; ++ *) LIBGCC_LIBM= ;; ++esac + + # Conditionalize the makefile for this target machine. + tmake_file_= +Index: gcc-4.8.0/libgcc/configure.ac +=================================================================== +--- gcc-4.8.0.orig/libgcc/configure.ac 2012-10-15 15:10:30.000000000 +0200 ++++ gcc-4.8.0/libgcc/configure.ac 2013-03-24 09:12:43.000000000 +0100 +@@ -326,6 +326,27 @@ + fi + AC_SUBST(set_have_cc_tls) + ++# On powerpc libgcc_s references copysignl which is a libm function but ++# glibc apparently also provides it via libc as opposed to uClibc where ++# it lives in libm. ++AC_CACHE_CHECK ++ libgcc_cv_copysignl_lib, ++ echo '#include ' > conftest.c ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c ++ libgcc_cv_copysignl_lib="-lc" ++ if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD) ++ then ++ libgcc_cv_copysignl_lib="-lm" ++ fi ++ rm -f conftest.* ++ ]) ++ ++case /${libgcc_cv_copysignl_lib}/ in ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;; ++ *) LIBGCC_LIBM= ;; ++esac ++AC_SUBST(LIBGCC_LIBM) ++ + # See if we have emulated thread-local storage. + GCC_CHECK_EMUTLS + set_use_emutls= diff --git a/package/gcc/4.9.3/111-pr65730.patch b/package/gcc/4.9.3/111-pr65730.patch new file mode 100644 index 0000000000..f195e308da --- /dev/null +++ b/package/gcc/4.9.3/111-pr65730.patch @@ -0,0 +1,37 @@ +From b9a7775674d91c7af8043a83211ffeaa576327d7 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 10 Apr 2015 17:46:30 +0300 +Subject: [PATCH] Fix PR target/65730 + +2015-05-20 Max Filippov +gcc/ + * config/xtensa/xtensa.c (init_alignment_context): Replace MULT + by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT). + +Signed-off-by: Max Filippov +--- +Backported from: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223452 +Changes to ChangeLog are dropped. + + gcc/config/xtensa/xtensa.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c +index eb039ba..7296e36 100644 +--- a/gcc/config/xtensa/xtensa.c ++++ b/gcc/config/xtensa/xtensa.c +@@ -1461,8 +1461,9 @@ init_alignment_context (struct alignment_context *ac, rtx mem) + if (ac->shift != NULL_RTX) + { + /* Shift is the byte count, but we need the bitcount. */ +- ac->shift = expand_simple_binop (SImode, MULT, ac->shift, +- GEN_INT (BITS_PER_UNIT), ++ gcc_assert (exact_log2 (BITS_PER_UNIT) >= 0); ++ ac->shift = expand_simple_binop (SImode, ASHIFT, ac->shift, ++ GEN_INT (exact_log2 (BITS_PER_UNIT)), + NULL_RTX, 1, OPTAB_DIRECT); + ac->modemask = expand_simple_binop (SImode, ASHIFT, + GEN_INT (GET_MODE_MASK (mode)), +-- +1.8.1.4 + diff --git a/package/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch b/package/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch new file mode 100644 index 0000000000..c11ad35aac --- /dev/null +++ b/package/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch @@ -0,0 +1,29 @@ +From 9bf6066d588632dab9f78932df15b5b4140f31f3 Mon Sep 17 00:00:00 2001 +From: "Arnout Vandecappelle (Essensium/Mind)" +Date: Fri, 6 Nov 2015 14:27:23 +0100 +Subject: [PATCH] gcc/config.gcc: fix typo for powerpc e6500 cpu_is_64bit + +Otherwise it is not recognized as a 64-bit powerpc and gcc will not generate +64-bit binaries by default. + +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gcc/config.gcc | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 4a7cbd2..9cc765e 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -439,7 +439,7 @@ powerpc*-*-*) + cpu_type=rs6000 + extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h" + case x$with_cpu in +- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500) ++ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500) + cpu_is_64bit=yes + ;; + esac +-- +2.6.2 + diff --git a/package/gcc/4.9.3/130-pr43538.patch b/package/gcc/4.9.3/130-pr43538.patch new file mode 100644 index 0000000000..19e57bb059 --- /dev/null +++ b/package/gcc/4.9.3/130-pr43538.patch @@ -0,0 +1,25 @@ +From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001 +From: glisse +Date: Fri, 25 Apr 2014 08:03:08 +0000 +Subject: [PATCH] 2014-04-25 Marc Glisse + + PR target/43538 + * mt-gnu: Don't reset CXXFLAGS_FOR_TARGET. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4 +Signed-off-by: Max Filippov +--- + config/mt-gnu | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/mt-gnu b/config/mt-gnu +index 15bf417..5c696f5 100644 +--- a/config/mt-gnu ++++ b/config/mt-gnu +@@ -1 +1 @@ +-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE ++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE +-- +2.1.4 + diff --git a/package/gcc/4.9.3/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch b/package/gcc/4.9.3/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch new file mode 100644 index 0000000000..55f32288f5 --- /dev/null +++ b/package/gcc/4.9.3/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch @@ -0,0 +1,37 @@ +From 3c536954a67a883630f4a7513a27f02a892c3dcb Mon Sep 17 00:00:00 2001 +From: Evgeniy Stepanov +Date: Tue, 21 Oct 2014 21:08:13 +0000 +Subject: [PATCH] [sanitizer] Fix build with _FILE_OFFSET_BITS=64. + +Sanitizer source is not affected by _FILE_OFFSET_BITS in general, +but this one file must be built with 32-bit off_t. More details in the code. + +git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220328 91177308-0d34-0410-b5e6-96231b3b80d8 +Signed-off-by: Max Filippov +--- + lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index bbc1108..fc09522 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -13,7 +13,15 @@ + + #include "sanitizer_platform.h" + #if SANITIZER_LINUX || SANITIZER_MAC ++// Tests in this file assume that off_t-dependent data structures match the ++// libc ABI. For example, struct dirent here is what readdir() function (as ++// exported from libc) returns, and not the user-facing "dirent", which ++// depends on _FILE_OFFSET_BITS setting. ++// To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below. ++#ifdef _FILE_OFFSET_BITS ++#undef _FILE_OFFSET_BITS ++#endif + + #include "sanitizer_internal_defs.h" + #include "sanitizer_platform_limits_posix.h" + +-- +2.1.4 + diff --git a/package/gcc/4.9.3/301-missing-execinfo_h.patch b/package/gcc/4.9.3/301-missing-execinfo_h.patch new file mode 100644 index 0000000000..00efda24aa --- /dev/null +++ b/package/gcc/4.9.3/301-missing-execinfo_h.patch @@ -0,0 +1,13 @@ +Index: gcc-4.8.0/boehm-gc/include/gc.h +=================================================================== +--- gcc-4.8.0.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200 ++++ gcc-4.8.0/boehm-gc/include/gc.h 2013-03-23 17:39:20.000000000 +0100 +@@ -503,7 +503,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/package/gcc/4.9.3/810-arm-softfloat-libgcc.patch b/package/gcc/4.9.3/810-arm-softfloat-libgcc.patch new file mode 100644 index 0000000000..c8cb377d55 --- /dev/null +++ b/package/gcc/4.9.3/810-arm-softfloat-libgcc.patch @@ -0,0 +1,30 @@ +Index: gcc-4.8.0/gcc/config/arm/linux-elf.h +=================================================================== +--- gcc-4.8.0.orig/gcc/config/arm/linux-elf.h 2013-01-10 21:38:27.000000000 +0100 ++++ gcc-4.8.0/gcc/config/arm/linux-elf.h 2013-03-23 17:40:00.000000000 +0100 +@@ -55,7 +55,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +Index: gcc-4.8.0/libgcc/config/arm/t-linux +=================================================================== +--- gcc-4.8.0.orig/libgcc/config/arm/t-linux 2012-03-22 16:14:46.000000000 +0100 ++++ gcc-4.8.0/libgcc/config/arm/t-linux 2013-03-23 17:40:54.000000000 +0100 +@@ -1,6 +1,11 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. diff --git a/package/gcc/4.9.3/830-arm_unbreak_armv4t.patch b/package/gcc/4.9.3/830-arm_unbreak_armv4t.patch new file mode 100644 index 0000000000..37f8f2a54d --- /dev/null +++ b/package/gcc/4.9.3/830-arm_unbreak_armv4t.patch @@ -0,0 +1,13 @@ +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html + +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + /* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ diff --git a/package/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch b/package/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch new file mode 100644 index 0000000000..e116e2b24a --- /dev/null +++ b/package/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch @@ -0,0 +1,169 @@ +Fetched from Xilinx gcc git at https://github.com/Xilinx/gcc + +From 23c35173490ac2d6348a668dfc9c1a6eb62171f2 Mon Sep 17 00:00:00 2001 +From: "Edgar E. Iglesias" +Date: Mon, 18 Jun 2012 20:18:13 +0200 +Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support. + +Changelog + +2013-03-18 Edgar E. Iglesias + David Holsgrove + + * common/config/microblaze/microblaze-common.c: Remove + TARGET_EXCEPT_UNWIND_INFO definition. + * config/microblaze/microblaze-protos.h: Add + microblaze_eh_return prototype. + * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register, + microblaze_expand_epilogue, microblaze_return_addr): Handle + calls_eh_return + (microblaze_eh_return): New function. + * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET, + EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX, + ASM_PREFERRED_EH_DATA_FORMAT + * gcc/config/microblaze/microblaze.md: Define eh_return pattern. + +Signed-off-by: David Holsgrove +Signed-off-by: Edgar E. Iglesias +--- + gcc/common/config/microblaze/microblaze-common.c | 3 --- + gcc/config/microblaze/microblaze-protos.h | 1 + + gcc/config/microblaze/microblaze.c | 29 ++++++++++++++++++++---- + gcc/config/microblaze/microblaze.h | 15 ++++++++++++ + gcc/config/microblaze/microblaze.md | 11 +++++++++ + 5 files changed, 52 insertions(+), 7 deletions(-) + +diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c +index 5835acc..85e6a53 100644 +--- a/gcc/common/config/microblaze/microblaze-common.c ++++ b/gcc/common/config/microblaze/microblaze-common.c +@@ -39,7 +39,4 @@ static const struct default_options microblaze_option_optimization_table[] = + #undef TARGET_OPTION_OPTIMIZATION_TABLE + #define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table + +-#undef TARGET_EXCEPT_UNWIND_INFO +-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info +- + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h +index c30ec72..260f4e4 100644 +--- a/gcc/config/microblaze/microblaze-protos.h ++++ b/gcc/config/microblaze/microblaze-protos.h +@@ -56,6 +56,7 @@ extern bool microblaze_tls_referenced_p (rtx); + extern int symbol_mentioned_p (rtx); + extern int label_mentioned_p (rtx); + extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx); ++extern void microblaze_eh_return (rtx op0); + #endif /* RTX_CODE */ + + /* Declare functions in microblaze-c.c. */ +diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c +index fe61fce..15166d3 100644 +--- a/gcc/config/microblaze/microblaze.c ++++ b/gcc/config/microblaze/microblaze.c +@@ -1999,6 +1999,11 @@ microblaze_must_save_register (int regno) + if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM)) + return 1; + ++ if (crtl->calls_eh_return ++ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) { ++ return 1; ++ } ++ + if (!crtl->is_leaf) + { + if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) +@@ -2026,6 +2031,13 @@ microblaze_must_save_register (int regno) + return 1; + } + ++ if (crtl->calls_eh_return ++ && (regno == EH_RETURN_DATA_REGNO (0) ++ || regno == EH_RETURN_DATA_REGNO (1))) ++ { ++ return 1; ++ } ++ + return 0; + } + +@@ -3131,6 +3143,12 @@ microblaze_expand_epilogue (void) + emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx)); + } + ++ if (crtl->calls_eh_return) ++ emit_insn (gen_addsi3 (stack_pointer_rtx, ++ stack_pointer_rtx, ++ gen_rtx_raw_REG (SImode, ++ MB_EH_STACKADJ_REGNUM))); ++ + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST + + MB_ABI_SUB_RETURN_ADDR_REGNUM))); + } +@@ -3427,10 +3445,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED) + if (count != 0) + return NULL_RTX; + +- return gen_rtx_PLUS (Pmode, +- get_hard_reg_initial_val (Pmode, +- MB_ABI_SUB_RETURN_ADDR_REGNUM), +- GEN_INT (8)); ++ return get_hard_reg_initial_val (Pmode, ++ MB_ABI_SUB_RETURN_ADDR_REGNUM); ++} ++ ++void microblaze_eh_return (rtx op0) ++{ ++ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0)); + } + + /* Queue an .ident string in the queue of top-level asm statements. +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 4072283..5e9f49c 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe; + #define INCOMING_RETURN_ADDR_RTX \ + gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM) + ++/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */ ++#define RETURN_ADDR_OFFSET (8) ++ ++/* Describe how we implement __builtin_eh_return. */ ++#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM) ++ ++#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM ++#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM) ++ ++/* Select a format to encode pointers in exception handling data. CODE ++ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is ++ true if the symbol may be affected by dynamic relocations. */ ++#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ ++ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr) ++ + /* Use DWARF 2 debugging information by default. */ + #define DWARF2_DEBUGGING_INFO + #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index ed6131a..dc2405f 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2327,4 +2327,15 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++; This is used in compiling the unwind routines. ++(define_expand "eh_return" ++ [(use (match_operand 0 "general_operand" ""))] ++ "" ++ " ++{ ++ microblaze_eh_return(operands[0]); ++ DONE; ++}") ++ + (include "sync.md") ++ +-- +1.8.3.2 + diff --git a/package/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch b/package/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch new file mode 100644 index 0000000000..d103af1a20 --- /dev/null +++ b/package/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch @@ -0,0 +1,255 @@ +Allow C99-depending features of libstdc++ with uClibc + +The libstdc++ code is fairly restrictive on how it checks for C99 +compatibility: it requires *complete* C99 support to enable certain +features. For example, uClibc provides a good number of C99 features, +but not C99 complex number support. For this reason, libstdc++ +completely disables many the standard C++ methods that can in fact +work because uClibc provides the necessary functions. + +This patch is similar and highly inspired from +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in +a way that doesn't involve changing the configure.ac script, as +autoreconfiguring gcc is complicated. It simply relies on the fact +that uClibc defines the __UCLIBC__ definition. + +Signed-off-by: Thomas Petazzoni +[Gustavo: update for 4.9.3] + +diff -Nura gcc-4.9.3.orig/libstdc++-v3/config/locale/generic/c_locale.h gcc-4.9.3/libstdc++-v3/config/locale/generic/c_locale.h +--- gcc-4.9.3.orig/libstdc++-v3/config/locale/generic/c_locale.h 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/config/locale/generic/c_locale.h 2015-06-27 06:46:04.420022179 -0300 +@@ -70,7 +70,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +diff -Nura gcc-4.9.3.orig/libstdc++-v3/config/locale/gnu/c_locale.h gcc-4.9.3/libstdc++-v3/config/locale/gnu/c_locale.h +--- gcc-4.9.3.orig/libstdc++-v3/config/locale/gnu/c_locale.h 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/config/locale/gnu/c_locale.h 2015-06-27 06:46:04.465023743 -0300 +@@ -88,7 +88,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/basic_string.h gcc-4.9.3/libstdc++-v3/include/bits/basic_string.h +--- gcc-4.9.3.orig/libstdc++-v3/include/bits/basic_string.h 2015-05-28 13:27:46.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/bits/basic_string.h 2015-06-27 06:49:04.741284648 -0300 +@@ -2844,7 +2844,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) ++#if __cplusplus >= 201103L && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)) + + #include + +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets_nonio.tcc gcc-4.9.3/libstdc++-v3/include/bits/locale_facets_nonio.tcc +--- gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets_nonio.tcc 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/bits/locale_facets_nonio.tcc 2015-06-27 06:46:04.466023777 -0300 +@@ -572,7 +572,7 @@ + { + const locale __loc = __io.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough. + int __cs_size = 64; + char* __cs = static_cast(__builtin_alloca(__cs_size)); +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets.tcc gcc-4.9.3/libstdc++-v3/include/bits/locale_facets.tcc +--- gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets.tcc 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/bits/locale_facets.tcc 2015-06-27 06:46:04.466023777 -0300 +@@ -987,7 +987,7 @@ + char __fbuf[16]; + __num_base::_S_format_float(__io, __fbuf, __mod); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough (most probably sufficient + // for non-ios_base::fixed outputs) + int __cs_size = __max_digits * 3; +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/math.h gcc-4.9.3/libstdc++-v3/include/c_compatibility/math.h +--- gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/math.h 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_compatibility/math.h 2015-06-27 06:46:04.466023777 -0300 +@@ -56,7 +56,7 @@ + using std::floor; + using std::fmod; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::fpclassify; + using std::isfinite; + using std::isinf; +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.9.3/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/wchar.h 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_compatibility/wchar.h 2015-06-27 06:46:04.466023777 -0300 +@@ -103,7 +103,7 @@ + using std::wmemset; + using std::wcsftime; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdio gcc-4.9.3/libstdc++-v3/include/c_global/cstdio +--- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdio 2014-01-23 18:17:15.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_global/cstdio 2015-06-27 06:46:04.481024298 -0300 +@@ -146,7 +146,7 @@ + using ::vsprintf; + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdlib gcc-4.9.3/libstdc++-v3/include/c_global/cstdlib +--- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdlib 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_global/cstdlib 2015-06-27 06:46:04.466023777 -0300 +@@ -182,7 +182,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cwchar gcc-4.9.3/libstdc++-v3/include/c_global/cwchar +--- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cwchar 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_global/cwchar 2015-06-27 06:46:04.466023777 -0300 +@@ -232,7 +232,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +@@ -289,7 +289,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdio gcc-4.9.3/libstdc++-v3/include/c_std/cstdio +--- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdio 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_std/cstdio 2015-06-27 06:46:04.480024263 -0300 +@@ -144,7 +144,7 @@ + using ::vsprintf; + } // namespace std + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdlib gcc-4.9.3/libstdc++-v3/include/c_std/cstdlib +--- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdlib 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_std/cstdlib 2015-06-27 06:46:04.480024263 -0300 +@@ -180,7 +180,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cwchar gcc-4.9.3/libstdc++-v3/include/c_std/cwchar +--- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cwchar 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/c_std/cwchar 2015-06-27 06:46:04.480024263 -0300 +@@ -228,7 +228,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/ext/vstring.h gcc-4.9.3/libstdc++-v3/include/ext/vstring.h +--- gcc-4.9.3.orig/libstdc++-v3/include/ext/vstring.h 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/ext/vstring.h 2015-06-27 06:46:04.480024263 -0300 +@@ -2680,7 +2680,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99)) ++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))) + + #include + +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdio gcc-4.9.3/libstdc++-v3/include/tr1/cstdio +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdio 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/tr1/cstdio 2015-06-27 06:46:04.480024263 -0300 +@@ -33,7 +33,7 @@ + + #include + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdlib gcc-4.9.3/libstdc++-v3/include/tr1/cstdlib +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdlib 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/tr1/cstdlib 2015-06-27 06:46:04.480024263 -0300 +@@ -35,7 +35,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cwchar gcc-4.9.3/libstdc++-v3/include/tr1/cwchar +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cwchar 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/tr1/cwchar 2015-06-27 06:46:04.480024263 -0300 +@@ -52,7 +52,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/stdlib.h gcc-4.9.3/libstdc++-v3/include/tr1/stdlib.h +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/stdlib.h 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/include/tr1/stdlib.h 2015-06-27 06:46:04.481024298 -0300 +@@ -33,7 +33,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + using std::tr1::atoll; + using std::tr1::strtoll; +diff -Nura gcc-4.9.3.orig/libstdc++-v3/src/c++11/debug.cc gcc-4.9.3/libstdc++-v3/src/c++11/debug.cc +--- gcc-4.9.3.orig/libstdc++-v3/src/c++11/debug.cc 2014-01-02 19:30:10.000000000 -0300 ++++ gcc-4.9.3/libstdc++-v3/src/c++11/debug.cc 2015-06-27 06:46:04.481024298 -0300 +@@ -788,7 +788,7 @@ + int __n __attribute__ ((__unused__)), + const char* __fmt, _Tp __s) const throw () + { +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + std::snprintf(__buf, __n, __fmt, __s); + #else + std::sprintf(__buf, __fmt, __s); diff --git a/package/gcc/4.9.3/860-cilk-wchar.patch b/package/gcc/4.9.3/860-cilk-wchar.patch new file mode 100644 index 0000000000..1837405151 --- /dev/null +++ b/package/gcc/4.9.3/860-cilk-wchar.patch @@ -0,0 +1,56 @@ +[PATCH] cilk: fix build without wchar + +When building against uClibc with wchar support disabled, WCHAR_MIN and +WCHAR_MAX are not defined leading to compilation errors. + +Fix it by only including the wchar code if available. + +Signed-off-by: Peter Korsgaard +--- + libcilkrts/include/cilk/reducer_min_max.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Index: host-gcc-final-4.9.2/libcilkrts/include/cilk/reducer_min_max.h +=================================================================== +--- host-gcc-final-4.9.2.orig/libcilkrts/include/cilk/reducer_min_max.h ++++ host-gcc-final-4.9.2/libcilkrts/include/cilk/reducer_min_max.h +@@ -3154,7 +3154,9 @@ + CILK_C_REDUCER_MAX_INSTANCE(char, char, CHAR_MIN) + CILK_C_REDUCER_MAX_INSTANCE(unsigned char, uchar, 0) + CILK_C_REDUCER_MAX_INSTANCE(signed char, schar, SCHAR_MIN) ++#ifdef WCHAR_MIN + CILK_C_REDUCER_MAX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN) ++#endif + CILK_C_REDUCER_MAX_INSTANCE(short, short, SHRT_MIN) + CILK_C_REDUCER_MAX_INSTANCE(unsigned short, ushort, 0) + CILK_C_REDUCER_MAX_INSTANCE(int, int, INT_MIN) +@@ -3306,7 +3308,9 @@ + CILK_C_REDUCER_MAX_INDEX_INSTANCE(char, char, CHAR_MIN) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned char, uchar, 0) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(signed char, schar, SCHAR_MIN) ++#ifdef WCHAR_MIN + CILK_C_REDUCER_MAX_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN) ++#endif + CILK_C_REDUCER_MAX_INDEX_INSTANCE(short, short, SHRT_MIN) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned short, ushort, 0) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(int, int, INT_MIN) +@@ -3432,7 +3436,9 @@ + CILK_C_REDUCER_MIN_INSTANCE(char, char, CHAR_MAX) + CILK_C_REDUCER_MIN_INSTANCE(unsigned char, uchar, CHAR_MAX) + CILK_C_REDUCER_MIN_INSTANCE(signed char, schar, SCHAR_MAX) ++#ifdef WCHAR_MAX + CILK_C_REDUCER_MIN_INSTANCE(wchar_t, wchar_t, WCHAR_MAX) ++#endif + CILK_C_REDUCER_MIN_INSTANCE(short, short, SHRT_MAX) + CILK_C_REDUCER_MIN_INSTANCE(unsigned short, ushort, USHRT_MAX) + CILK_C_REDUCER_MIN_INSTANCE(int, int, INT_MAX) +@@ -3584,7 +3590,9 @@ + CILK_C_REDUCER_MIN_INDEX_INSTANCE(char, char, CHAR_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned char, uchar, CHAR_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(signed char, schar, SCHAR_MAX) ++#ifdef WCHAR_MAX + CILK_C_REDUCER_MIN_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MAX) ++#endif + CILK_C_REDUCER_MIN_INDEX_INSTANCE(short, short, SHRT_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned short, ushort, USHRT_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(int, int, INT_MAX) diff --git a/package/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch b/package/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch new file mode 100644 index 0000000000..aa1376c44c --- /dev/null +++ b/package/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch @@ -0,0 +1,290 @@ +From 6d852ffb43b111a39162135c95249e749c4e285b Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 6 Aug 2015 01:16:02 +0300 +Subject: [PATCH] xtensa: add -mauto-litpools option + +With support from assembler this option allows compiling huge functions, +where single literal pool at the beginning of a function may not be +reachable by L32R instructions at its end. + +Currently assembler --auto-litpools option cannot deal with literals +used from multiple locations separated by more than 256 KBytes of code. +Don't turn constants into literals, instead use MOVI instruction to load +them into registers and let the assembler turn them into literals as +necessary. + +2015-08-12 Max Filippov +gcc/ + * config/xtensa/constraints.md (define_constraint "Y"): New + constraint. + * config/xtensa/elf.h (ASM_SPEC): Add m(no-)auto-litpools. + * config/xtensa/linux.h (ASM_SPEC): Likewise. + * config/xtensa/predicates.md (move_operand): Match constants + and symbols in the presence of TARGET_AUTO_LITPOOLS. + * config/xtensa/xtensa.c (xtensa_valid_move): Don't allow + immediate references to TLS data. + (xtensa_emit_move_sequence): Don't force constants to memory in + the presence of TARGET_AUTO_LITPOOLS. + (print_operand): Add 'y' format, same as default, but capable of + printing SF mode constants as well. + * config/xtensa/xtensa.md (movsi_internal, movhi_internal) + (movsf_internal): Add movi pattern that loads literal. + (movsf, movdf): Don't force constants to memory in the presence + of TARGET_AUTO_LITPOOLS. + (movdf_internal): Add 'Y' constraint. + * config/xtensa/xtensa.opt (mauto-litpools): New option. + +Signed-off-by: Max Filippov +--- +Backported from: r226828 +Changes to ChangeLogs and documentation are dropped. + + gcc/config/xtensa/constraints.md | 5 +++++ + gcc/config/xtensa/elf.h | 4 +++- + gcc/config/xtensa/linux.h | 4 +++- + gcc/config/xtensa/predicates.md | 3 ++- + gcc/config/xtensa/xtensa.c | 19 ++++++++++++++++++- + gcc/config/xtensa/xtensa.md | 35 +++++++++++++++++++---------------- + gcc/config/xtensa/xtensa.opt | 4 ++++ + 7 files changed, 54 insertions(+), 20 deletions(-) + +diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md +index 30f4c1f..773d4f9 100644 +--- a/gcc/config/xtensa/constraints.md ++++ b/gcc/config/xtensa/constraints.md +@@ -111,6 +111,11 @@ + (and (match_code "const_int") + (match_test "xtensa_mask_immediate (ival)"))) + ++(define_constraint "Y" ++ "A constant that can be used in relaxed MOVI instructions." ++ (and (match_code "const_int,const_double,const,symbol_ref,label_ref") ++ (match_test "TARGET_AUTO_LITPOOLS"))) ++ + ;; Memory constraints. Do not use define_memory_constraint here. Doing so + ;; causes reload to force some constants into the constant pool, but since + ;; the Xtensa constant pool can only be accessed with L32R instructions, it +diff --git a/gcc/config/xtensa/elf.h b/gcc/config/xtensa/elf.h +index e59bede..12056f7 100644 +--- a/gcc/config/xtensa/elf.h ++++ b/gcc/config/xtensa/elf.h +@@ -48,7 +48,9 @@ along with GCC; see the file COPYING3. If not see + %{mtarget-align:--target-align} \ + %{mno-target-align:--no-target-align} \ + %{mlongcalls:--longcalls} \ +- %{mno-longcalls:--no-longcalls}" ++ %{mno-longcalls:--no-longcalls} \ ++ %{mauto-litpools:--auto-litpools} \ ++ %{mno-auto-litpools:--no-auto-litpools}" + + #undef LIB_SPEC + #define LIB_SPEC "-lc -lsim -lc -lhandlers-sim -lhal" +diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h +index 675aacf..5b0243a 100644 +--- a/gcc/config/xtensa/linux.h ++++ b/gcc/config/xtensa/linux.h +@@ -42,7 +42,9 @@ along with GCC; see the file COPYING3. If not see + %{mtarget-align:--target-align} \ + %{mno-target-align:--no-target-align} \ + %{mlongcalls:--longcalls} \ +- %{mno-longcalls:--no-longcalls}" ++ %{mno-longcalls:--no-longcalls} \ ++ %{mauto-litpools:--auto-litpools} \ ++ %{mno-auto-litpools:--no-auto-litpools}" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + +diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md +index e02209e..d7dfa11 100644 +--- a/gcc/config/xtensa/predicates.md ++++ b/gcc/config/xtensa/predicates.md +@@ -142,7 +142,8 @@ + (match_test "GET_MODE_CLASS (mode) == MODE_INT + && xtensa_simm12b (INTVAL (op))")) + (and (match_code "const_int,const_double,const,symbol_ref,label_ref") +- (match_test "TARGET_CONST16 && CONSTANT_P (op) ++ (match_test "(TARGET_CONST16 || TARGET_AUTO_LITPOOLS) ++ && CONSTANT_P (op) + && GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0"))))) + + ;; Accept the floating point constant 1 in the appropriate mode. +diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c +index eb039ba..206ff80 100644 +--- a/gcc/config/xtensa/xtensa.c ++++ b/gcc/config/xtensa/xtensa.c +@@ -501,6 +501,9 @@ xtensa_valid_move (machine_mode mode, rtx *operands) + { + int dst_regnum = xt_true_regnum (operands[0]); + ++ if (xtensa_tls_referenced_p (operands[1])) ++ return FALSE; ++ + /* The stack pointer can only be assigned with a MOVSP opcode. */ + if (dst_regnum == STACK_POINTER_REGNUM) + return !TARGET_WINDOWED_ABI +@@ -1069,7 +1072,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode) + return 1; + } + +- if (! TARGET_CONST16) ++ if (! TARGET_AUTO_LITPOOLS && ! TARGET_CONST16) + { + src = force_const_mem (SImode, src); + operands[1] = src; +@@ -2449,6 +2452,20 @@ print_operand (FILE *file, rtx x, int letter) + } + break; + ++ case 'y': ++ if (GET_CODE (x) == CONST_DOUBLE && ++ GET_MODE (x) == SFmode) ++ { ++ REAL_VALUE_TYPE r; ++ long l; ++ REAL_VALUE_FROM_CONST_DOUBLE (r, x); ++ REAL_VALUE_TO_TARGET_SINGLE (r, l); ++ fprintf (file, "0x%08lx", l); ++ break; ++ } ++ ++ /* fall through */ ++ + default: + if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG) + fprintf (file, "%s", reg_names[xt_true_regnum (x)]); +diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md +index 6d84384..0e673a3 100644 +--- a/gcc/config/xtensa/xtensa.md ++++ b/gcc/config/xtensa/xtensa.md +@@ -761,8 +761,8 @@ + }) + + (define_insn "movsi_internal" +- [(set (match_operand:SI 0 "nonimmed_operand" "=D,D,D,D,R,R,a,q,a,W,a,a,U,*a,*A") +- (match_operand:SI 1 "move_operand" "M,D,d,R,D,d,r,r,I,i,T,U,r,*A,*r"))] ++ [(set (match_operand:SI 0 "nonimmed_operand" "=D,D,D,D,R,R,a,q,a,a,W,a,a,U,*a,*A") ++ (match_operand:SI 1 "move_operand" "M,D,d,R,D,d,r,r,I,Y,i,T,U,r,*A,*r"))] + "xtensa_valid_move (SImode, operands)" + "@ + movi.n\t%0, %x1 +@@ -774,15 +774,16 @@ + mov\t%0, %1 + movsp\t%0, %1 + movi\t%0, %x1 ++ movi\t%0, %1 + const16\t%0, %t1\;const16\t%0, %b1 + %v1l32r\t%0, %1 + %v1l32i\t%0, %1 + %v0s32i\t%1, %0 + rsr\t%0, ACCLO + wsr\t%1, ACCLO" +- [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,load,load,store,rsr,wsr") ++ [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr") + (set_attr "mode" "SI") +- (set_attr "length" "2,2,2,2,2,2,3,3,3,6,3,3,3,3,3")]) ++ (set_attr "length" "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")]) + + ;; 16-bit Integer moves + +@@ -796,21 +797,22 @@ + }) + + (define_insn "movhi_internal" +- [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,U,*a,*A") +- (match_operand:HI 1 "move_operand" "M,d,r,I,U,r,*A,*r"))] ++ [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,U,*a,*A") ++ (match_operand:HI 1 "move_operand" "M,d,r,I,Y,U,r,*A,*r"))] + "xtensa_valid_move (HImode, operands)" + "@ + movi.n\t%0, %x1 + mov.n\t%0, %1 + mov\t%0, %1 + movi\t%0, %x1 ++ movi\t%0, %1 + %v1l16ui\t%0, %1 + %v0s16i\t%1, %0 + rsr\t%0, ACCLO + wsr\t%1, ACCLO" +- [(set_attr "type" "move,move,move,move,load,store,rsr,wsr") ++ [(set_attr "type" "move,move,move,move,move,load,store,rsr,wsr") + (set_attr "mode" "HI") +- (set_attr "length" "2,2,3,3,3,3,3,3")]) ++ (set_attr "length" "2,2,3,3,3,3,3,3,3")]) + + ;; 8-bit Integer moves + +@@ -881,7 +883,7 @@ + (match_operand:SF 1 "general_operand" ""))] + "" + { +- if (!TARGET_CONST16 && CONSTANT_P (operands[1])) ++ if (!TARGET_CONST16 && !TARGET_AUTO_LITPOOLS && CONSTANT_P (operands[1])) + operands[1] = force_const_mem (SFmode, operands[1]); + + if ((!register_operand (operands[0], SFmode) +@@ -896,8 +898,8 @@ + }) + + (define_insn "movsf_internal" +- [(set (match_operand:SF 0 "nonimmed_operand" "=f,f,U,D,D,R,a,f,a,W,a,a,U") +- (match_operand:SF 1 "move_operand" "f,U,f,d,R,d,r,r,f,iF,T,U,r"))] ++ [(set (match_operand:SF 0 "nonimmed_operand" "=f,f,U,D,D,R,a,f,a,a,W,a,a,U") ++ (match_operand:SF 1 "move_operand" "f,U,f,d,R,d,r,r,f,Y,iF,T,U,r"))] + "((register_operand (operands[0], SFmode) + || register_operand (operands[1], SFmode)) + && !(FP_REG_P (xt_true_regnum (operands[0])) +@@ -912,13 +914,14 @@ + mov\t%0, %1 + wfr\t%0, %1 + rfr\t%0, %1 ++ movi\t%0, %y1 + const16\t%0, %t1\;const16\t%0, %b1 + %v1l32r\t%0, %1 + %v1l32i\t%0, %1 + %v0s32i\t%1, %0" +- [(set_attr "type" "farith,fload,fstore,move,load,store,move,farith,farith,move,load,load,store") ++ [(set_attr "type" "farith,fload,fstore,move,load,store,move,farith,farith,move,move,load,load,store") + (set_attr "mode" "SF") +- (set_attr "length" "3,3,3,2,2,2,3,3,3,6,3,3,3")]) ++ (set_attr "length" "3,3,3,2,2,2,3,3,3,3,6,3,3,3")]) + + (define_insn "*lsiu" + [(set (match_operand:SF 0 "register_operand" "=f") +@@ -991,7 +994,7 @@ + (match_operand:DF 1 "general_operand" ""))] + "" + { +- if (CONSTANT_P (operands[1]) && !TARGET_CONST16) ++ if (CONSTANT_P (operands[1]) && !TARGET_CONST16 && !TARGET_AUTO_LITPOOLS) + operands[1] = force_const_mem (DFmode, operands[1]); + + if (!register_operand (operands[0], DFmode) +@@ -1002,8 +1005,8 @@ + }) + + (define_insn_and_split "movdf_internal" +- [(set (match_operand:DF 0 "nonimmed_operand" "=a,W,a,a,U") +- (match_operand:DF 1 "move_operand" "r,iF,T,U,r"))] ++ [(set (match_operand:DF 0 "nonimmed_operand" "=a,a,W,a,a,U") ++ (match_operand:DF 1 "move_operand" "r,Y,iF,T,U,r"))] + "register_operand (operands[0], DFmode) + || register_operand (operands[1], DFmode)" + "#" +diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt +index 2fd6cee..21c6e96 100644 +--- a/gcc/config/xtensa/xtensa.opt ++++ b/gcc/config/xtensa/xtensa.opt +@@ -38,6 +38,10 @@ mtext-section-literals + Target + Intersperse literal pools with code in the text section + ++mauto-litpools ++Target Report Mask(AUTO_LITPOOLS) ++Relax literals in assembler and place them automatically in the text section ++ + mserialize-volatile + Target Report Mask(SERIALIZE_VOLATILE) + -mno-serialize-volatile Do not serialize volatile memory references with MEMW instructions +-- +1.8.1.4 + diff --git a/package/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch b/package/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch new file mode 100644 index 0000000000..abc7a08e8d --- /dev/null +++ b/package/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch @@ -0,0 +1,76 @@ +From 05154174b369505238b759cf80d595d8cfc8c731 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Mon, 10 Aug 2015 21:35:20 +0300 +Subject: [PATCH 1/3] xtensa: reimplement register spilling + +Spilling windowed registers in userspace is much easier, more portable, +less error-prone and equally effective as in kernel. Now that register +spilling syscall is considered obsolete in the xtensa linux kernel +replace it with CALL12 followed by series of ENTRY in libgcc. + +2015-08-18 Max Filippov +libgcc/ + * config/xtensa/lib2funcs.S (__xtensa_libgcc_window_spill): Use + CALL12 followed by series of ENTRY to spill windowed registers. + (__xtensa_nonlocal_goto): Call __xtensa_libgcc_window_spill + instead of making linux spill syscall. + +Signed-off-by: Max Filippov +--- +Backported from: r226962 + + libgcc/config/xtensa/lib2funcs.S | 30 +++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S +index 3ac8c1d..2e678af 100644 +--- a/libgcc/config/xtensa/lib2funcs.S ++++ b/libgcc/config/xtensa/lib2funcs.S +@@ -33,10 +33,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + .global __xtensa_libgcc_window_spill + .type __xtensa_libgcc_window_spill,@function + __xtensa_libgcc_window_spill: +- entry sp, 32 +- movi a2, 0 +- syscall ++ entry sp, 48 ++#if XCHAL_NUM_AREGS > 16 ++ call12 1f ++ retw ++ .align 4 ++1: ++ .rept (XCHAL_NUM_AREGS - 24) / 12 ++ _entry sp, 48 ++ mov a12, a0 ++ .endr ++ _entry sp, 16 ++#if XCHAL_NUM_AREGS % 12 == 0 ++ mov a4, a4 ++#elif XCHAL_NUM_AREGS % 12 == 4 ++ mov a8, a8 ++#elif XCHAL_NUM_AREGS % 12 == 8 ++ mov a12, a12 ++#endif ++ retw ++#else ++ mov a8, a8 + retw ++#endif + .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill + + +@@ -58,10 +77,7 @@ __xtensa_nonlocal_goto: + entry sp, 32 + + /* Flush registers. */ +- mov a5, a2 +- movi a2, 0 +- syscall +- mov a2, a5 ++ call8 __xtensa_libgcc_window_spill + + /* Because the save area for a0-a3 is stored one frame below + the one identified by a2, the only way to restore those +-- +1.8.1.4 + diff --git a/package/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch b/package/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch new file mode 100644 index 0000000000..f23a5c0737 --- /dev/null +++ b/package/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch @@ -0,0 +1,33 @@ +From f66206679a0ad604f13673559f230160cd3d1189 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 14 Aug 2015 02:45:02 +0300 +Subject: [PATCH 2/3] xtensa: use unwind-dw2-fde-dip instead of unwind-dw2-fde + +This allows having exception cleanup code in binaries that don't +register their unwind tables. + +2015-08-18 Max Filippov +libgcc/ + * config/xtensa/t-xtensa (LIB2ADDEH): Replace unwind-dw2-fde + with unwind-dw2-fde-dip. + +Signed-off-by: Max Filippov +--- +Backported from: r226963 + + libgcc/config/xtensa/t-xtensa | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/config/xtensa/t-xtensa b/libgcc/config/xtensa/t-xtensa +index 27399e6..66d0eb3 100644 +--- a/libgcc/config/xtensa/t-xtensa ++++ b/libgcc/config/xtensa/t-xtensa +@@ -13,4 +13,4 @@ LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 _udivsi3 _umodsi3 \ + LIB2ADD = $(srcdir)/config/xtensa/lib2funcs.S + + LIB2ADDEH = $(srcdir)/config/xtensa/unwind-dw2-xtensa.c \ +- $(srcdir)/unwind-dw2-fde.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c ++ $(srcdir)/unwind-dw2-fde-dip.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c +-- +1.8.1.4 + diff --git a/package/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch b/package/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch new file mode 100644 index 0000000000..dc405132cc --- /dev/null +++ b/package/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch @@ -0,0 +1,40 @@ +From 15c7c4d39b317f0d902ef28fd43eca5c3369f891 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sat, 15 Aug 2015 05:12:11 +0300 +Subject: [PATCH 3/3] xtensa: fix _Unwind_GetCFA + +Returning context->cfa in _Unwind_GetCFA makes CFA point one stack frame +higher than what was actually used by code at context->ra. This results +in invalid CFA value in signal frames and premature unwinding completion +in forced unwinding used by uClibc NPTL thread cancellation. +Returning context->sp from _Unwind_GetCFA makes all CFA values valid and +matching code that used them. + +2015-08-18 Max Filippov +libgcc/ + * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return + context->sp instead of context->cfa. + +Signed-off-by: Max Filippov +--- +Backported from: r226964 + + libgcc/config/xtensa/unwind-dw2-xtensa.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c +index 35f7797..ef6b900 100644 +--- a/libgcc/config/xtensa/unwind-dw2-xtensa.c ++++ b/libgcc/config/xtensa/unwind-dw2-xtensa.c +@@ -130,7 +130,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index) + _Unwind_Word + _Unwind_GetCFA (struct _Unwind_Context *context) + { +- return (_Unwind_Ptr) context->cfa; ++ return (_Unwind_Ptr) context->sp; + } + + /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ +-- +1.8.1.4 + diff --git a/package/gcc/4.9.3/874-xtensa-add-uclinux-support.patch b/package/gcc/4.9.3/874-xtensa-add-uclinux-support.patch new file mode 100644 index 0000000000..23db3d863c --- /dev/null +++ b/package/gcc/4.9.3/874-xtensa-add-uclinux-support.patch @@ -0,0 +1,174 @@ +From 70c2cb98fb129b4766b5da0f945dc41fd568c77a Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sat, 22 Aug 2015 08:44:26 +0300 +Subject: [PATCH] xtensa: add uclinux support + +2015-10-03 Max Filippov +gcc/ + * config.gcc (xtensa*-*-uclinux*): New configuration. + * config/xtensa/uclinux.h: New file. + * config/xtensa/uclinux.opt: New file. + +libgcc/ + * config.host (xtensa*-*-uclinux*): New configuration. + +Signed-off-by: Max Filippov +--- +Backported from: r228450 + + gcc/config.gcc | 5 ++++ + gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++ + gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++ + libgcc/config.host | 5 ++++ + 4 files changed, 111 insertions(+) + create mode 100644 gcc/config/xtensa/uclinux.h + create mode 100644 gcc/config/xtensa/uclinux.opt + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index c52f5a8..56797bd 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2995,6 +2995,11 @@ xtensa*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h" + tmake_file="${tmake_file} xtensa/t-xtensa" + ;; ++xtensa*-*-uclinux*) ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h" ++ tmake_file="${tmake_file} xtensa/t-xtensa" ++ extra_options="${extra_options} xtensa/uclinux.opt" ++ ;; + am33_2.0-*-linux*) + tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h" + gas=yes gnu_ld=yes +diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h +new file mode 100644 +index 0000000..4606020 +--- /dev/null ++++ b/gcc/config/xtensa/uclinux.h +@@ -0,0 +1,69 @@ ++/* Xtensa uClinux configuration. ++ Derived from the configuration for GCC for Intel i386 running Linux. ++ Copyright (C) 2001-2015 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify it under ++the terms of the GNU General Public License as published by the Free ++Software Foundation; either version 3, or (at your option) any later ++version. ++ ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++WARRANTY; without even the implied warranty of MERCHANTABILITY or ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ GNU_USER_TARGET_OS_CPP_BUILTINS (); \ ++ builtin_define ("__uClinux__"); \ ++ } \ ++ while (0) ++ ++#undef SUBTARGET_CPP_SPEC ++#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" ++ ++#undef SIZE_TYPE ++#define SIZE_TYPE "unsigned int" ++ ++#undef PTRDIFF_TYPE ++#define PTRDIFF_TYPE "int" ++ ++#undef WCHAR_TYPE ++#define WCHAR_TYPE "long int" ++ ++#undef WCHAR_TYPE_SIZE ++#define WCHAR_TYPE_SIZE 32 ++ ++#undef ASM_SPEC ++#define ASM_SPEC \ ++ "%{mtext-section-literals:--text-section-literals} \ ++ %{mno-text-section-literals:--no-text-section-literals} \ ++ %{mtarget-align:--target-align} \ ++ %{mno-target-align:--no-target-align} \ ++ %{mlongcalls:--longcalls} \ ++ %{mno-longcalls:--no-longcalls} \ ++ %{mauto-litpools:--auto-litpools} \ ++ %{mno-auto-litpools:--no-auto-litpools}" ++ ++#undef LINK_SPEC ++#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}" ++ ++#undef LOCAL_LABEL_PREFIX ++#define LOCAL_LABEL_PREFIX "." ++ ++/* Always enable "-fpic" for Xtensa Linux. */ ++#define XTENSA_ALWAYS_PIC 1 ++ ++#undef TARGET_LIBC_HAS_FUNCTION ++#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function ++ ++#undef DBX_REGISTER_NUMBER ++ +diff --git a/gcc/config/xtensa/uclinux.opt b/gcc/config/xtensa/uclinux.opt +new file mode 100644 +index 0000000..95ef777 +--- /dev/null ++++ b/gcc/config/xtensa/uclinux.opt +@@ -0,0 +1,32 @@ ++; Xtensa uClinux options. ++ ++; Copyright (C) 2015 Free Software Foundation, Inc. ++; ++; This file is part of GCC. ++; ++; GCC is free software; you can redistribute it and/or modify it under ++; the terms of the GNU General Public License as published by the Free ++; Software Foundation; either version 3, or (at your option) any later ++; version. ++; ++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++; WARRANTY; without even the implied warranty of MERCHANTABILITY or ++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++; for more details. ++; ++; You should have received a copy of the GNU General Public License ++; along with GCC; see the file COPYING3. If not see ++; . ++ ++; See the GCC internals manual (options.texi) for a description of ++; this file's format. ++ ++; Please try to keep this file in ASCII collating order. ++ ++elf2flt ++Driver ++ ++elf2flt= ++Driver JoinedOrMissing ++ ++; This comment is to ensure we retain the blank line above. +diff --git a/libgcc/config.host b/libgcc/config.host +index 2c64756..2ee92c1 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -1295,6 +1295,11 @@ xtensa*-*-linux*) + tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc" + md_unwind_header=xtensa/linux-unwind.h + ;; ++xtensa*-*-uclinux*) ++ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc" ++ md_unwind_header=xtensa/linux-unwind.h ++ extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o" ++ ;; + am33_2.0-*-linux*) + # Don't need crtbeginT.o from *-*-linux* default. + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" +-- +1.8.1.4 + diff --git a/package/gcc/4.9.3/880-nios2_legitimize_address.patch b/package/gcc/4.9.3/880-nios2_legitimize_address.patch new file mode 100644 index 0000000000..4623f295a7 --- /dev/null +++ b/package/gcc/4.9.3/880-nios2_legitimize_address.patch @@ -0,0 +1,49 @@ +From b0ea54f3f995754881e0ea6651133aa7b58eeaa2 Mon Sep 17 00:00:00 2001 +From: cltang +Date: Tue, 22 Sep 2015 12:23:20 +0000 +Subject: [PATCH] nios2_legitimize_address 2015-09-22 Chung-Lin Tang + + + Backport from mainline + 2015-09-22 Chung-Lin Tang + + * config/nios2/nios2.c (nios2_legitimize_address): When handling + 'reg + reloc' cases, allow first operand to be non-REG, and use + force_reg() to enforce address pattern. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@228013 138bc75d-0d04-0410-961f-82ee72b054a4 + +Fixes: +http://autobuild.buildroot.net/results/901/90186d1fe134b804c0101554296b1235dc0ccbb0 + +[backported to 4.9.3] +Signed-off-by: Romain Naour +--- + gcc/config/nios2/nios2.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c +index 047b615..41dd6f9 100644 +--- a/gcc/config/nios2/nios2.c ++++ b/gcc/config/nios2/nios2.c +@@ -1786,15 +1786,15 @@ nios2_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, + + Which will be output as '%tls_le(var+48)(r23)' in assembly. */ + if (GET_CODE (x) == PLUS +- && GET_CODE (XEXP (x, 0)) == REG + && GET_CODE (XEXP (x, 1)) == CONST) + { +- rtx unspec, offset, reg = XEXP (x, 0); ++ rtx unspec, offset; + split_const (XEXP (x, 1), &unspec, &offset); + if (GET_CODE (unspec) == UNSPEC + && !nios2_large_offset_p (XINT (unspec, 1)) + && offset != const0_rtx) + { ++ rtx reg = force_reg (Pmode, XEXP (x, 0)); + unspec = copy_rtx (unspec); + XVECEXP (unspec, 0, 0) + = plus_constant (Pmode, XVECEXP (unspec, 0, 0), INTVAL (offset)); +-- +2.5.0 + diff --git a/package/gcc/4.9.3/890-fix-m68k-compile.patch b/package/gcc/4.9.3/890-fix-m68k-compile.patch new file mode 100644 index 0000000000..140977b3cd --- /dev/null +++ b/package/gcc/4.9.3/890-fix-m68k-compile.patch @@ -0,0 +1,15 @@ +remove unused header, which breaks the toolchain building + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c gcc-4.9.3/libgcc/config/m68k/linux-atomic.c +--- gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c 2014-01-02 23:25:22.000000000 +0100 ++++ gcc-4.9.3/libgcc/config/m68k/linux-atomic.c 2016-03-18 22:24:40.000000000 +0100 +@@ -33,7 +33,6 @@ + using the kernel helper defined below. There is no support for + 64-bit operations yet. */ + +-#include + #include + + #ifndef __NR_atomic_cmpxchg_32 diff --git a/package/gcc/4.9.3/891-fix-m68k-uclinux.patch b/package/gcc/4.9.3/891-fix-m68k-uclinux.patch new file mode 100644 index 0000000000..4347642d67 --- /dev/null +++ b/package/gcc/4.9.3/891-fix-m68k-uclinux.patch @@ -0,0 +1,18 @@ +avoids internal compiler error while compiling linux-atomic.c +See here: +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833 + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-4.9.3.orig/libgcc/config.host gcc-4.9.3/libgcc/config.host +--- gcc-4.9.3.orig/libgcc/config.host 2014-03-27 16:40:31.000000000 +0100 ++++ gcc-4.9.3/libgcc/config.host 2016-04-05 16:20:53.422809885 +0200 +@@ -750,7 +750,7 @@ + m68k*-*-openbsd*) + ;; + m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux with uClibc +- tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux" ++ tmake_file="$tmake_file m68k/t-floatlib" + md_unwind_header=m68k/linux-unwind.h + ;; + m68k-*-linux*) # Motorola m68k's running GNU/Linux diff --git a/package/gcc/4.9.3/900-musl-support.patch b/package/gcc/4.9.3/900-musl-support.patch new file mode 100644 index 0000000000..90f64de916 --- /dev/null +++ b/package/gcc/4.9.3/900-musl-support.patch @@ -0,0 +1,640 @@ +Add musl support to gcc + +This patch comes from the musl-cross project at +https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version: + + * the config.sub modifications have been removed, because Buildroot + already overwrites all config.sub with a more recent config.sub + that has musl support. + + * change to ensure that a dummy dynamic linker path + MUSL_DYNAMIC_LINKER is defined for all architectures, + otherwise building gcc for architectures not supported by musl was + causing build failure. Bug reported upstream at + https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on. + + * change the USE_PT_GNU_EH_FRAME logic to keep the existing gcc logic + and only add the musl one as an addition, not as a replacement. Not + doing this breaks C++ exception handling with glibc, because + USE_PT_GNU_EH_FRAME doesn't get defined due to the configure script + not testing dl_iterate_phdr() on any system except Solaris. + +[Gustavo: remove upstream applied gcc/config/sh/sh.c chunk for 4.9.1] +Signed-off-by: Thomas Petazzoni +--- + +Index: b/fixincludes/mkfixinc.sh +=================================================================== +--- a/fixincludes/mkfixinc.sh ++++ b/fixincludes/mkfixinc.sh +@@ -19,7 +19,8 @@ + powerpc-*-eabi* | \ + powerpc-*-rtems* | \ + powerpcle-*-eabisim* | \ +- powerpcle-*-eabi* ) ++ powerpcle-*-eabi* | \ ++ *-musl* ) + # IF there is no include fixing, + # THEN create a no-op fixer and exit + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target} +Index: b/gcc/config.gcc +=================================================================== +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -594,7 +594,7 @@ + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" + + # 32-bit x86 processors supported by --with-arch=. Each processor + # MUST be separated by exactly one space. +@@ -719,6 +719,9 @@ + *-*-*uclibc*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" + ;; ++ *-*-*musl*) ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" ++ ;; + *) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" + ;; +@@ -2322,6 +2325,10 @@ + powerpc*-*-linux*paired*) + tm_file="${tm_file} rs6000/750cl.h" ;; + esac ++ case ${target} in ++ *-linux*-musl*) ++ enable_secureplt=yes ;; ++ esac + if test x${enable_secureplt} = xyes; then + tm_file="rs6000/secureplt.h ${tm_file}" + fi +Index: b/gcc/config/aarch64/aarch64-linux.h +=================================================================== +--- a/gcc/config/aarch64/aarch64-linux.h ++++ b/gcc/config/aarch64/aarch64-linux.h +@@ -22,6 +22,8 @@ + #define GCC_AARCH64_LINUX_H + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1" ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1" + + #define CPP_SPEC "%{pthread:-D_REENTRANT}" + +Index: b/gcc/config/arm/linux-eabi.h +=================================================================== +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -77,6 +77,23 @@ + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" + ++/* For ARM musl currently supports four dynamic linkers: ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB ++ musl does not support the legacy OABI mode. ++ All the dynamic linkers live in /lib. ++ We default to soft-float, EL. */ ++#undef MUSL_DYNAMIC_LINKER ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" ++#endif ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC +Index: b/gcc/config/i386/linux.h +=================================================================== +--- a/gcc/config/i386/linux.h ++++ b/gcc/config/i386/linux.h +@@ -21,3 +21,5 @@ + + #define GNU_USER_LINK_EMULATION "elf_i386" + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" +Index: b/gcc/config/i386/linux64.h +=================================================================== +--- a/gcc/config/i386/linux64.h ++++ b/gcc/config/i386/linux64.h +@@ -30,3 +30,10 @@ + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" ++#undef MUSL_DYNAMIC_LINKERX32 ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" +Index: b/gcc/config/linux.h +=================================================================== +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,10 +32,12 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ +@@ -53,18 +55,21 @@ + uClibc or Bionic is the default C library and whether + -muclibc or -mglibc or -mbionic has been passed to change the default. */ + +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" + + #if DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) + #elif DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) + #elif DEFAULT_LIBC == LIBC_BIONIC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) + #else + #error "Unsupported DEFAULT_LIBC" + #endif /* DEFAULT_LIBC */ +@@ -82,23 +87,103 @@ + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" + ++/* Musl dynamic linker paths must be defined on a per-architecture ++ basis, for each architecture supported by Musl. However, in order ++ to let other architectures continue to build with other C ++ libraries, we provide a dummy definition of the following defines. */ ++#define MUSL_DYNAMIC_LINKER "invalid" ++#define MUSL_DYNAMIC_LINKER32 "invalid" ++#define MUSL_DYNAMIC_LINKER64 "invalid" ++#define MUSL_DYNAMIC_LINKERX32 "invalid" ++ + #define GNU_USER_DYNAMIC_LINKER \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ +- BIONIC_DYNAMIC_LINKER) ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + #define GNU_USER_DYNAMIC_LINKER32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ +- BIONIC_DYNAMIC_LINKER32) ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ +- BIONIC_DYNAMIC_LINKER64) ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + #define GNU_USER_DYNAMIC_LINKERX32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ +- BIONIC_DYNAMIC_LINKERX32) ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKER32) + + /* Whether we have Bionic libc runtime */ + #undef TARGET_HAS_BIONIC + #define TARGET_HAS_BIONIC (OPTION_BIONIC) + ++/* musl avoids problematic includes by rearranging the include directories. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif ++ + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ + /* This is a *uclinux* target. We don't define below macros to normal linux + versions, because doing so would require *uclinux* targets to include +Index: b/gcc/config/linux.opt +=================================================================== +--- a/gcc/config/linux.opt ++++ b/gcc/config/linux.opt +@@ -30,3 +30,7 @@ + muclibc + Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic) + Use uClibc C library ++ ++mmusl ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc) ++Use musl C library +Index: b/gcc/config/microblaze/linux.h +=================================================================== +--- a/gcc/config/microblaze/linux.h ++++ b/gcc/config/microblaze/linux.h +@@ -25,7 +25,23 @@ + #undef TLS_NEEDS_GOT + #define TLS_NEEDS_GOT 1 + +-#define DYNAMIC_LINKER "/lib/ld.so.1" ++#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */ ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}" ++#endif ++ ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" ++ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER ++#else ++#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER ++#endif ++ ++ + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ + { "dynamic_linker", DYNAMIC_LINKER } +Index: b/gcc/config/rs6000/linux64.h +=================================================================== +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -375,17 +375,23 @@ + #endif + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER32 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + + #undef DEFAULT_ASM_ENDIAN + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) +Index: b/gcc/config/rs6000/secureplt.h +=================================================================== +--- a/gcc/config/rs6000/secureplt.h ++++ b/gcc/config/rs6000/secureplt.h +@@ -18,3 +18,4 @@ + . */ + + #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt" ++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt" +Index: b/gcc/config/rs6000/sysv4.h +=================================================================== +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -537,6 +537,9 @@ + #ifndef CC1_SECURE_PLT_DEFAULT_SPEC + #define CC1_SECURE_PLT_DEFAULT_SPEC "" + #endif ++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC ++#define LINK_SECURE_PLT_DEFAULT_SPEC "" ++#endif + + /* Pass -G xxx to the compiler. */ + #define CC1_SPEC "%{G*} %(cc1_cpu)" \ +@@ -585,7 +588,8 @@ + + /* Override the default target of the linker. */ + #define LINK_TARGET_SPEC \ +- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") ++ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \ ++ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}" + + /* Any specific OS flags. */ + #define LINK_OS_SPEC "\ +@@ -763,15 +767,18 @@ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + + #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ +@@ -894,6 +901,7 @@ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ ++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \ + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ +Index: b/gcc/config/sh/linux.h +=================================================================== +--- a/gcc/config/sh/linux.h ++++ b/gcc/config/sh/linux.h +@@ -43,7 +43,15 @@ + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack + ++#if TARGET_BIG_ENDIAN_DEFAULT /* BE */ ++#define MUSL_DYNAMIC_LINKER_E "eb" ++#else ++#define MUSL_DYNAMIC_LINKER_E ++#endif ++ + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1" + + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" +Index: b/gcc/configure +=================================================================== +--- a/gcc/configure ++++ b/gcc/configure +@@ -27449,6 +27453,9 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +Index: b/gcc/configure.ac +=================================================================== +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -5108,6 +5112,9 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +Index: b/gcc/ginclude/stddef.h +=================================================================== +--- a/gcc/ginclude/stddef.h ++++ b/gcc/ginclude/stddef.h +@@ -181,6 +181,7 @@ + #ifndef _GCC_SIZE_T + #ifndef _SIZET_ + #ifndef __size_t ++#ifndef __DEFINED_size_t /* musl */ + #define __size_t__ /* BeOS */ + #define __SIZE_T__ /* Cray Unicos/Mk */ + #define _SIZE_T +@@ -197,6 +198,7 @@ + #define ___int_size_t_h + #define _GCC_SIZE_T + #define _SIZET_ ++#define __DEFINED_size_t /* musl */ + #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ + || defined(__FreeBSD_kernel__) + /* __size_t is a typedef on FreeBSD 5, must not trash it. */ +@@ -214,6 +216,7 @@ + typedef long ssize_t; + #endif /* __BEOS__ */ + #endif /* !(defined (__GNUG__) && defined (size_t)) */ ++#endif /* __DEFINED_size_t */ + #endif /* __size_t */ + #endif /* _SIZET_ */ + #endif /* _GCC_SIZE_T */ +Index: b/libgcc/unwind-dw2-fde-dip.c +=================================================================== +--- a/libgcc/unwind-dw2-fde-dip.c ++++ b/libgcc/unwind-dw2-fde-dip.c +@@ -73,6 +73,13 @@ + && defined(TARGET_DL_ITERATE_PHDR) \ + && defined(__sun__) && defined(__svr4__) + # define USE_PT_GNU_EH_FRAME ++ #endif ++ ++/* For musl libc, TARGET_DL_ITERATE_PHDR gets defined by the configure ++ script. */ ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ ++ && defined(TARGET_DL_ITERATE_PHDR) ++# define USE_PT_GNU_EH_FRAME + #endif + + #if defined(USE_PT_GNU_EH_FRAME) +Index: b/libgomp/config/posix/time.c +=================================================================== +--- a/libgomp/config/posix/time.c ++++ b/libgomp/config/posix/time.c +@@ -28,6 +28,8 @@ + The following implementation uses the most simple POSIX routines. + If present, POSIX 4 clocks should be used instead. */ + ++#define _POSIX_C_SOURCE 199309L /* for clocks */ ++ + #include "libgomp.h" + #include + #if TIME_WITH_SYS_TIME +Index: b/libitm/config/arm/hwcap.cc +=================================================================== +--- a/libitm/config/arm/hwcap.cc ++++ b/libitm/config/arm/hwcap.cc +@@ -40,7 +40,11 @@ + + #ifdef __linux__ + #include ++#ifdef __GLIBC__ + #include ++#else ++#include ++#endif + #include + + static void __attribute__((constructor)) +Index: b/libitm/config/linux/x86/tls.h +=================================================================== +--- a/libitm/config/linux/x86/tls.h ++++ b/libitm/config/linux/x86/tls.h +@@ -25,16 +25,19 @@ + #ifndef LIBITM_X86_TLS_H + #define LIBITM_X86_TLS_H 1 + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + /* Use slots in the TCB head rather than __thread lookups. + GLIBC has reserved words 10 through 13 for TM. */ + #define HAVE_ARCH_GTM_THREAD 1 + #define HAVE_ARCH_GTM_THREAD_DISP 1 + #endif ++#endif + + #include "config/generic/tls.h" + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + namespace GTM HIDDEN { + + #ifdef __x86_64__ +@@ -101,5 +104,6 @@ + + } // namespace GTM + #endif /* >= GLIBC 2.10 */ ++#endif + + #endif // LIBITM_X86_TLS_H +Index: b/libstdc++-v3/configure.host +=================================================================== +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -264,6 +264,13 @@ + os_include_dir="os/bsd/freebsd" + ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) ++ # check for musl by target ++ case "${host_os}" in ++ *-musl*) ++ os_include_dir="os/generic" ++ ;; ++ *) ++ + if [ "$uclibc" = "yes" ]; then + os_include_dir="os/uclibc" + elif [ "$bionic" = "yes" ]; then +@@ -272,6 +279,9 @@ + os_include_dir="os/gnu-linux" + fi + ;; ++ ++ esac ++ ;; + hpux*) + os_include_dir="os/hpux" + ;; +Index: b/gcc/config/mips/linux64.h +=================================================================== +--- a/gcc/config/mips/linux64.h ++++ b/gcc/config/mips/linux64.h +@@ -41,4 +41,4 @@ + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" + #define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ +- BIONIC_DYNAMIC_LINKERN32) ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKER) +Index: b/gcc/config/mips/linux.h +=================================================================== +--- a/gcc/config/mips/linux.h ++++ b/gcc/config/mips/linux.h +@@ -23,3 +23,11 @@ + #undef UCLIBC_DYNAMIC_LINKER + #define UCLIBC_DYNAMIC_LINKER \ + "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}" ++ ++#if TARGET_ENDIAN_DEFAULT == 0 /* LE */ ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}" ++#endif ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" diff --git a/package/gcc/4.9.3/920-libgcc-remove-unistd-header.patch b/package/gcc/4.9.3/920-libgcc-remove-unistd-header.patch new file mode 100644 index 0000000000..df5372bb5a --- /dev/null +++ b/package/gcc/4.9.3/920-libgcc-remove-unistd-header.patch @@ -0,0 +1,12 @@ +Upstream status: In progress + +--- a/libgcc/config/nios2/linux-atomic.c ++++ b/libgcc/config/nios2/linux-atomic.c +@@ -20,7 +20,6 @@ + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +-#include + #define EFAULT 14 + #define EBUSY 16 + #define ENOSYS 38 diff --git a/package/gcc/4.9.3/930-libgcc-disable-split-stack-nothreads.patch b/package/gcc/4.9.3/930-libgcc-disable-split-stack-nothreads.patch new file mode 100644 index 0000000000..670cf8dae1 --- /dev/null +++ b/package/gcc/4.9.3/930-libgcc-disable-split-stack-nothreads.patch @@ -0,0 +1,14 @@ +disable split-stack for non-thread builds + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-4.9.3.orig/libgcc/config/t-stack gcc-4.9.3/libgcc/config/t-stack +--- gcc-4.9.3.orig/libgcc/config/t-stack 2010-10-01 21:31:49.000000000 +0200 ++++ gcc-4.9.3/libgcc/config/t-stack 2016-03-07 01:34:32.000000000 +0100 +@@ -1,4 +1,6 @@ + # Makefile fragment to provide generic support for -fsplit-stack. + # This should be used in config.host for any host which supports + # -fsplit-stack. ++ifeq ($(enable_threads),yes) + LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c ++endif diff --git a/package/gcc/5.3.0/100-uclibc-conf.patch b/package/gcc/5.3.0/100-uclibc-conf.patch new file mode 100644 index 0000000000..73d1f0d3a9 --- /dev/null +++ b/package/gcc/5.3.0/100-uclibc-conf.patch @@ -0,0 +1,15 @@ +Index: b/contrib/regression/objs-gcc.sh +=================================================================== +--- a/contrib/regression/objs-gcc.sh ++++ b/contrib/regression/objs-gcc.sh +@@ -106,6 +106,10 @@ + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 diff --git a/package/gcc/5.3.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch b/package/gcc/5.3.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch new file mode 100644 index 0000000000..c11ad35aac --- /dev/null +++ b/package/gcc/5.3.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch @@ -0,0 +1,29 @@ +From 9bf6066d588632dab9f78932df15b5b4140f31f3 Mon Sep 17 00:00:00 2001 +From: "Arnout Vandecappelle (Essensium/Mind)" +Date: Fri, 6 Nov 2015 14:27:23 +0100 +Subject: [PATCH] gcc/config.gcc: fix typo for powerpc e6500 cpu_is_64bit + +Otherwise it is not recognized as a 64-bit powerpc and gcc will not generate +64-bit binaries by default. + +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gcc/config.gcc | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 4a7cbd2..9cc765e 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -439,7 +439,7 @@ powerpc*-*-*) + cpu_type=rs6000 + extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h" + case x$with_cpu in +- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500) ++ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500) + cpu_is_64bit=yes + ;; + esac +-- +2.6.2 + diff --git a/package/gcc/5.3.0/301-missing-execinfo_h.patch b/package/gcc/5.3.0/301-missing-execinfo_h.patch new file mode 100644 index 0000000000..2d0e7baa44 --- /dev/null +++ b/package/gcc/5.3.0/301-missing-execinfo_h.patch @@ -0,0 +1,13 @@ +Index: b/boehm-gc/include/gc.h +=================================================================== +--- a/boehm-gc/include/gc.h ++++ b/boehm-gc/include/gc.h +@@ -503,7 +503,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/package/gcc/5.3.0/810-arm-softfloat-libgcc.patch b/package/gcc/5.3.0/810-arm-softfloat-libgcc.patch new file mode 100644 index 0000000000..5efa7fd1bc --- /dev/null +++ b/package/gcc/5.3.0/810-arm-softfloat-libgcc.patch @@ -0,0 +1,30 @@ +Index: b/gcc/config/arm/linux-elf.h +=================================================================== +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -60,7 +60,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +Index: b/libgcc/config/arm/t-linux +=================================================================== +--- a/libgcc/config/arm/t-linux ++++ b/libgcc/config/arm/t-linux +@@ -1,6 +1,11 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. diff --git a/package/gcc/5.3.0/830-arm_unbreak_armv4t.patch b/package/gcc/5.3.0/830-arm_unbreak_armv4t.patch new file mode 100644 index 0000000000..b730059183 --- /dev/null +++ b/package/gcc/5.3.0/830-arm_unbreak_armv4t.patch @@ -0,0 +1,15 @@ +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html + +Index: b/gcc/config/arm/linux-eabi.h +=================================================================== +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + /* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ diff --git a/package/gcc/5.3.0/840-microblaze-enable-dwarf-eh-support.patch b/package/gcc/5.3.0/840-microblaze-enable-dwarf-eh-support.patch new file mode 100644 index 0000000000..9d29090a2a --- /dev/null +++ b/package/gcc/5.3.0/840-microblaze-enable-dwarf-eh-support.patch @@ -0,0 +1,166 @@ +Fetched from Xilinx gcc git at https://github.com/Xilinx/gcc + +From 23c35173490ac2d6348a668dfc9c1a6eb62171f2 Mon Sep 17 00:00:00 2001 +From: "Edgar E. Iglesias" +Date: Mon, 18 Jun 2012 20:18:13 +0200 +Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support. + +Changelog + +2013-03-18 Edgar E. Iglesias + David Holsgrove + + * common/config/microblaze/microblaze-common.c: Remove + TARGET_EXCEPT_UNWIND_INFO definition. + * config/microblaze/microblaze-protos.h: Add + microblaze_eh_return prototype. + * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register, + microblaze_expand_epilogue, microblaze_return_addr): Handle + calls_eh_return + (microblaze_eh_return): New function. + * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET, + EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX, + ASM_PREFERRED_EH_DATA_FORMAT + * gcc/config/microblaze/microblaze.md: Define eh_return pattern. + +Signed-off-by: David Holsgrove +Signed-off-by: Edgar E. Iglesias +--- + gcc/common/config/microblaze/microblaze-common.c | 3 --- + gcc/config/microblaze/microblaze-protos.h | 1 + + gcc/config/microblaze/microblaze.c | 29 ++++++++++++++++++++---- + gcc/config/microblaze/microblaze.h | 15 ++++++++++++ + gcc/config/microblaze/microblaze.md | 11 +++++++++ + 5 files changed, 52 insertions(+), 7 deletions(-) + +Index: b/gcc/common/config/microblaze/microblaze-common.c +=================================================================== +--- a/gcc/common/config/microblaze/microblaze-common.c ++++ b/gcc/common/config/microblaze/microblaze-common.c +@@ -37,7 +37,4 @@ + #undef TARGET_OPTION_OPTIMIZATION_TABLE + #define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table + +-#undef TARGET_EXCEPT_UNWIND_INFO +-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info +- + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; +Index: b/gcc/config/microblaze/microblaze-protos.h +=================================================================== +--- a/gcc/config/microblaze/microblaze-protos.h ++++ b/gcc/config/microblaze/microblaze-protos.h +@@ -56,6 +56,7 @@ + extern int symbol_mentioned_p (rtx); + extern int label_mentioned_p (rtx); + extern bool microblaze_cannot_force_const_mem (machine_mode, rtx); ++extern void microblaze_eh_return (rtx op0); + #endif /* RTX_CODE */ + + /* Declare functions in microblaze-c.c. */ +Index: b/gcc/config/microblaze/microblaze.c +=================================================================== +--- a/gcc/config/microblaze/microblaze.c ++++ b/gcc/config/microblaze/microblaze.c +@@ -1959,6 +1959,11 @@ + if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM)) + return 1; + ++ if (crtl->calls_eh_return ++ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) { ++ return 1; ++ } ++ + if (!crtl->is_leaf) + { + if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) +@@ -1986,6 +1991,13 @@ + return 1; + } + ++ if (crtl->calls_eh_return ++ && (regno == EH_RETURN_DATA_REGNO (0) ++ || regno == EH_RETURN_DATA_REGNO (1))) ++ { ++ return 1; ++ } ++ + return 0; + } + +@@ -3067,6 +3079,12 @@ + emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx)); + } + ++ if (crtl->calls_eh_return) ++ emit_insn (gen_addsi3 (stack_pointer_rtx, ++ stack_pointer_rtx, ++ gen_rtx_raw_REG (SImode, ++ MB_EH_STACKADJ_REGNUM))); ++ + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST + + MB_ABI_SUB_RETURN_ADDR_REGNUM))); + } +@@ -3364,10 +3382,13 @@ + if (count != 0) + return NULL_RTX; + +- return gen_rtx_PLUS (Pmode, +- get_hard_reg_initial_val (Pmode, +- MB_ABI_SUB_RETURN_ADDR_REGNUM), +- GEN_INT (8)); ++ return get_hard_reg_initial_val (Pmode, ++ MB_ABI_SUB_RETURN_ADDR_REGNUM); ++} ++ ++void microblaze_eh_return (rtx op0) ++{ ++ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0)); + } + + /* Queue an .ident string in the queue of top-level asm statements. +Index: b/gcc/config/microblaze/microblaze.h +=================================================================== +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -184,6 +184,21 @@ + #define INCOMING_RETURN_ADDR_RTX \ + gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM) + ++/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */ ++#define RETURN_ADDR_OFFSET (8) ++ ++/* Describe how we implement __builtin_eh_return. */ ++#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM) ++ ++#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM ++#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM) ++ ++/* Select a format to encode pointers in exception handling data. CODE ++ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is ++ true if the symbol may be affected by dynamic relocations. */ ++#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ ++ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr) ++ + /* Use DWARF 2 debugging information by default. */ + #define DWARF2_DEBUGGING_INFO + #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +Index: b/gcc/config/microblaze/microblaze.md +=================================================================== +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2272,4 +2272,15 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++; This is used in compiling the unwind routines. ++(define_expand "eh_return" ++ [(use (match_operand 0 "general_operand" ""))] ++ "" ++ " ++{ ++ microblaze_eh_return(operands[0]); ++ DONE; ++}") ++ + (include "sync.md") ++ diff --git a/package/gcc/5.3.0/850-libstdcxx-uclibc-c99.patch b/package/gcc/5.3.0/850-libstdcxx-uclibc-c99.patch new file mode 100644 index 0000000000..9e97d945d3 --- /dev/null +++ b/package/gcc/5.3.0/850-libstdcxx-uclibc-c99.patch @@ -0,0 +1,273 @@ +Allow C99-depending features of libstdc++ with uClibc + +The libstdc++ code is fairly restrictive on how it checks for C99 +compatibility: it requires *complete* C99 support to enable certain +features. For example, uClibc provides a good number of C99 features, +but not C99 complex number support. For this reason, libstdc++ +completely disables many the standard C++ methods that can in fact +work because uClibc provides the necessary functions. + +This patch is similar and highly inspired from +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in +a way that doesn't involve changing the configure.ac script, as +autoreconfiguring gcc is complicated. It simply relies on the fact +that uClibc defines the __UCLIBC__ definition. + +Signed-off-by: Thomas Petazzoni + +Index: b/libstdc++-v3/config/locale/generic/c_locale.h +=================================================================== +--- a/libstdc++-v3/config/locale/generic/c_locale.h ++++ b/libstdc++-v3/config/locale/generic/c_locale.h +@@ -70,7 +70,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +Index: b/libstdc++-v3/config/locale/gnu/c_locale.h +=================================================================== +--- a/libstdc++-v3/config/locale/gnu/c_locale.h ++++ b/libstdc++-v3/config/locale/gnu/c_locale.h +@@ -88,7 +88,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +Index: b/libstdc++-v3/include/bits/basic_string.h +=================================================================== +--- a/libstdc++-v3/include/bits/basic_string.h ++++ b/libstdc++-v3/include/bits/basic_string.h +@@ -5239,7 +5239,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) ++#if __cplusplus >= 201103L && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)) + + #include + +Index: b/libstdc++-v3/include/bits/locale_facets.tcc +=================================================================== +--- a/libstdc++-v3/include/bits/locale_facets.tcc ++++ b/libstdc++-v3/include/bits/locale_facets.tcc +@@ -992,7 +992,7 @@ + char __fbuf[16]; + __num_base::_S_format_float(__io, __fbuf, __mod); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // Precision is always used except for hexfloat format. + const bool __use_prec = + (__io.flags() & ios_base::floatfield) != ios_base::floatfield; +Index: b/libstdc++-v3/include/bits/locale_facets_nonio.tcc +=================================================================== +--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc ++++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc +@@ -578,7 +578,7 @@ + { + const locale __loc = __io.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough. + int __cs_size = 64; + char* __cs = static_cast(__builtin_alloca(__cs_size)); +Index: b/libstdc++-v3/include/c_compatibility/math.h +=================================================================== +--- a/libstdc++-v3/include/c_compatibility/math.h ++++ b/libstdc++-v3/include/c_compatibility/math.h +@@ -56,7 +56,7 @@ + using std::floor; + using std::fmod; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::fpclassify; + using std::isfinite; + using std::isinf; +Index: b/libstdc++-v3/include/c_compatibility/wchar.h +=================================================================== +--- a/libstdc++-v3/include/c_compatibility/wchar.h ++++ b/libstdc++-v3/include/c_compatibility/wchar.h +@@ -103,7 +103,7 @@ + using std::wmemset; + using std::wcsftime; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/c_global/cstdlib +=================================================================== +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -195,7 +195,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +Index: b/libstdc++-v3/include/c_global/cwchar +=================================================================== +--- a/libstdc++-v3/include/c_global/cwchar ++++ b/libstdc++-v3/include/c_global/cwchar +@@ -232,7 +232,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +@@ -289,7 +289,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/c_std/cstdio +=================================================================== +--- a/libstdc++-v3/include/c_std/cstdio ++++ b/libstdc++-v3/include/c_std/cstdio +@@ -144,7 +144,7 @@ + using ::vsprintf; + } // namespace std + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf +Index: b/libstdc++-v3/include/c_std/cstdlib +=================================================================== +--- a/libstdc++-v3/include/c_std/cstdlib ++++ b/libstdc++-v3/include/c_std/cstdlib +@@ -192,7 +192,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +Index: b/libstdc++-v3/include/c_std/cwchar +=================================================================== +--- a/libstdc++-v3/include/c_std/cwchar ++++ b/libstdc++-v3/include/c_std/cwchar +@@ -228,7 +228,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +Index: b/libstdc++-v3/include/ext/vstring.h +=================================================================== +--- a/libstdc++-v3/include/ext/vstring.h ++++ b/libstdc++-v3/include/ext/vstring.h +@@ -2680,7 +2680,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99)) ++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))) + + #include + +Index: b/libstdc++-v3/include/tr1/cstdio +=================================================================== +--- a/libstdc++-v3/include/tr1/cstdio ++++ b/libstdc++-v3/include/tr1/cstdio +@@ -33,7 +33,7 @@ + + #include + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +Index: b/libstdc++-v3/include/tr1/cstdlib +=================================================================== +--- a/libstdc++-v3/include/tr1/cstdlib ++++ b/libstdc++-v3/include/tr1/cstdlib +@@ -35,7 +35,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +Index: b/libstdc++-v3/include/tr1/cwchar +=================================================================== +--- a/libstdc++-v3/include/tr1/cwchar ++++ b/libstdc++-v3/include/tr1/cwchar +@@ -52,7 +52,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/tr1/stdlib.h +=================================================================== +--- a/libstdc++-v3/include/tr1/stdlib.h ++++ b/libstdc++-v3/include/tr1/stdlib.h +@@ -33,7 +33,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + using std::tr1::atoll; + using std::tr1::strtoll; +Index: b/libstdc++-v3/src/c++11/debug.cc +=================================================================== +--- a/libstdc++-v3/src/c++11/debug.cc ++++ b/libstdc++-v3/src/c++11/debug.cc +@@ -788,7 +788,7 @@ + int __n __attribute__ ((__unused__)), + const char* __fmt, _Tp __s) const throw () + { +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + std::snprintf(__buf, __n, __fmt, __s); + #else + std::sprintf(__buf, __fmt, __s); +Index: b/libstdc++-v3/include/c_global/cstdio +=================================================================== +--- a/libstdc++-v3/include/c_global/cstdio ++++ b/libstdc++-v3/include/c_global/cstdio +@@ -146,7 +146,7 @@ + using ::vsprintf; + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/package/gcc/5.3.0/860-cilk-wchar.patch b/package/gcc/5.3.0/860-cilk-wchar.patch new file mode 100644 index 0000000000..1d9916f554 --- /dev/null +++ b/package/gcc/5.3.0/860-cilk-wchar.patch @@ -0,0 +1,56 @@ +[PATCH] cilk: fix build without wchar + +When building against uClibc with wchar support disabled, WCHAR_MIN and +WCHAR_MAX are not defined leading to compilation errors. + +Fix it by only including the wchar code if available. + +Signed-off-by: Peter Korsgaard +--- + libcilkrts/include/cilk/reducer_min_max.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Index: b/libcilkrts/include/cilk/reducer_min_max.h +=================================================================== +--- a/libcilkrts/include/cilk/reducer_min_max.h ++++ b/libcilkrts/include/cilk/reducer_min_max.h +@@ -3154,7 +3154,9 @@ + CILK_C_REDUCER_MAX_INSTANCE(char, char, CHAR_MIN) + CILK_C_REDUCER_MAX_INSTANCE(unsigned char, uchar, 0) + CILK_C_REDUCER_MAX_INSTANCE(signed char, schar, SCHAR_MIN) ++#ifdef WCHAR_MIN + CILK_C_REDUCER_MAX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN) ++#endif + CILK_C_REDUCER_MAX_INSTANCE(short, short, SHRT_MIN) + CILK_C_REDUCER_MAX_INSTANCE(unsigned short, ushort, 0) + CILK_C_REDUCER_MAX_INSTANCE(int, int, INT_MIN) +@@ -3306,7 +3308,9 @@ + CILK_C_REDUCER_MAX_INDEX_INSTANCE(char, char, CHAR_MIN) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned char, uchar, 0) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(signed char, schar, SCHAR_MIN) ++#ifdef WCHAR_MIN + CILK_C_REDUCER_MAX_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN) ++#endif + CILK_C_REDUCER_MAX_INDEX_INSTANCE(short, short, SHRT_MIN) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned short, ushort, 0) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(int, int, INT_MIN) +@@ -3432,7 +3436,9 @@ + CILK_C_REDUCER_MIN_INSTANCE(char, char, CHAR_MAX) + CILK_C_REDUCER_MIN_INSTANCE(unsigned char, uchar, CHAR_MAX) + CILK_C_REDUCER_MIN_INSTANCE(signed char, schar, SCHAR_MAX) ++#ifdef WCHAR_MAX + CILK_C_REDUCER_MIN_INSTANCE(wchar_t, wchar_t, WCHAR_MAX) ++#endif + CILK_C_REDUCER_MIN_INSTANCE(short, short, SHRT_MAX) + CILK_C_REDUCER_MIN_INSTANCE(unsigned short, ushort, USHRT_MAX) + CILK_C_REDUCER_MIN_INSTANCE(int, int, INT_MAX) +@@ -3584,7 +3590,9 @@ + CILK_C_REDUCER_MIN_INDEX_INSTANCE(char, char, CHAR_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned char, uchar, CHAR_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(signed char, schar, SCHAR_MAX) ++#ifdef WCHAR_MAX + CILK_C_REDUCER_MIN_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MAX) ++#endif + CILK_C_REDUCER_MIN_INDEX_INSTANCE(short, short, SHRT_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned short, ushort, USHRT_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(int, int, INT_MAX) diff --git a/package/gcc/5.3.0/870-xtensa-add-mauto-litpools-option.patch b/package/gcc/5.3.0/870-xtensa-add-mauto-litpools-option.patch new file mode 100644 index 0000000000..aa1376c44c --- /dev/null +++ b/package/gcc/5.3.0/870-xtensa-add-mauto-litpools-option.patch @@ -0,0 +1,290 @@ +From 6d852ffb43b111a39162135c95249e749c4e285b Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 6 Aug 2015 01:16:02 +0300 +Subject: [PATCH] xtensa: add -mauto-litpools option + +With support from assembler this option allows compiling huge functions, +where single literal pool at the beginning of a function may not be +reachable by L32R instructions at its end. + +Currently assembler --auto-litpools option cannot deal with literals +used from multiple locations separated by more than 256 KBytes of code. +Don't turn constants into literals, instead use MOVI instruction to load +them into registers and let the assembler turn them into literals as +necessary. + +2015-08-12 Max Filippov +gcc/ + * config/xtensa/constraints.md (define_constraint "Y"): New + constraint. + * config/xtensa/elf.h (ASM_SPEC): Add m(no-)auto-litpools. + * config/xtensa/linux.h (ASM_SPEC): Likewise. + * config/xtensa/predicates.md (move_operand): Match constants + and symbols in the presence of TARGET_AUTO_LITPOOLS. + * config/xtensa/xtensa.c (xtensa_valid_move): Don't allow + immediate references to TLS data. + (xtensa_emit_move_sequence): Don't force constants to memory in + the presence of TARGET_AUTO_LITPOOLS. + (print_operand): Add 'y' format, same as default, but capable of + printing SF mode constants as well. + * config/xtensa/xtensa.md (movsi_internal, movhi_internal) + (movsf_internal): Add movi pattern that loads literal. + (movsf, movdf): Don't force constants to memory in the presence + of TARGET_AUTO_LITPOOLS. + (movdf_internal): Add 'Y' constraint. + * config/xtensa/xtensa.opt (mauto-litpools): New option. + +Signed-off-by: Max Filippov +--- +Backported from: r226828 +Changes to ChangeLogs and documentation are dropped. + + gcc/config/xtensa/constraints.md | 5 +++++ + gcc/config/xtensa/elf.h | 4 +++- + gcc/config/xtensa/linux.h | 4 +++- + gcc/config/xtensa/predicates.md | 3 ++- + gcc/config/xtensa/xtensa.c | 19 ++++++++++++++++++- + gcc/config/xtensa/xtensa.md | 35 +++++++++++++++++++---------------- + gcc/config/xtensa/xtensa.opt | 4 ++++ + 7 files changed, 54 insertions(+), 20 deletions(-) + +diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md +index 30f4c1f..773d4f9 100644 +--- a/gcc/config/xtensa/constraints.md ++++ b/gcc/config/xtensa/constraints.md +@@ -111,6 +111,11 @@ + (and (match_code "const_int") + (match_test "xtensa_mask_immediate (ival)"))) + ++(define_constraint "Y" ++ "A constant that can be used in relaxed MOVI instructions." ++ (and (match_code "const_int,const_double,const,symbol_ref,label_ref") ++ (match_test "TARGET_AUTO_LITPOOLS"))) ++ + ;; Memory constraints. Do not use define_memory_constraint here. Doing so + ;; causes reload to force some constants into the constant pool, but since + ;; the Xtensa constant pool can only be accessed with L32R instructions, it +diff --git a/gcc/config/xtensa/elf.h b/gcc/config/xtensa/elf.h +index e59bede..12056f7 100644 +--- a/gcc/config/xtensa/elf.h ++++ b/gcc/config/xtensa/elf.h +@@ -48,7 +48,9 @@ along with GCC; see the file COPYING3. If not see + %{mtarget-align:--target-align} \ + %{mno-target-align:--no-target-align} \ + %{mlongcalls:--longcalls} \ +- %{mno-longcalls:--no-longcalls}" ++ %{mno-longcalls:--no-longcalls} \ ++ %{mauto-litpools:--auto-litpools} \ ++ %{mno-auto-litpools:--no-auto-litpools}" + + #undef LIB_SPEC + #define LIB_SPEC "-lc -lsim -lc -lhandlers-sim -lhal" +diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h +index 675aacf..5b0243a 100644 +--- a/gcc/config/xtensa/linux.h ++++ b/gcc/config/xtensa/linux.h +@@ -42,7 +42,9 @@ along with GCC; see the file COPYING3. If not see + %{mtarget-align:--target-align} \ + %{mno-target-align:--no-target-align} \ + %{mlongcalls:--longcalls} \ +- %{mno-longcalls:--no-longcalls}" ++ %{mno-longcalls:--no-longcalls} \ ++ %{mauto-litpools:--auto-litpools} \ ++ %{mno-auto-litpools:--no-auto-litpools}" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + +diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md +index e02209e..d7dfa11 100644 +--- a/gcc/config/xtensa/predicates.md ++++ b/gcc/config/xtensa/predicates.md +@@ -142,7 +142,8 @@ + (match_test "GET_MODE_CLASS (mode) == MODE_INT + && xtensa_simm12b (INTVAL (op))")) + (and (match_code "const_int,const_double,const,symbol_ref,label_ref") +- (match_test "TARGET_CONST16 && CONSTANT_P (op) ++ (match_test "(TARGET_CONST16 || TARGET_AUTO_LITPOOLS) ++ && CONSTANT_P (op) + && GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0"))))) + + ;; Accept the floating point constant 1 in the appropriate mode. +diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c +index eb039ba..206ff80 100644 +--- a/gcc/config/xtensa/xtensa.c ++++ b/gcc/config/xtensa/xtensa.c +@@ -501,6 +501,9 @@ xtensa_valid_move (machine_mode mode, rtx *operands) + { + int dst_regnum = xt_true_regnum (operands[0]); + ++ if (xtensa_tls_referenced_p (operands[1])) ++ return FALSE; ++ + /* The stack pointer can only be assigned with a MOVSP opcode. */ + if (dst_regnum == STACK_POINTER_REGNUM) + return !TARGET_WINDOWED_ABI +@@ -1069,7 +1072,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode) + return 1; + } + +- if (! TARGET_CONST16) ++ if (! TARGET_AUTO_LITPOOLS && ! TARGET_CONST16) + { + src = force_const_mem (SImode, src); + operands[1] = src; +@@ -2449,6 +2452,20 @@ print_operand (FILE *file, rtx x, int letter) + } + break; + ++ case 'y': ++ if (GET_CODE (x) == CONST_DOUBLE && ++ GET_MODE (x) == SFmode) ++ { ++ REAL_VALUE_TYPE r; ++ long l; ++ REAL_VALUE_FROM_CONST_DOUBLE (r, x); ++ REAL_VALUE_TO_TARGET_SINGLE (r, l); ++ fprintf (file, "0x%08lx", l); ++ break; ++ } ++ ++ /* fall through */ ++ + default: + if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG) + fprintf (file, "%s", reg_names[xt_true_regnum (x)]); +diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md +index 6d84384..0e673a3 100644 +--- a/gcc/config/xtensa/xtensa.md ++++ b/gcc/config/xtensa/xtensa.md +@@ -761,8 +761,8 @@ + }) + + (define_insn "movsi_internal" +- [(set (match_operand:SI 0 "nonimmed_operand" "=D,D,D,D,R,R,a,q,a,W,a,a,U,*a,*A") +- (match_operand:SI 1 "move_operand" "M,D,d,R,D,d,r,r,I,i,T,U,r,*A,*r"))] ++ [(set (match_operand:SI 0 "nonimmed_operand" "=D,D,D,D,R,R,a,q,a,a,W,a,a,U,*a,*A") ++ (match_operand:SI 1 "move_operand" "M,D,d,R,D,d,r,r,I,Y,i,T,U,r,*A,*r"))] + "xtensa_valid_move (SImode, operands)" + "@ + movi.n\t%0, %x1 +@@ -774,15 +774,16 @@ + mov\t%0, %1 + movsp\t%0, %1 + movi\t%0, %x1 ++ movi\t%0, %1 + const16\t%0, %t1\;const16\t%0, %b1 + %v1l32r\t%0, %1 + %v1l32i\t%0, %1 + %v0s32i\t%1, %0 + rsr\t%0, ACCLO + wsr\t%1, ACCLO" +- [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,load,load,store,rsr,wsr") ++ [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr") + (set_attr "mode" "SI") +- (set_attr "length" "2,2,2,2,2,2,3,3,3,6,3,3,3,3,3")]) ++ (set_attr "length" "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")]) + + ;; 16-bit Integer moves + +@@ -796,21 +797,22 @@ + }) + + (define_insn "movhi_internal" +- [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,U,*a,*A") +- (match_operand:HI 1 "move_operand" "M,d,r,I,U,r,*A,*r"))] ++ [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,U,*a,*A") ++ (match_operand:HI 1 "move_operand" "M,d,r,I,Y,U,r,*A,*r"))] + "xtensa_valid_move (HImode, operands)" + "@ + movi.n\t%0, %x1 + mov.n\t%0, %1 + mov\t%0, %1 + movi\t%0, %x1 ++ movi\t%0, %1 + %v1l16ui\t%0, %1 + %v0s16i\t%1, %0 + rsr\t%0, ACCLO + wsr\t%1, ACCLO" +- [(set_attr "type" "move,move,move,move,load,store,rsr,wsr") ++ [(set_attr "type" "move,move,move,move,move,load,store,rsr,wsr") + (set_attr "mode" "HI") +- (set_attr "length" "2,2,3,3,3,3,3,3")]) ++ (set_attr "length" "2,2,3,3,3,3,3,3,3")]) + + ;; 8-bit Integer moves + +@@ -881,7 +883,7 @@ + (match_operand:SF 1 "general_operand" ""))] + "" + { +- if (!TARGET_CONST16 && CONSTANT_P (operands[1])) ++ if (!TARGET_CONST16 && !TARGET_AUTO_LITPOOLS && CONSTANT_P (operands[1])) + operands[1] = force_const_mem (SFmode, operands[1]); + + if ((!register_operand (operands[0], SFmode) +@@ -896,8 +898,8 @@ + }) + + (define_insn "movsf_internal" +- [(set (match_operand:SF 0 "nonimmed_operand" "=f,f,U,D,D,R,a,f,a,W,a,a,U") +- (match_operand:SF 1 "move_operand" "f,U,f,d,R,d,r,r,f,iF,T,U,r"))] ++ [(set (match_operand:SF 0 "nonimmed_operand" "=f,f,U,D,D,R,a,f,a,a,W,a,a,U") ++ (match_operand:SF 1 "move_operand" "f,U,f,d,R,d,r,r,f,Y,iF,T,U,r"))] + "((register_operand (operands[0], SFmode) + || register_operand (operands[1], SFmode)) + && !(FP_REG_P (xt_true_regnum (operands[0])) +@@ -912,13 +914,14 @@ + mov\t%0, %1 + wfr\t%0, %1 + rfr\t%0, %1 ++ movi\t%0, %y1 + const16\t%0, %t1\;const16\t%0, %b1 + %v1l32r\t%0, %1 + %v1l32i\t%0, %1 + %v0s32i\t%1, %0" +- [(set_attr "type" "farith,fload,fstore,move,load,store,move,farith,farith,move,load,load,store") ++ [(set_attr "type" "farith,fload,fstore,move,load,store,move,farith,farith,move,move,load,load,store") + (set_attr "mode" "SF") +- (set_attr "length" "3,3,3,2,2,2,3,3,3,6,3,3,3")]) ++ (set_attr "length" "3,3,3,2,2,2,3,3,3,3,6,3,3,3")]) + + (define_insn "*lsiu" + [(set (match_operand:SF 0 "register_operand" "=f") +@@ -991,7 +994,7 @@ + (match_operand:DF 1 "general_operand" ""))] + "" + { +- if (CONSTANT_P (operands[1]) && !TARGET_CONST16) ++ if (CONSTANT_P (operands[1]) && !TARGET_CONST16 && !TARGET_AUTO_LITPOOLS) + operands[1] = force_const_mem (DFmode, operands[1]); + + if (!register_operand (operands[0], DFmode) +@@ -1002,8 +1005,8 @@ + }) + + (define_insn_and_split "movdf_internal" +- [(set (match_operand:DF 0 "nonimmed_operand" "=a,W,a,a,U") +- (match_operand:DF 1 "move_operand" "r,iF,T,U,r"))] ++ [(set (match_operand:DF 0 "nonimmed_operand" "=a,a,W,a,a,U") ++ (match_operand:DF 1 "move_operand" "r,Y,iF,T,U,r"))] + "register_operand (operands[0], DFmode) + || register_operand (operands[1], DFmode)" + "#" +diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt +index 2fd6cee..21c6e96 100644 +--- a/gcc/config/xtensa/xtensa.opt ++++ b/gcc/config/xtensa/xtensa.opt +@@ -38,6 +38,10 @@ mtext-section-literals + Target + Intersperse literal pools with code in the text section + ++mauto-litpools ++Target Report Mask(AUTO_LITPOOLS) ++Relax literals in assembler and place them automatically in the text section ++ + mserialize-volatile + Target Report Mask(SERIALIZE_VOLATILE) + -mno-serialize-volatile Do not serialize volatile memory references with MEMW instructions +-- +1.8.1.4 + diff --git a/package/gcc/5.3.0/871-xtensa-reimplement-register-spilling.patch b/package/gcc/5.3.0/871-xtensa-reimplement-register-spilling.patch new file mode 100644 index 0000000000..4056f8b8ed --- /dev/null +++ b/package/gcc/5.3.0/871-xtensa-reimplement-register-spilling.patch @@ -0,0 +1,76 @@ +From 40507bf199440082ed69b777986d50c31efe2520 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Mon, 10 Aug 2015 21:35:20 +0300 +Subject: [PATCH 1/3] xtensa: reimplement register spilling + +Spilling windowed registers in userspace is much easier, more portable, +less error-prone and equally effective as in kernel. Now that register +spilling syscall is considered obsolete in the xtensa linux kernel +replace it with CALL12 followed by series of ENTRY in libgcc. + +2015-08-18 Max Filippov +libgcc/ + * config/xtensa/lib2funcs.S (__xtensa_libgcc_window_spill): Use + CALL12 followed by series of ENTRY to spill windowed registers. + (__xtensa_nonlocal_goto): Call __xtensa_libgcc_window_spill + instead of making linux spill syscall. + +Signed-off-by: Max Filippov +--- +Backported from: r226962 + + libgcc/config/xtensa/lib2funcs.S | 30 +++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S +index 4d451c8..ef0703f 100644 +--- a/libgcc/config/xtensa/lib2funcs.S ++++ b/libgcc/config/xtensa/lib2funcs.S +@@ -34,10 +34,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + .global __xtensa_libgcc_window_spill + .type __xtensa_libgcc_window_spill,@function + __xtensa_libgcc_window_spill: +- entry sp, 32 +- movi a2, 0 +- syscall ++ entry sp, 48 ++#if XCHAL_NUM_AREGS > 16 ++ call12 1f ++ retw ++ .align 4 ++1: ++ .rept (XCHAL_NUM_AREGS - 24) / 12 ++ _entry sp, 48 ++ mov a12, a0 ++ .endr ++ _entry sp, 16 ++#if XCHAL_NUM_AREGS % 12 == 0 ++ mov a4, a4 ++#elif XCHAL_NUM_AREGS % 12 == 4 ++ mov a8, a8 ++#elif XCHAL_NUM_AREGS % 12 == 8 ++ mov a12, a12 ++#endif + retw ++#else ++ mov a8, a8 ++ retw ++#endif + .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill + #endif + +@@ -61,10 +80,7 @@ __xtensa_nonlocal_goto: + entry sp, 32 + + /* Flush registers. */ +- mov a5, a2 +- movi a2, 0 +- syscall +- mov a2, a5 ++ call8 __xtensa_libgcc_window_spill + + /* Because the save area for a0-a3 is stored one frame below + the one identified by a2, the only way to restore those +-- +1.8.1.4 + diff --git a/package/gcc/5.3.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch b/package/gcc/5.3.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch new file mode 100644 index 0000000000..9707f6881c --- /dev/null +++ b/package/gcc/5.3.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch @@ -0,0 +1,31 @@ +From 7d7a85f75ba218df4a4226e95865fc8fa561cb86 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 14 Aug 2015 02:45:02 +0300 +Subject: [PATCH 2/3] xtensa: use unwind-dw2-fde-dip instead of unwind-dw2-fde + +This allows having exception cleanup code in binaries that don't +register their unwind tables. + +2015-08-18 Max Filippov +libgcc/ + * config/xtensa/t-windowed (LIB2ADDEH): Replace unwind-dw2-fde + with unwind-dw2-fde-dip. + +Signed-off-by: Max Filippov +--- +Backported from: r226963 + + libgcc/config/xtensa/t-windowed | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/config/xtensa/t-windowed b/libgcc/config/xtensa/t-windowed +index 7d9e9db..a99156c 100644 +--- a/libgcc/config/xtensa/t-windowed ++++ b/libgcc/config/xtensa/t-windowed +@@ -1,2 +1,2 @@ + LIB2ADDEH = $(srcdir)/config/xtensa/unwind-dw2-xtensa.c \ +- $(srcdir)/unwind-dw2-fde.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c ++ $(srcdir)/unwind-dw2-fde-dip.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c +-- +1.8.1.4 + diff --git a/package/gcc/5.3.0/873-xtensa-fix-_Unwind_GetCFA.patch b/package/gcc/5.3.0/873-xtensa-fix-_Unwind_GetCFA.patch new file mode 100644 index 0000000000..2d8eb7c778 --- /dev/null +++ b/package/gcc/5.3.0/873-xtensa-fix-_Unwind_GetCFA.patch @@ -0,0 +1,40 @@ +From b33905dc310f475ddbde4c9fb7230724b2068a2b Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sat, 15 Aug 2015 05:12:11 +0300 +Subject: [PATCH 3/3] xtensa: fix _Unwind_GetCFA + +Returning context->cfa in _Unwind_GetCFA makes CFA point one stack frame +higher than what was actually used by code at context->ra. This results +in invalid CFA value in signal frames and premature unwinding completion +in forced unwinding used by uClibc NPTL thread cancellation. +Returning context->sp from _Unwind_GetCFA makes all CFA values valid and +matching code that used them. + +2015-08-18 Max Filippov +libgcc/ + * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return + context->sp instead of context->cfa. + +Signed-off-by: Max Filippov +--- +Backported from: r226964 + + libgcc/config/xtensa/unwind-dw2-xtensa.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c +index 82b0e63..8e579c7 100644 +--- a/libgcc/config/xtensa/unwind-dw2-xtensa.c ++++ b/libgcc/config/xtensa/unwind-dw2-xtensa.c +@@ -130,7 +130,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index) + _Unwind_Word + _Unwind_GetCFA (struct _Unwind_Context *context) + { +- return (_Unwind_Ptr) context->cfa; ++ return (_Unwind_Ptr) context->sp; + } + + /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ +-- +1.8.1.4 + diff --git a/package/gcc/5.3.0/874-xtensa-add-uclinux-support.patch b/package/gcc/5.3.0/874-xtensa-add-uclinux-support.patch new file mode 100644 index 0000000000..23db3d863c --- /dev/null +++ b/package/gcc/5.3.0/874-xtensa-add-uclinux-support.patch @@ -0,0 +1,174 @@ +From 70c2cb98fb129b4766b5da0f945dc41fd568c77a Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sat, 22 Aug 2015 08:44:26 +0300 +Subject: [PATCH] xtensa: add uclinux support + +2015-10-03 Max Filippov +gcc/ + * config.gcc (xtensa*-*-uclinux*): New configuration. + * config/xtensa/uclinux.h: New file. + * config/xtensa/uclinux.opt: New file. + +libgcc/ + * config.host (xtensa*-*-uclinux*): New configuration. + +Signed-off-by: Max Filippov +--- +Backported from: r228450 + + gcc/config.gcc | 5 ++++ + gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++ + gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++ + libgcc/config.host | 5 ++++ + 4 files changed, 111 insertions(+) + create mode 100644 gcc/config/xtensa/uclinux.h + create mode 100644 gcc/config/xtensa/uclinux.opt + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index c52f5a8..56797bd 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2995,6 +2995,11 @@ xtensa*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h" + tmake_file="${tmake_file} xtensa/t-xtensa" + ;; ++xtensa*-*-uclinux*) ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h" ++ tmake_file="${tmake_file} xtensa/t-xtensa" ++ extra_options="${extra_options} xtensa/uclinux.opt" ++ ;; + am33_2.0-*-linux*) + tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h" + gas=yes gnu_ld=yes +diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h +new file mode 100644 +index 0000000..4606020 +--- /dev/null ++++ b/gcc/config/xtensa/uclinux.h +@@ -0,0 +1,69 @@ ++/* Xtensa uClinux configuration. ++ Derived from the configuration for GCC for Intel i386 running Linux. ++ Copyright (C) 2001-2015 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify it under ++the terms of the GNU General Public License as published by the Free ++Software Foundation; either version 3, or (at your option) any later ++version. ++ ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++WARRANTY; without even the implied warranty of MERCHANTABILITY or ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ GNU_USER_TARGET_OS_CPP_BUILTINS (); \ ++ builtin_define ("__uClinux__"); \ ++ } \ ++ while (0) ++ ++#undef SUBTARGET_CPP_SPEC ++#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" ++ ++#undef SIZE_TYPE ++#define SIZE_TYPE "unsigned int" ++ ++#undef PTRDIFF_TYPE ++#define PTRDIFF_TYPE "int" ++ ++#undef WCHAR_TYPE ++#define WCHAR_TYPE "long int" ++ ++#undef WCHAR_TYPE_SIZE ++#define WCHAR_TYPE_SIZE 32 ++ ++#undef ASM_SPEC ++#define ASM_SPEC \ ++ "%{mtext-section-literals:--text-section-literals} \ ++ %{mno-text-section-literals:--no-text-section-literals} \ ++ %{mtarget-align:--target-align} \ ++ %{mno-target-align:--no-target-align} \ ++ %{mlongcalls:--longcalls} \ ++ %{mno-longcalls:--no-longcalls} \ ++ %{mauto-litpools:--auto-litpools} \ ++ %{mno-auto-litpools:--no-auto-litpools}" ++ ++#undef LINK_SPEC ++#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}" ++ ++#undef LOCAL_LABEL_PREFIX ++#define LOCAL_LABEL_PREFIX "." ++ ++/* Always enable "-fpic" for Xtensa Linux. */ ++#define XTENSA_ALWAYS_PIC 1 ++ ++#undef TARGET_LIBC_HAS_FUNCTION ++#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function ++ ++#undef DBX_REGISTER_NUMBER ++ +diff --git a/gcc/config/xtensa/uclinux.opt b/gcc/config/xtensa/uclinux.opt +new file mode 100644 +index 0000000..95ef777 +--- /dev/null ++++ b/gcc/config/xtensa/uclinux.opt +@@ -0,0 +1,32 @@ ++; Xtensa uClinux options. ++ ++; Copyright (C) 2015 Free Software Foundation, Inc. ++; ++; This file is part of GCC. ++; ++; GCC is free software; you can redistribute it and/or modify it under ++; the terms of the GNU General Public License as published by the Free ++; Software Foundation; either version 3, or (at your option) any later ++; version. ++; ++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++; WARRANTY; without even the implied warranty of MERCHANTABILITY or ++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++; for more details. ++; ++; You should have received a copy of the GNU General Public License ++; along with GCC; see the file COPYING3. If not see ++; . ++ ++; See the GCC internals manual (options.texi) for a description of ++; this file's format. ++ ++; Please try to keep this file in ASCII collating order. ++ ++elf2flt ++Driver ++ ++elf2flt= ++Driver JoinedOrMissing ++ ++; This comment is to ensure we retain the blank line above. +diff --git a/libgcc/config.host b/libgcc/config.host +index 2c64756..2ee92c1 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -1295,6 +1295,11 @@ xtensa*-*-linux*) + tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc" + md_unwind_header=xtensa/linux-unwind.h + ;; ++xtensa*-*-uclinux*) ++ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc" ++ md_unwind_header=xtensa/linux-unwind.h ++ extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o" ++ ;; + am33_2.0-*-linux*) + # Don't need crtbeginT.o from *-*-linux* default. + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" +-- +1.8.1.4 + diff --git a/package/gcc/5.3.0/890-fix-m68k-compile.patch b/package/gcc/5.3.0/890-fix-m68k-compile.patch new file mode 100644 index 0000000000..6e63de0cd1 --- /dev/null +++ b/package/gcc/5.3.0/890-fix-m68k-compile.patch @@ -0,0 +1,15 @@ +remove unused header, which breaks the toolchain building + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c gcc-5.3.0/libgcc/config/m68k/linux-atomic.c +--- gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c 2015-01-05 13:33:28.000000000 +0100 ++++ gcc-5.3.0/libgcc/config/m68k/linux-atomic.c 2016-03-19 09:25:07.000000000 +0100 +@@ -33,7 +33,6 @@ + using the kernel helper defined below. There is no support for + 64-bit operations yet. */ + +-#include + #include + + #ifndef __NR_atomic_cmpxchg_32 diff --git a/package/gcc/5.3.0/891-fix-m68k-uclinux.patch b/package/gcc/5.3.0/891-fix-m68k-uclinux.patch new file mode 100644 index 0000000000..4e186bd3d3 --- /dev/null +++ b/package/gcc/5.3.0/891-fix-m68k-uclinux.patch @@ -0,0 +1,18 @@ +avoids internal compiler error while compiling linux-atomic.c +See here: +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833 + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-5.3.0.orig/libgcc/config.host gcc-5.3.0/libgcc/config.host +--- gcc-5.3.0.orig/libgcc/config.host 2015-10-01 14:01:18.000000000 +0200 ++++ gcc-5.3.0/libgcc/config.host 2016-04-26 21:30:25.353691745 +0200 +@@ -794,7 +794,7 @@ + m68k*-*-openbsd*) + ;; + m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux with uClibc +- tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux" ++ tmake_file="$tmake_file m68k/t-floatlib" + md_unwind_header=m68k/linux-unwind.h + ;; + m68k-*-linux*) # Motorola m68k's running GNU/Linux diff --git a/package/gcc/5.3.0/900-libitm-fixes-for-musl-support.patch b/package/gcc/5.3.0/900-libitm-fixes-for-musl-support.patch new file mode 100644 index 0000000000..fdf4ee724d --- /dev/null +++ b/package/gcc/5.3.0/900-libitm-fixes-for-musl-support.patch @@ -0,0 +1,65 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:11:25 +0000 (+0000) +Subject: libitm fixes for musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=e53a4d49c3d03ab8eaddb073cf972c1c46d75338 + +libitm fixes for musl support + +On behalf of Szabolcs.Nagy@arm.com + +2015-04-22 Gregor Richards + + * config/arm/hwcap.cc: Use fcntl.h instead of sys/fcntl.h. + * config/linux/x86/tls.h: Only use __GLIBC_PREREQ if defined. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222325 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/libitm/config/arm/hwcap.cc +=================================================================== +--- a/libitm/config/arm/hwcap.cc ++++ b/libitm/config/arm/hwcap.cc +@@ -40,7 +40,7 @@ + + #ifdef __linux__ + #include +-#include ++#include + #include + + static void __attribute__((constructor)) +Index: b/libitm/config/linux/x86/tls.h +=================================================================== +--- a/libitm/config/linux/x86/tls.h ++++ b/libitm/config/linux/x86/tls.h +@@ -25,16 +25,19 @@ + #ifndef LIBITM_X86_TLS_H + #define LIBITM_X86_TLS_H 1 + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + /* Use slots in the TCB head rather than __thread lookups. + GLIBC has reserved words 10 through 13 for TM. */ + #define HAVE_ARCH_GTM_THREAD 1 + #define HAVE_ARCH_GTM_THREAD_DISP 1 + #endif ++#endif + + #include "config/generic/tls.h" + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + namespace GTM HIDDEN { + + #ifdef __x86_64__ +@@ -101,5 +104,6 @@ + + } // namespace GTM + #endif /* >= GLIBC 2.10 */ ++#endif + + #endif // LIBITM_X86_TLS_H diff --git a/package/gcc/5.3.0/901-fixincludes-update-for-musl-support.patch b/package/gcc/5.3.0/901-fixincludes-update-for-musl-support.patch new file mode 100644 index 0000000000..13c08d6b96 --- /dev/null +++ b/package/gcc/5.3.0/901-fixincludes-update-for-musl-support.patch @@ -0,0 +1,32 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:18:16 +0000 (+0000) +Subject: fixincludes update for musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2dc727de2e87c2756a514cbb43cea23c99deaa3d + +fixincludes update for musl support + +On behalf of Szabolcs.Nagy@arm.com + +2015-04-22 Gregor Richards + + * mkfixinc.sh: Add *-musl* with no fixes. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222327 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/fixincludes/mkfixinc.sh +=================================================================== +--- a/fixincludes/mkfixinc.sh ++++ b/fixincludes/mkfixinc.sh +@@ -19,7 +19,8 @@ + powerpc-*-eabi* | \ + powerpc-*-rtems* | \ + powerpcle-*-eabisim* | \ +- powerpcle-*-eabi* ) ++ powerpcle-*-eabi* | \ ++ *-musl* ) + # IF there is no include fixing, + # THEN create a no-op fixer and exit + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target} diff --git a/package/gcc/5.3.0/902-unwind-fix-for-musl.patch b/package/gcc/5.3.0/902-unwind-fix-for-musl.patch new file mode 100644 index 0000000000..ef470540d9 --- /dev/null +++ b/package/gcc/5.3.0/902-unwind-fix-for-musl.patch @@ -0,0 +1,36 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:20:01 +0000 (+0000) +Subject: unwind fix for musl +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a2e31d0681d8a47389b8a3552622fbd9827bcef4 + +unwind fix for musl + +On behalf of szabolcs.nagy@arm.com + +2015-04-22 Gregor Richards + Szabolcs Nagy + + * unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on + Linux if target provides dl_iterate_phdr. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222328 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/libgcc/unwind-dw2-fde-dip.c +=================================================================== +--- a/libgcc/unwind-dw2-fde-dip.c ++++ b/libgcc/unwind-dw2-fde-dip.c +@@ -59,6 +59,12 @@ + + #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ + && defined(TARGET_DL_ITERATE_PHDR) \ ++ && defined(__linux__) ++# define USE_PT_GNU_EH_FRAME ++#endif ++ ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ ++ && defined(TARGET_DL_ITERATE_PHDR) \ + && (defined(__DragonFly__) || defined(__FreeBSD__)) + # define ElfW __ElfN + # define USE_PT_GNU_EH_FRAME diff --git a/package/gcc/5.3.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch b/package/gcc/5.3.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch new file mode 100644 index 0000000000..c852131258 --- /dev/null +++ b/package/gcc/5.3.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch @@ -0,0 +1,80 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:24:11 +0000 (+0000) +Subject: libstdc++, libgfortran gthr workaround for musl +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=1e5f711c11cb80ce609db9e9c1d8b2da0f7b5b61 + +libstdc++, libgfortran gthr workaround for musl + +On behalf of szabolcs.nagy@arm.com + +[libstdc++-v3/] +2015-04-22 Szabolcs Nagy + + * config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define. + * configure.host (os_include_dir): Set to "os/generic" for linux-musl*. + +[libgfortran/] +2015-04-22 Szabolcs Nagy + + * acinclude.m4 (GTHREAD_USE_WEAK): Define as 0 for *-*-musl*. + * configure: Regenerate. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222329 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/libgfortran/acinclude.m4 +=================================================================== +--- a/libgfortran/acinclude.m4 ++++ b/libgfortran/acinclude.m4 +@@ -100,7 +100,7 @@ + [Define to 1 if the target supports #pragma weak]) + fi + case "$host" in +- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) ++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* ) + AC_DEFINE(GTHREAD_USE_WEAK, 0, + [Define to 0 if the target shouldn't use #pragma weak]) + ;; +Index: b/libgfortran/configure +=================================================================== +--- a/libgfortran/configure ++++ b/libgfortran/configure +@@ -26447,7 +26447,7 @@ + + fi + case "$host" in +- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) ++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* ) + + $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h + +Index: b/libstdc++-v3/config/os/generic/os_defines.h +=================================================================== +--- a/libstdc++-v3/config/os/generic/os_defines.h ++++ b/libstdc++-v3/config/os/generic/os_defines.h +@@ -33,4 +33,9 @@ + // System-specific #define, typedefs, corrections, etc, go here. This + // file will come before all others. + ++// Disable the weak reference logic in gthr.h for os/generic because it ++// is broken on every platform unless there is implementation specific ++// workaround in gthr-posix.h and at link-time for static linking. ++#define _GLIBCXX_GTHREAD_USE_WEAK 0 ++ + #endif +Index: b/libstdc++-v3/configure.host +=================================================================== +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -271,6 +271,9 @@ + freebsd*) + os_include_dir="os/bsd/freebsd" + ;; ++ linux-musl*) ++ os_include_dir="os/generic" ++ ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + if [ "$uclibc" = "yes" ]; then + os_include_dir="os/uclibc" diff --git a/package/gcc/5.3.0/904-musl-libc-config.patch b/package/gcc/5.3.0/904-musl-libc-config.patch new file mode 100644 index 0000000000..85491406cf --- /dev/null +++ b/package/gcc/5.3.0/904-musl-libc-config.patch @@ -0,0 +1,285 @@ +From: ktkachov +Date: Fri, 8 May 2015 08:25:47 +0000 (+0000) +Subject: [PATCH 2/13] musl libc config +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a9173ceabaf29c16f8ef226fbf98af373a4b2ceb + +[PATCH 2/13] musl libc config + +2015-05-08 Gregor Richards + Szabolcs Nagy + + * config.gcc (LIBC_MUSL): New tm_defines macro. + * config/linux.h (OPTION_MUSL): Define. + (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,) + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,) + (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,) + (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,) + (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define. + * config/linux.opt (mmusl): New option. + * doc/invoke.texi (GNU/Linux Options): Document -mmusl. + * configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*. + (gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*. + * configure: Regenerate. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222904 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/gcc/config.gcc +=================================================================== +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -575,7 +575,7 @@ + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" + + # 32-bit x86 processors supported by --with-arch=. Each processor + # MUST be separated by exactly one space. +@@ -720,6 +720,9 @@ + *-*-*uclibc*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" + ;; ++ *-*-*musl*) ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" ++ ;; + *) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" + ;; +Index: b/gcc/config/linux.h +=================================================================== +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,10 +32,12 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ +@@ -50,21 +52,25 @@ + } while (0) + + /* Determine which dynamic linker to use depending on whether GLIBC or +- uClibc or Bionic is the default C library and whether +- -muclibc or -mglibc or -mbionic has been passed to change the default. */ ++ uClibc or Bionic or musl is the default C library and whether ++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change ++ the default. */ + +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" + + #if DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) + #elif DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) + #elif DEFAULT_LIBC == LIBC_BIONIC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) + #else + #error "Unsupported DEFAULT_LIBC" + #endif /* DEFAULT_LIBC */ +@@ -81,24 +87,100 @@ + #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" ++/* Should be redefined for each target that supports musl. */ ++#define MUSL_DYNAMIC_LINKER "/dev/null" ++#define MUSL_DYNAMIC_LINKER32 "/dev/null" ++#define MUSL_DYNAMIC_LINKER64 "/dev/null" ++#define MUSL_DYNAMIC_LINKERX32 "/dev/null" + + #define GNU_USER_DYNAMIC_LINKER \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ +- BIONIC_DYNAMIC_LINKER) ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + #define GNU_USER_DYNAMIC_LINKER32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ +- BIONIC_DYNAMIC_LINKER32) ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ +- BIONIC_DYNAMIC_LINKER64) ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + #define GNU_USER_DYNAMIC_LINKERX32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ +- BIONIC_DYNAMIC_LINKERX32) ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) + + /* Whether we have Bionic libc runtime */ + #undef TARGET_HAS_BIONIC + #define TARGET_HAS_BIONIC (OPTION_BIONIC) + ++/* musl avoids problematic includes by rearranging the include directories. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif ++ + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ + /* This is a *uclinux* target. We don't define below macros to normal linux + versions, because doing so would require *uclinux* targets to include +Index: b/gcc/config/linux.opt +=================================================================== +--- a/gcc/config/linux.opt ++++ b/gcc/config/linux.opt +@@ -28,5 +28,9 @@ + Use GNU C library + + muclibc +-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic) ++Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl) + Use uClibc C library ++ ++mmusl ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic) ++Use musl C library +Index: b/gcc/configure +=================================================================== +--- a/gcc/configure ++++ b/gcc/configure +@@ -27809,6 +27813,9 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +Index: b/gcc/configure.ac +=================================================================== +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -5298,6 +5302,9 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +Index: b/gcc/doc/invoke.texi +=================================================================== +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -667,7 +667,7 @@ + -mcpu=@var{cpu}} + + @emph{GNU/Linux Options} +-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol ++@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol + -tno-android-cc -tno-android-ld} + + @emph{H8/300 Options} +@@ -15324,13 +15324,19 @@ + @item -mglibc + @opindex mglibc + Use the GNU C library. This is the default except +-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. ++on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and ++@samp{*-*-linux-*android*} targets. + + @item -muclibc + @opindex muclibc + Use uClibc C library. This is the default on + @samp{*-*-linux-*uclibc*} targets. + ++@item -mmusl ++@opindex mmusl ++Use the musl C library. This is the default on ++@samp{*-*-linux-*musl*} targets. ++ + @item -mbionic + @opindex mbionic + Use Bionic C library. This is the default on diff --git a/package/gcc/5.3.0/905-add-musl-support-to-gcc.patch b/package/gcc/5.3.0/905-add-musl-support-to-gcc.patch new file mode 100644 index 0000000000..92e743685b --- /dev/null +++ b/package/gcc/5.3.0/905-add-musl-support-to-gcc.patch @@ -0,0 +1,130 @@ +From: ktkachov +Date: Fri, 8 May 2015 08:30:40 +0000 (+0000) +Subject: [PATCH 0/13] Add musl support to GCC +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=f2d678afa5b8385d763b93772d73d6bf80a9739e + +[PATCH 0/13] Add musl support to GCC + +2015-05-08 Szabolcs Nagy + + * config/glibc-stdint.h (OPTION_MUSL): Define. + (INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE): + Change the definition based on OPTION_MUSL for 64 bit targets. + * config/linux.h (OPTION_MUSL): Redefine. + * config/alpha/linux.h (OPTION_MUSL): Redefine. + * config/rs6000/linux.h (OPTION_MUSL): Redefine. + * config/rs6000/linux64.h (OPTION_MUSL): Redefine. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222905 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/gcc/config/alpha/linux.h +=================================================================== +--- a/gcc/config/alpha/linux.h ++++ b/gcc/config/alpha/linux.h +@@ -61,10 +61,14 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; +Index: b/gcc/config/glibc-stdint.h +=================================================================== +--- a/gcc/config/glibc-stdint.h ++++ b/gcc/config/glibc-stdint.h +@@ -22,6 +22,12 @@ + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++/* Systems using musl libc should use this header and make sure ++ OPTION_MUSL is defined correctly before using the TYPE macros. */ ++#ifndef OPTION_MUSL ++#define OPTION_MUSL 0 ++#endif ++ + #define SIG_ATOMIC_TYPE "int" + + #define INT8_TYPE "signed char" +@@ -43,12 +49,12 @@ + #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + + #define INT_FAST8_TYPE "signed char" +-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") ++#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") ++#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") + #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") + #define UINT_FAST8_TYPE "unsigned char" +-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") +-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") ++#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") ++#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") + #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + + #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +Index: b/gcc/config/linux.h +=================================================================== +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,11 +32,13 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL + #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL + #define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + +Index: b/gcc/config/rs6000/linux.h +=================================================================== +--- a/gcc/config/rs6000/linux.h ++++ b/gcc/config/rs6000/linux.h +@@ -30,10 +30,14 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; +Index: b/gcc/config/rs6000/linux64.h +=================================================================== +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -299,10 +299,14 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; diff --git a/package/gcc/5.3.0/906-mips-musl-support.patch b/package/gcc/5.3.0/906-mips-musl-support.patch new file mode 100644 index 0000000000..6b473f9898 --- /dev/null +++ b/package/gcc/5.3.0/906-mips-musl-support.patch @@ -0,0 +1,37 @@ +From: ktkachov +Date: Fri, 8 May 2015 15:16:50 +0000 (+0000) +Subject: [PATCH 6/13] mips musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2550b6a866c887472b587bef87d433c51cf1ebc8 + +[PATCH 6/13] mips musl support + +2015-05-08 Gregor Richards + Szabolcs Nagy + + * config/mips/linux.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERN32): Define. + (GNU_USER_DYNAMIC_LINKERN32): Update. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222915 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/gcc/config/mips/linux.h +=================================================================== +--- a/gcc/config/mips/linux.h ++++ b/gcc/config/mips/linux.h +@@ -37,7 +37,13 @@ + #define UCLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" + ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1" ++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1" ++ + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" + #define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ +- BIONIC_DYNAMIC_LINKERN32) ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32) diff --git a/package/gcc/5.3.0/907-x86-musl-support.patch b/package/gcc/5.3.0/907-x86-musl-support.patch new file mode 100644 index 0000000000..3f2fe5df77 --- /dev/null +++ b/package/gcc/5.3.0/907-x86-musl-support.patch @@ -0,0 +1,45 @@ +From: ktkachov +Date: Fri, 15 May 2015 13:20:01 +0000 (+0000) +Subject: [PATCH 9/13] x86 musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=5551c8d927c17f60837f15f8dfe46f945ba3fa9c + +[PATCH 9/13] x86 musl support + +On behalf of Szabolcs Nagy. + +2015-05-15 Gregor Richards + + * config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define. + * config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223218 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/gcc/config/i386/linux.h +=================================================================== +--- a/gcc/config/i386/linux.h ++++ b/gcc/config/i386/linux.h +@@ -21,3 +21,6 @@ + + #define GNU_USER_LINK_EMULATION "elf_i386" + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" +Index: b/gcc/config/i386/linux64.h +=================================================================== +--- a/gcc/config/i386/linux64.h ++++ b/gcc/config/i386/linux64.h +@@ -30,3 +30,10 @@ + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" ++#undef MUSL_DYNAMIC_LINKERX32 ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" diff --git a/package/gcc/5.3.0/908-arm-musl-support.patch b/package/gcc/5.3.0/908-arm-musl-support.patch new file mode 100644 index 0000000000..906355a79a --- /dev/null +++ b/package/gcc/5.3.0/908-arm-musl-support.patch @@ -0,0 +1,45 @@ +From: ktkachov +Date: Wed, 27 May 2015 13:17:11 +0000 (+0000) +Subject: [PATCH 4/13] arm musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=de799bd087ab9a179768fea75bd195a31d3432a4 + +[PATCH 4/13] arm musl support + +On behalf of szabolcs.nagy@arm.com + +2015-05-27 Gregor Richards + + * config/arm/linux-eabi.h (MUSL_DYNAMIC_LINKER): Define. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223749 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/gcc/config/arm/linux-eabi.h +=================================================================== +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -77,6 +77,23 @@ + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" + ++/* For ARM musl currently supports four dynamic linkers: ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB ++ musl does not support the legacy OABI mode. ++ All the dynamic linkers live in /lib. ++ We default to soft-float, EL. */ ++#undef MUSL_DYNAMIC_LINKER ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" ++#endif ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC diff --git a/package/gcc/5.3.0/909-aarch64-musl-support.patch b/package/gcc/5.3.0/909-aarch64-musl-support.patch new file mode 100644 index 0000000000..3d032f51bc --- /dev/null +++ b/package/gcc/5.3.0/909-aarch64-musl-support.patch @@ -0,0 +1,33 @@ +From: jgreenhalgh +Date: Wed, 27 May 2015 16:46:39 +0000 (+0000) +Subject: [PATCH 3/13] aarch64 musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=b3ff21cf0531be91bc3fb8200296a7633090ec78 + +[PATCH 3/13] aarch64 musl support + +gcc/Changelog: + +2015-05-27 Gregor Richards + Szabolcs Nagy + + * config/aarch64/aarch64-linux.h (MUSL_DYNAMIC_LINKER): Define. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223766 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +Index: b/gcc/config/aarch64/aarch64-linux.h +=================================================================== +--- a/gcc/config/aarch64/aarch64-linux.h ++++ b/gcc/config/aarch64/aarch64-linux.h +@@ -23,6 +23,9 @@ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++ + #undef ASAN_CC1_SPEC + #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" + diff --git a/package/gcc/5.3.0/930-libgcc-disable-split-stack-nothreads.patch b/package/gcc/5.3.0/930-libgcc-disable-split-stack-nothreads.patch new file mode 100644 index 0000000000..07f9a7395b --- /dev/null +++ b/package/gcc/5.3.0/930-libgcc-disable-split-stack-nothreads.patch @@ -0,0 +1,14 @@ +disable split-stack for non-thread builds + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-5.3.0.orig/libgcc/config/t-stack gcc-5.3.0/libgcc/config/t-stack +--- gcc-5.3.0.orig/libgcc/config/t-stack 2010-10-01 21:31:49.000000000 +0200 ++++ gcc-5.3.0/libgcc/config/t-stack 2016-03-07 03:25:32.000000000 +0100 +@@ -1,4 +1,6 @@ + # Makefile fragment to provide generic support for -fsplit-stack. + # This should be used in config.host for any host which supports + # -fsplit-stack. ++ifeq ($(enable_threads),yes) + LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c ++endif diff --git a/package/gcc/6.1.0/100-uclibc-conf.patch b/package/gcc/6.1.0/100-uclibc-conf.patch new file mode 100644 index 0000000000..73d1f0d3a9 --- /dev/null +++ b/package/gcc/6.1.0/100-uclibc-conf.patch @@ -0,0 +1,15 @@ +Index: b/contrib/regression/objs-gcc.sh +=================================================================== +--- a/contrib/regression/objs-gcc.sh ++++ b/contrib/regression/objs-gcc.sh +@@ -106,6 +106,10 @@ + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 diff --git a/package/gcc/6.1.0/301-missing-execinfo_h.patch b/package/gcc/6.1.0/301-missing-execinfo_h.patch new file mode 100644 index 0000000000..2d0e7baa44 --- /dev/null +++ b/package/gcc/6.1.0/301-missing-execinfo_h.patch @@ -0,0 +1,13 @@ +Index: b/boehm-gc/include/gc.h +=================================================================== +--- a/boehm-gc/include/gc.h ++++ b/boehm-gc/include/gc.h +@@ -503,7 +503,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/package/gcc/6.1.0/810-arm-softfloat-libgcc.patch b/package/gcc/6.1.0/810-arm-softfloat-libgcc.patch new file mode 100644 index 0000000000..5efa7fd1bc --- /dev/null +++ b/package/gcc/6.1.0/810-arm-softfloat-libgcc.patch @@ -0,0 +1,30 @@ +Index: b/gcc/config/arm/linux-elf.h +=================================================================== +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -60,7 +60,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +Index: b/libgcc/config/arm/t-linux +=================================================================== +--- a/libgcc/config/arm/t-linux ++++ b/libgcc/config/arm/t-linux +@@ -1,6 +1,11 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. diff --git a/package/gcc/6.1.0/830-arm_unbreak_armv4t.patch b/package/gcc/6.1.0/830-arm_unbreak_armv4t.patch new file mode 100644 index 0000000000..b730059183 --- /dev/null +++ b/package/gcc/6.1.0/830-arm_unbreak_armv4t.patch @@ -0,0 +1,15 @@ +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html + +Index: b/gcc/config/arm/linux-eabi.h +=================================================================== +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + /* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ diff --git a/package/gcc/6.1.0/860-cilk-wchar.patch b/package/gcc/6.1.0/860-cilk-wchar.patch new file mode 100644 index 0000000000..1d9916f554 --- /dev/null +++ b/package/gcc/6.1.0/860-cilk-wchar.patch @@ -0,0 +1,56 @@ +[PATCH] cilk: fix build without wchar + +When building against uClibc with wchar support disabled, WCHAR_MIN and +WCHAR_MAX are not defined leading to compilation errors. + +Fix it by only including the wchar code if available. + +Signed-off-by: Peter Korsgaard +--- + libcilkrts/include/cilk/reducer_min_max.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Index: b/libcilkrts/include/cilk/reducer_min_max.h +=================================================================== +--- a/libcilkrts/include/cilk/reducer_min_max.h ++++ b/libcilkrts/include/cilk/reducer_min_max.h +@@ -3154,7 +3154,9 @@ + CILK_C_REDUCER_MAX_INSTANCE(char, char, CHAR_MIN) + CILK_C_REDUCER_MAX_INSTANCE(unsigned char, uchar, 0) + CILK_C_REDUCER_MAX_INSTANCE(signed char, schar, SCHAR_MIN) ++#ifdef WCHAR_MIN + CILK_C_REDUCER_MAX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN) ++#endif + CILK_C_REDUCER_MAX_INSTANCE(short, short, SHRT_MIN) + CILK_C_REDUCER_MAX_INSTANCE(unsigned short, ushort, 0) + CILK_C_REDUCER_MAX_INSTANCE(int, int, INT_MIN) +@@ -3306,7 +3308,9 @@ + CILK_C_REDUCER_MAX_INDEX_INSTANCE(char, char, CHAR_MIN) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned char, uchar, 0) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(signed char, schar, SCHAR_MIN) ++#ifdef WCHAR_MIN + CILK_C_REDUCER_MAX_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN) ++#endif + CILK_C_REDUCER_MAX_INDEX_INSTANCE(short, short, SHRT_MIN) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned short, ushort, 0) + CILK_C_REDUCER_MAX_INDEX_INSTANCE(int, int, INT_MIN) +@@ -3432,7 +3436,9 @@ + CILK_C_REDUCER_MIN_INSTANCE(char, char, CHAR_MAX) + CILK_C_REDUCER_MIN_INSTANCE(unsigned char, uchar, CHAR_MAX) + CILK_C_REDUCER_MIN_INSTANCE(signed char, schar, SCHAR_MAX) ++#ifdef WCHAR_MAX + CILK_C_REDUCER_MIN_INSTANCE(wchar_t, wchar_t, WCHAR_MAX) ++#endif + CILK_C_REDUCER_MIN_INSTANCE(short, short, SHRT_MAX) + CILK_C_REDUCER_MIN_INSTANCE(unsigned short, ushort, USHRT_MAX) + CILK_C_REDUCER_MIN_INSTANCE(int, int, INT_MAX) +@@ -3584,7 +3590,9 @@ + CILK_C_REDUCER_MIN_INDEX_INSTANCE(char, char, CHAR_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned char, uchar, CHAR_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(signed char, schar, SCHAR_MAX) ++#ifdef WCHAR_MAX + CILK_C_REDUCER_MIN_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MAX) ++#endif + CILK_C_REDUCER_MIN_INDEX_INSTANCE(short, short, SHRT_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned short, ushort, USHRT_MAX) + CILK_C_REDUCER_MIN_INDEX_INSTANCE(int, int, INT_MAX) diff --git a/package/gcc/6.1.0/890-fix-m68k-compile.patch b/package/gcc/6.1.0/890-fix-m68k-compile.patch new file mode 100644 index 0000000000..6e63de0cd1 --- /dev/null +++ b/package/gcc/6.1.0/890-fix-m68k-compile.patch @@ -0,0 +1,15 @@ +remove unused header, which breaks the toolchain building + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c gcc-5.3.0/libgcc/config/m68k/linux-atomic.c +--- gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c 2015-01-05 13:33:28.000000000 +0100 ++++ gcc-5.3.0/libgcc/config/m68k/linux-atomic.c 2016-03-19 09:25:07.000000000 +0100 +@@ -33,7 +33,6 @@ + using the kernel helper defined below. There is no support for + 64-bit operations yet. */ + +-#include + #include + + #ifndef __NR_atomic_cmpxchg_32 diff --git a/package/gcc/6.1.0/891-fix-m68k-uclinux.patch b/package/gcc/6.1.0/891-fix-m68k-uclinux.patch new file mode 100644 index 0000000000..754aa74e88 --- /dev/null +++ b/package/gcc/6.1.0/891-fix-m68k-uclinux.patch @@ -0,0 +1,18 @@ +avoids internal compiler error while compiling linux-atomic.c +See here: +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833 + +Signed-off-by: Waldemar Brodkorb + +diff -Nur gcc-6.1.0.orig/libgcc/config.host gcc-6.1.0/libgcc/config.host +--- gcc-6.1.0.orig/libgcc/config.host 2016-02-26 21:02:28.000000000 +0100 ++++ gcc-6.1.0/libgcc/config.host 2016-04-29 09:18:40.377989160 +0200 +@@ -812,7 +812,7 @@ + m68k*-*-openbsd*) + ;; + m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux with uClibc +- tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux" ++ tmake_file="$tmake_file m68k/t-floatlib" + md_unwind_header=m68k/linux-unwind.h + ;; + m68k-*-linux*) # Motorola m68k's running GNU/Linux diff --git a/package/gcc/arc-2015.12/100-libstdcxx-uclibc-c99.patch b/package/gcc/arc-2015.12/100-libstdcxx-uclibc-c99.patch new file mode 100644 index 0000000000..0d02ef0fb6 --- /dev/null +++ b/package/gcc/arc-2015.12/100-libstdcxx-uclibc-c99.patch @@ -0,0 +1,273 @@ +Allow C99-depending features of libstdc++ with uClibc + +The libstdc++ code is fairly restrictive on how it checks for C99 +compatibility: it requires *complete* C99 support to enable certain +features. For example, uClibc provides a good number of C99 features, +but not C99 complex number support. For this reason, libstdc++ +completely disables many the standard C++ methods that can in fact +work because uClibc provides the necessary functions. + +This patch is similar and highly inspired from +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in +a way that doesn't involve changing the configure.ac script, as +autoreconfiguring gcc is complicated. It simply relies on the fact +that uClibc defines the __UCLIBC__ definition. + +Signed-off-by: Thomas Petazzoni + +Index: b/libstdc++-v3/config/locale/generic/c_locale.h +=================================================================== +--- a/libstdc++-v3/config/locale/generic/c_locale.h ++++ b/libstdc++-v3/config/locale/generic/c_locale.h +@@ -70,7 +70,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +Index: b/libstdc++-v3/config/locale/gnu/c_locale.h +=================================================================== +--- a/libstdc++-v3/config/locale/gnu/c_locale.h ++++ b/libstdc++-v3/config/locale/gnu/c_locale.h +@@ -88,7 +88,7 @@ + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); + #else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +Index: b/libstdc++-v3/include/bits/basic_string.h +=================================================================== +--- a/libstdc++-v3/include/bits/basic_string.h ++++ b/libstdc++-v3/include/bits/basic_string.h +@@ -2811,7 +2811,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ ++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + + #include +Index: b/libstdc++-v3/include/bits/locale_facets.tcc +=================================================================== +--- a/libstdc++-v3/include/bits/locale_facets.tcc ++++ b/libstdc++-v3/include/bits/locale_facets.tcc +@@ -987,7 +987,7 @@ + char __fbuf[16]; + __num_base::_S_format_float(__io, __fbuf, __mod); + +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough (most probably sufficient + // for non-ios_base::fixed outputs) + int __cs_size = __max_digits * 3; +Index: b/libstdc++-v3/include/bits/locale_facets_nonio.tcc +=================================================================== +--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc ++++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc +@@ -572,7 +572,7 @@ + { + const locale __loc = __io.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + // First try a buffer perhaps big enough. + int __cs_size = 64; + char* __cs = static_cast(__builtin_alloca(__cs_size)); +Index: b/libstdc++-v3/include/c_compatibility/math.h +=================================================================== +--- a/libstdc++-v3/include/c_compatibility/math.h ++++ b/libstdc++-v3/include/c_compatibility/math.h +@@ -56,7 +56,7 @@ + using std::floor; + using std::fmod; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::fpclassify; + using std::isfinite; + using std::isinf; +Index: b/libstdc++-v3/include/c_compatibility/wchar.h +=================================================================== +--- a/libstdc++-v3/include/c_compatibility/wchar.h ++++ b/libstdc++-v3/include/c_compatibility/wchar.h +@@ -103,7 +103,7 @@ + using std::wmemset; + using std::wcsftime; + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/c_global/cstdlib +=================================================================== +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -182,7 +182,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +Index: b/libstdc++-v3/include/c_global/cwchar +=================================================================== +--- a/libstdc++-v3/include/c_global/cwchar ++++ b/libstdc++-v3/include/c_global/cwchar +@@ -232,7 +232,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +@@ -289,7 +289,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/c_std/cstdio +=================================================================== +--- a/libstdc++-v3/include/c_std/cstdio ++++ b/libstdc++-v3/include/c_std/cstdio +@@ -139,7 +139,7 @@ + using ::vsprintf; + } // namespace std + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf +Index: b/libstdc++-v3/include/c_std/cstdlib +=================================================================== +--- a/libstdc++-v3/include/c_std/cstdlib ++++ b/libstdc++-v3/include/c_std/cstdlib +@@ -180,7 +180,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef _Exit + #undef llabs +Index: b/libstdc++-v3/include/c_std/cwchar +=================================================================== +--- a/libstdc++-v3/include/c_std/cwchar ++++ b/libstdc++-v3/include/c_std/cwchar +@@ -228,7 +228,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef wcstold + #undef wcstoll +Index: b/libstdc++-v3/include/ext/vstring.h +=================================================================== +--- a/libstdc++-v3/include/ext/vstring.h ++++ b/libstdc++-v3/include/ext/vstring.h +@@ -2571,7 +2571,7 @@ + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace + +-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99)) ++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))) + + #include + +Index: b/libstdc++-v3/include/tr1/cstdio +=================================================================== +--- a/libstdc++-v3/include/tr1/cstdio ++++ b/libstdc++-v3/include/tr1/cstdio +@@ -33,7 +33,7 @@ + + #include + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +Index: b/libstdc++-v3/include/tr1/cstdlib +=================================================================== +--- a/libstdc++-v3/include/tr1/cstdlib ++++ b/libstdc++-v3/include/tr1/cstdlib +@@ -35,7 +35,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + namespace std _GLIBCXX_VISIBILITY(default) + { +Index: b/libstdc++-v3/include/tr1/cwchar +=================================================================== +--- a/libstdc++-v3/include/tr1/cwchar ++++ b/libstdc++-v3/include/tr1/cwchar +@@ -52,7 +52,7 @@ + using std::vwscanf; + #endif + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +Index: b/libstdc++-v3/include/tr1/stdlib.h +=================================================================== +--- a/libstdc++-v3/include/tr1/stdlib.h ++++ b/libstdc++-v3/include/tr1/stdlib.h +@@ -33,7 +33,7 @@ + + #if _GLIBCXX_HOSTED + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + using std::tr1::atoll; + using std::tr1::strtoll; +Index: b/libstdc++-v3/src/c++11/debug.cc +=================================================================== +--- a/libstdc++-v3/src/c++11/debug.cc ++++ b/libstdc++-v3/src/c++11/debug.cc +@@ -787,7 +787,7 @@ + int __n __attribute__ ((__unused__)), + const char* __fmt, _Tp __s) const throw () + { +-#ifdef _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + std::snprintf(__buf, __n, __fmt, __s); + #else + std::sprintf(__buf, __fmt, __s); +Index: b/libstdc++-v3/include/c_global/cstdio +=================================================================== +--- a/libstdc++-v3/include/c_global/cstdio ++++ b/libstdc++-v3/include/c_global/cstdio +@@ -138,7 +138,7 @@ + using ::vsprintf; + } // namespace + +-#if _GLIBCXX_USE_C99 ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/package/gcc/arc-2015.12/851-PR-other-56780.patch b/package/gcc/arc-2015.12/851-PR-other-56780.patch new file mode 100644 index 0000000000..feb433920d --- /dev/null +++ b/package/gcc/arc-2015.12/851-PR-other-56780.patch @@ -0,0 +1,244 @@ +From afe990251bd9b3a063f03da31a3b8d139d033bc3 Mon Sep 17 00:00:00 2001 +From: ian +Date: Sat, 1 Jun 2013 00:20:49 +0000 +Subject: [PATCH] PR other/56780 + +* libiberty/configure.ac: Move test for --enable-install-libiberty +outside of the 'with_target_subdir' test so that it actually gets +run. Add output messages to show the test result. +* libiberty/configure: Regenerate. +* libiberty/Makefile.in (install_to_libdir): Place the +installation of the libiberty library in the same guard as that +used for the headers to prevent it being installed unless +requested via --enable-install-libiberty. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199570 138bc75d-0d04-0410-961f-82ee72b054a4 + +libiberty: fix --enable-install-libiberty flag [PR 56780] + +Commit 199570 fixed the --disable-install-libiberty behavior, but it also +added a bug where the enable path never works because the initial clear +of target_header_dir wasn't deleted. So we end up initializing properly +at the top only to reset it at the end all the time. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206367 138bc75d-0d04-0410-961f-82ee72b054a4 + +[Romain + squash the two upstream commits + Remove the ChangeLog] +Signed-off-by: Romain Naour +--- + libiberty/Makefile.in | 24 ++++++++++----------- + libiberty/configure | 57 +++++++++++++++++++++++++++----------------------- + libiberty/configure.ac | 47 ++++++++++++++++++++++------------------- + 3 files changed, 68 insertions(+), 60 deletions(-) + +diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in +index f6a3ebd..75ff82d 100644 +--- a/libiberty/Makefile.in ++++ b/libiberty/Makefile.in +@@ -355,19 +355,19 @@ install-strip: install + # since it will be passed the multilib flags. + MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` + install_to_libdir: all +- ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR) +- $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n +- ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ) +- mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB) + if test -n "${target_header_dir}"; then \ +- case "${target_header_dir}" in \ +- /*) thd=${target_header_dir};; \ +- *) thd=${includedir}/${target_header_dir};; \ +- esac; \ +- ${mkinstalldirs} $(DESTDIR)$${thd}; \ +- for h in ${INSTALLED_HEADERS}; do \ +- ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ +- done; \ ++ ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \ ++ $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n; \ ++ ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ); \ ++ mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB); \ ++ case "${target_header_dir}" in \ ++ /*) thd=${target_header_dir};; \ ++ *) thd=${includedir}/${target_header_dir};; \ ++ esac; \ ++ ${mkinstalldirs} $(DESTDIR)$${thd}; \ ++ for h in ${INSTALLED_HEADERS}; do \ ++ ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ ++ done; \ + fi + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install + +diff --git a/libiberty/configure b/libiberty/configure +index 5367027..4feb95a 100755 +--- a/libiberty/configure ++++ b/libiberty/configure +@@ -675,8 +675,8 @@ with_cross_host + with_newlib + enable_maintainer_mode + enable_multilib +-enable_largefile + enable_install_libiberty ++enable_largefile + ' + ac_precious_vars='build_alias + host_alias +@@ -1303,8 +1303,8 @@ Optional Features: + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-multilib build many library versions (default) ++ --enable-install-libiberty Install headers and library for end users + --disable-largefile omit support for large files +- --enable-install-libiberty Install headers for end users + + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +@@ -2784,6 +2784,35 @@ if test $cross_compiling = no && test $multilib = yes \ + cross_compiling=maybe + fi + ++# We may wish to install the target headers somewhere. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install libiberty headers and static library" >&5 ++$as_echo_n "checking whether to install libiberty headers and static library... " >&6; } ++ ++# Check whether --enable-install-libiberty was given. ++if test "${enable_install_libiberty+set}" = set; then : ++ enableval=$enable_install_libiberty; enable_install_libiberty=$enableval ++else ++ enable_install_libiberty=no ++fi ++ ++# Option parsed, now set things appropriately. ++case x"$enable_install_libiberty" in ++ xyes|x) ++ target_header_dir=libiberty ++ ;; ++ xno) ++ target_header_dir= ++ ;; ++ *) ++ # This could be sanity-checked in various ways... ++ target_header_dir="${enable_install_libiberty}" ++ ;; ++esac ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_install_libiberty" >&5 ++$as_echo "$enable_install_libiberty" >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: target_header_dir = $target_header_dir" >&5 ++$as_echo "$as_me: target_header_dir = $target_header_dir" >&6;} ++ + + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' +@@ -5476,7 +5505,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +@@ -5759,29 +5787,6 @@ _ACEOF + + esac + +- # We may wish to install the target headers somewhere. +- # Check whether --enable-install-libiberty was given. +-if test "${enable_install_libiberty+set}" = set; then : +- enableval=$enable_install_libiberty; enable_install_libiberty=$enableval +-else +- enable_install_libiberty=no +-fi +- +- # Option parsed, now set things appropriately. +- case x"$enable_install_libiberty" in +- xyes|x) +- target_header_dir=libiberty +- ;; +- xno) +- target_header_dir= +- ;; +- *) +- # This could be sanity-checked in various ways... +- target_header_dir="${enable_install_libiberty}" +- ;; +- esac +- +- + else + + # Not a target library, so we set things up to run the test suite. +diff --git a/libiberty/configure.ac b/libiberty/configure.ac +index c763894..f17e6b6 100644 +--- a/libiberty/configure.ac ++++ b/libiberty/configure.ac +@@ -128,6 +128,31 @@ if test $cross_compiling = no && test $multilib = yes \ + cross_compiling=maybe + fi + ++# We may wish to install the target headers somewhere. ++AC_MSG_CHECKING([whether to install libiberty headers and static library]) ++dnl install-libiberty is disabled by default ++ ++AC_ARG_ENABLE(install-libiberty, ++[ --enable-install-libiberty Install headers and library for end users], ++enable_install_libiberty=$enableval, ++enable_install_libiberty=no)dnl ++ ++# Option parsed, now set things appropriately. ++case x"$enable_install_libiberty" in ++ xyes|x) ++ target_header_dir=libiberty ++ ;; ++ xno) ++ target_header_dir= ++ ;; ++ *) ++ # This could be sanity-checked in various ways... ++ target_header_dir="${enable_install_libiberty}" ++ ;; ++esac ++AC_MSG_RESULT($enable_install_libiberty) ++AC_MSG_NOTICE([target_header_dir = $target_header_dir]) ++ + GCC_NO_EXECUTABLES + AC_PROG_CC + AC_SYS_LARGEFILE +@@ -380,7 +405,6 @@ fi + + setobjs= + CHECK= +-target_header_dir= + if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS +@@ -492,27 +516,6 @@ if test -n "${with_target_subdir}"; then + + esac + +- # We may wish to install the target headers somewhere. +- AC_ARG_ENABLE(install-libiberty, +- [ --enable-install-libiberty Install headers for end users], +- enable_install_libiberty=$enableval, +- enable_install_libiberty=no)dnl +- +- # Option parsed, now set things appropriately. +- case x"$enable_install_libiberty" in +- xyes|x) +- target_header_dir=libiberty +- ;; +- xno) +- target_header_dir= +- ;; +- *) +- # This could be sanity-checked in various ways... +- target_header_dir="${enable_install_libiberty}" +- ;; +- esac +- +- + else + + # Not a target library, so we set things up to run the test suite. +-- +1.9.3 + diff --git a/package/gcc/arc-2015.12/900-UPDATE-Fix-handling-complex-PIC-moves.patch b/package/gcc/arc-2015.12/900-UPDATE-Fix-handling-complex-PIC-moves.patch new file mode 100644 index 0000000000..48228dcb6f --- /dev/null +++ b/package/gcc/arc-2015.12/900-UPDATE-Fix-handling-complex-PIC-moves.patch @@ -0,0 +1,103 @@ +From b55922d45fd16f5e8fc7c3885da42b2b9b37754d Mon Sep 17 00:00:00 2001 +From: Claudiu Zissulescu +Date: Mon, 18 Jan 2016 16:43:18 +0100 +Subject: [PATCH] UPDATE: Fix handling complex PIC moves. + +fwprop is putting in the REG_EQUIV notes which are involving the +constant pic unspecs. Then, loop may use those notes for +optimizations rezulting in complex patterns that are not supported by +the current implementation. The following piece of code tries to +convert the complex instruction in simpler ones. + +The fix is done in development tree: [arc-4.8-dev b55922d] +and will be a part of the next release of ARC GNU tools. +Once that new release happens this patch must be removed. + + +gcc/ +2016-01-18 Claudiu Zissulescu + + * config/arc/arc.c (arc_legitimize_pic_address): Handle MINUS + operations when doing PIC moves. Make this function static. + (arc_legitimate_pc_offset_p): Use + arc_raw_symbolic_reference_mentioned_p. + * config/arc/arc-protos.h (arc_legitimize_pic_address): Remove. + + gcc/config/arc/arc-protos.h | 1 - + gcc/config/arc/arc.c | 33 +++++++++++++++++++-------------- + 2 files changed, 19 insertions(+), 15 deletions(-) + + * config/arc/arc.c (arc_legitimize_pic_address): Handle complex +diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h +index 464e0ab..5986e06 100644 +--- a/gcc/config/arc/arc-protos.h ++++ b/gcc/config/arc/arc-protos.h +@@ -53,7 +53,6 @@ extern unsigned int arc_compute_frame_size (); + extern bool arc_ccfsm_branch_deleted_p (void); + extern void arc_ccfsm_record_branch_deleted (void); + +-extern rtx arc_legitimize_pic_address (rtx, rtx); + void arc_asm_output_aligned_decl_local (FILE *, tree, const char *, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, +diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c +index a89c8ee..f7cae9f 100644 +--- a/gcc/config/arc/arc.c ++++ b/gcc/config/arc/arc.c +@@ -5243,19 +5243,7 @@ arc_legitimate_pc_offset_p (rtx addr) + if (GET_CODE (addr) != CONST) + return false; + addr = XEXP (addr, 0); +- if (GET_CODE (addr) == PLUS) +- { +- if (GET_CODE (XEXP (addr, 1)) != CONST_INT) +- return false; +- addr = XEXP (addr, 0); +- } +- return (GET_CODE (addr) == UNSPEC +- && XVECLEN (addr, 0) == 1 +- && (XINT (addr, 1) == ARC_UNSPEC_GOT +- || XINT (addr, 1) == ARC_UNSPEC_GOTOFFPC +- || XINT (addr, 1) == UNSPEC_TLS_GD +- || XINT (addr, 1) == UNSPEC_TLS_IE) +- && GET_CODE (XVECEXP (addr, 0, 0)) == SYMBOL_REF); ++ return flag_pic && !arc_raw_symbolic_reference_mentioned_p (addr, false); + } + + /* Return true if ADDR is a valid pic address. +@@ -5522,7 +5510,7 @@ arc_legitimize_tls_address (rtx addr, enum tls_model model) + The return value is the legitimated address. + If OLDX is non-zero, it is the target to assign the address to first. */ + +-rtx ++static rtx + arc_legitimize_pic_address (rtx orig, rtx oldx) + { + rtx addr = orig; +@@ -5569,6 +5557,23 @@ arc_legitimize_pic_address (rtx orig, rtx oldx) + /* Check that the unspec is one of the ones we generate? */ + return orig; + } ++ else if (GET_CODE (addr) == MINUS) ++ { ++ /* The same story with fwprop. */ ++ rtx op0 = XEXP (addr, 0); ++ rtx op1 = XEXP (addr, 1); ++ gcc_assert (oldx); ++ gcc_assert (GET_CODE (op1) == UNSPEC); ++ ++ emit_move_insn (oldx, ++ gen_rtx_CONST (SImode, ++ arc_legitimize_pic_address (op1, ++ NULL_RTX))); ++ emit_insn (gen_rtx_SET (VOIDmode, oldx, ++ gen_rtx_MINUS (SImode, op0, oldx))); ++ return oldx; ++ ++ } + else if (GET_CODE (addr) != PLUS) + { + /* fwprop is putting in the REG_EQUIV notes which are +-- +2.5.0 + diff --git a/package/gcc/arc-2015.12/901-UPDATE1-Fix-handling-complex-PIC-moves.patch b/package/gcc/arc-2015.12/901-UPDATE1-Fix-handling-complex-PIC-moves.patch new file mode 100644 index 0000000000..28cb7c1913 --- /dev/null +++ b/package/gcc/arc-2015.12/901-UPDATE1-Fix-handling-complex-PIC-moves.patch @@ -0,0 +1,83 @@ +From f00b0f17d6889d811468c2c77508fbea8bfc377d Mon Sep 17 00:00:00 2001 +From: Claudiu Zissulescu +Date: Tue, 19 Jan 2016 14:40:16 +0100 +Subject: [PATCH] UPDATE1: Fix handling complex PIC moves. + +The arc_legitimate_pc_offset_p condition is too lax. Updated it. + +The fix is done in development tree: [arc-4.8-dev f00b0f1] +and will be a part of the next release of ARC GNU tools. +Once that new release happens this patch must be removed. + +gcc/ +2016-01-18 Claudiu Zissulescu + + * config/arc/arc.c (arc_needs_pcl_p ): New function + (arc_legitimate_pc_offset_p): Use arc_needs_pcl_p. +--- + gcc/config/arc/arc.c | 42 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 40 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c +index f7cae9f..18d88a3 100644 +--- a/gcc/config/arc/arc.c ++++ b/gcc/config/arc/arc.c +@@ -5234,6 +5234,45 @@ arc_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED, + } + } + ++/* Helper used by arc_legitimate_pc_offset_p. */ ++ ++static bool ++arc_needs_pcl_p (rtx x) ++{ ++ register const char *fmt; ++ register int i, j; ++ ++ if ((GET_CODE (x) == UNSPEC) ++ && (XVECLEN (x, 0) == 1) ++ && (GET_CODE (XVECEXP (x, 0, 0)) == SYMBOL_REF)) ++ switch (XINT (x, 1)) ++ { ++ case ARC_UNSPEC_GOT: ++ case ARC_UNSPEC_GOTOFFPC: ++ case UNSPEC_TLS_GD: ++ case UNSPEC_TLS_IE: ++ return true; ++ default: ++ break; ++ } ++ ++ fmt = GET_RTX_FORMAT (GET_CODE (x)); ++ for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) ++ { ++ if (fmt[i] == 'e') ++ { ++ if (arc_needs_pcl_p (XEXP (x, i))) ++ return true; ++ } ++ else if (fmt[i] == 'E') ++ for (j = XVECLEN (x, i) - 1; j >= 0; j--) ++ if (arc_needs_pcl_p (XVECEXP (x, i, j))) ++ return true; ++ } ++ ++ return false; ++} ++ + /* Return true if ADDR is an address that needs to be expressed as an + explicit sum of pcl + offset. */ + +@@ -5242,8 +5281,7 @@ arc_legitimate_pc_offset_p (rtx addr) + { + if (GET_CODE (addr) != CONST) + return false; +- addr = XEXP (addr, 0); +- return flag_pic && !arc_raw_symbolic_reference_mentioned_p (addr, false); ++ return arc_needs_pcl_p (addr); + } + + /* Return true if ADDR is a valid pic address. +-- +2.5.0 + diff --git a/package/gcc/arc-2015.12/950-Don-t-allow-mcompact-casesi-for-ARCv2.patch b/package/gcc/arc-2015.12/950-Don-t-allow-mcompact-casesi-for-ARCv2.patch new file mode 100644 index 0000000000..dc03a028ed --- /dev/null +++ b/package/gcc/arc-2015.12/950-Don-t-allow-mcompact-casesi-for-ARCv2.patch @@ -0,0 +1,100 @@ +From 09463827001a7b8094f4b9460514370a1876d908 Mon Sep 17 00:00:00 2001 +From: Claudiu Zissulescu +Date: Wed, 20 Jan 2016 16:32:40 +0100 +Subject: [PATCH] Don't allow mcompact-casesi for ARCv2 + +The compact casesi is not working for arcv2 processors family as it +makes use of the add_s rx,rx,pcl instruction which is only valid for +arc6xx and arc700 processors. Also not having this instruction makes +no much sens to change the compact-casesi pattern to use normal add +instructions as it nullifies the advantage of short instruction use. +The default casesi pattern betters suits the arcv2 architecture. + +The fix is done in development tree: [arc-4.8-dev 0946382] +and will be a part of the next release of ARC GNU tools. +Once that new release happens this patch must be removed. + +gcc/ +2016-01-20 Claudiu Zissulescu + + * common/config/arc/arc-common.c (arc_option_optimization_table): + Remove mcompact-casesi option. + * config/arc/arc.c (arc_override_options): Use compact-casesi only + for arcv1. + * config/arc/arc.md (casesi_load): Use short instructions. +--- + gcc/common/config/arc/arc-common.c | 1 - + gcc/config/arc/arc.c | 9 +++++---- + gcc/config/arc/arc.md | 10 ++++++++-- + 3 files changed, 13 insertions(+), 7 deletions(-) + + * config/arc/arc.c (arc_legitimize_pic_address): Handle MINUS +diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c +index e2e36fa..310bc80 100644 +--- a/gcc/common/config/arc/arc-common.c ++++ b/gcc/common/config/arc/arc-common.c +@@ -58,7 +58,6 @@ static const struct default_options arc_option_optimization_table[] = + { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 }, + { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 }, + { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 }, +- { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + +diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c +index 18d88a3..f828398 100644 +--- a/gcc/config/arc/arc.c ++++ b/gcc/config/arc/arc.c +@@ -1151,6 +1151,11 @@ arc_override_options (void) + if (arc_size_opt_level == 3) + optimize_size = 1; + ++ if (TARGET_V2) ++ TARGET_COMPACT_CASESI = 0; ++ else if (optimize_size == 1) ++ TARGET_COMPACT_CASESI = 1; ++ + if (flag_pic) + target_flags |= MASK_NO_SDATA_SET; + +@@ -1163,10 +1168,6 @@ arc_override_options (void) + if (!TARGET_Q_CLASS) + TARGET_COMPACT_CASESI = 0; + +- /* For the time being don't support COMPACT_CASESI for ARCv2. */ +- if (TARGET_V2) +- TARGET_COMPACT_CASESI = 0; +- + if (TARGET_COMPACT_CASESI) + TARGET_CASE_VECTOR_PC_RELATIVE = 1; + +diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md +index bc4ac38..ba7c8bc 100644 +--- a/gcc/config/arc/arc.md ++++ b/gcc/config/arc/arc.md +@@ -3837,14 +3837,20 @@ + switch (GET_MODE (diff_vec)) + { + case SImode: +- return \"ld.as %0,[%1,%2]%&\"; ++ if ((which_alternative == 0) && TARGET_CODE_DENSITY) ++ return \"ld_s.as %0,[%1,%2]%&\"; ++ else ++ return \"ld.as %0,[%1,%2]%&\"; + case HImode: + if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) + return \"ldw.as %0,[%1,%2]\"; + return \"ldw.x.as %0,[%1,%2]\"; + case QImode: + if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) +- return \"ldb%? %0,[%1,%2]%&\"; ++ if (which_alternative == 0) ++ return \"ldb_s %0,[%1,%2]%&\"; ++ else ++ return \"ldb %0,[%1,%2]%&\"; + return \"ldb.x %0,[%1,%2]\"; + default: + gcc_unreachable (); +-- +2.5.0 + diff --git a/package/gd/0002-no-zlib.patch b/package/gd/0002-no-zlib.patch new file mode 100644 index 0000000000..65cf7f8f19 --- /dev/null +++ b/package/gd/0002-no-zlib.patch @@ -0,0 +1,51 @@ +[PATCH] gd_gd2: provide dummy implementations for all public symbols when !zlib + +gd_gd2.c only provides dummy implementations for some of it's public symbols +when zlib isn't found, causing build failures in several of the tools. + +Fix it by providing dummy implementations for all of them. + +Signed-off-by: Peter Korsgaard +--- + gd_gd2.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +Index: gd-2.0.35/gd_gd2.c +=================================================================== +--- gd-2.0.35.orig/src/gd_gd2.c ++++ gd-2.0.35/src/gd_gd2.c +@@ -1068,4 +1068,34 @@ + fprintf (stderr, "GD2 support is not available - no libz\n"); + return NULL; + } ++ ++BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h) ++{ ++ fprintf (stderr, "GD2 support is not available - no libz\n"); ++ return NULL; ++} ++ ++BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, ++ int h) ++{ ++ fprintf (stderr, "GD2 support is not available - no libz\n"); ++ return NULL; ++} ++ ++BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h) ++{ ++ fprintf (stderr, "GD2 support is not available - no libz\n"); ++ return NULL; ++} ++ ++BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt) ++{ ++ fprintf (stderr, "GD2 support is not available - no libz\n"); ++} ++ ++BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size) ++{ ++ fprintf (stderr, "GD2 support is not available - no libz\n"); ++ return NULL; ++} + #endif /* HAVE_LIBZ */ diff --git a/package/gd/0003-gd_bmp-fix-build-with-uClibc.patch b/package/gd/0003-gd_bmp-fix-build-with-uClibc.patch new file mode 100644 index 0000000000..89bc39186e --- /dev/null +++ b/package/gd/0003-gd_bmp-fix-build-with-uClibc.patch @@ -0,0 +1,50 @@ +From ea2a03e983acf34a1320b460dcad43b7e0b0b14f Mon Sep 17 00:00:00 2001 +Message-Id: +From: Baruch Siach +Date: Thu, 10 Apr 2014 15:49:13 +0300 +Subject: [PATCH] gd_bmp: fix build with uClibc + +Some architectures (like ARM) don't have the long double variants of math +functions under uClibc. Add a local ceill definition in this case. + +Patch status: reported upstream, +https://bitbucket.org/libgd/gd-libgd/issue/123/build-failure-agains-uclibc-arm + +Signed-off-by: Baruch Siach +--- + src/gd_bmp.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/gd_bmp.c b/src/gd_bmp.c +index 0fc021909f1b..11b3ec1baa01 100644 +--- a/src/gd_bmp.c ++++ b/src/gd_bmp.c +@@ -25,6 +25,11 @@ + #include "gdhelpers.h" + #include "bmp.h" + ++#include ++#if defined (__UCLIBC__) && !defined(__UCLIBC_HAS_LONG_DOUBLE_MATH__) ++#define NO_LONG_DOUBLE ++#endif ++ + static int compress_row(unsigned char *uncompressed_row, int length); + static int build_rle_packet(unsigned char *row, int packet_type, int length, unsigned char *data); + +@@ -42,6 +47,13 @@ static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info); + + #define BMP_DEBUG(s) + ++#ifdef NO_LONG_DOUBLE ++long double ceill(long double x) ++{ ++ return (long double) ceil((double) x); ++} ++#endif ++ + static int gdBMPPutWord(gdIOCtx *out, int w) + { + /* Byte order is little-endian */ +-- +1.9.1 + diff --git a/package/gd/0004-webp-pre.patch b/package/gd/0004-webp-pre.patch new file mode 100644 index 0000000000..a4bc068b18 --- /dev/null +++ b/package/gd/0004-webp-pre.patch @@ -0,0 +1,37 @@ +Patch committed upstream +https://bitbucket.org/libgd/gd-libgd/commits/c7e5dc617c7466c44935cdefbe7e79de319f98ca?at=master + +Downloaded from Gentoo +https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-libs/gd/files/gd-2.1.1-webp-pre.patch?revision=1.1&view=markup + +Signed-off-by: Bernd Kuhls + +--- +https://bugs.gentoo.org/545956 + +From c7e5dc617c7466c44935cdefbe7e79de319f98ca Mon Sep 17 00:00:00 2001 +From: Pierre Joye +Date: Sat, 17 Jan 2015 08:20:17 +0100 +Subject: [PATCH] fix #111, invalid default quantization + +--- + src/gd_webp.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/gd_webp.c b/src/gd_webp.c +index fae3861..a3ae1ac 100644 +--- a/src/gd_webp.c ++++ b/src/gd_webp.c +@@ -185,6 +185,9 @@ BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantiza + gd_error("gd-webp error: cannot allocate Y buffer"); + return; + } ++ if (quantization == -1) { ++ quantization = 80; ++ } + vp8_quality = mapQualityToVP8QP(quantization); + + U = Y + width * height; +-- +2.3.5 + diff --git a/package/gd/0005-webp.patch b/package/gd/0005-webp.patch new file mode 100644 index 0000000000..f648a87536 --- /dev/null +++ b/package/gd/0005-webp.patch @@ -0,0 +1,418 @@ +Patch committed upstream +https://bitbucket.org/libgd/gd-libgd/commits/a79232c5fa692c3b6e3f5bc95ecfc455424c3f54?at=master + +Downloaded from Gentoo +https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-libs/gd/files/gd-2.1.1-webp.patch?revision=1.1&view=markup + +Signed-off-by: Bernd Kuhls + +--- +https://bugs.gentoo.org/545956 + +From a79232c5fa692c3b6e3f5bc95ecfc455424c3f54 Mon Sep 17 00:00:00 2001 +From: Pierre Joye +Date: Tue, 20 Jan 2015 04:55:11 +0100 +Subject: [PATCH] fix #129, drop VPX usage in favor of libwebp + +--- + configure.ac | 80 +++++------------ + src/gd_webp.c | 231 +++++++++++++++++++++----------------------------- + tests/Makefile.am | 2 +- + tests/webp/bug00111.c | 2 +- + 4 files changed, 122 insertions(+), 193 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 1024a3a..8923186 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -317,63 +317,6 @@ if test "$with_xpm" != no; then + fi + AM_CONDITIONAL([HAVE_LIBXPM], test "$with_xpm" = yes) + +-dnl check for libvpx by default +-AC_ARG_WITH(vpx,dnl +-[ --with-vpx=DIR where to find the vpx library]) +- +-case $with_vpx in +-no) ;; +-yes|"") +- PKG_CHECK_MODULES([LIBVPX], vpx, [with_vpx=yes], +- [ +- PKG_CHECK_MODULES([LIBVPX], libvpx, [with_vpx=yes], +- [ +- if test "$with_vpx" = yes; then +- AC_MSG_ERROR([VPX support requested, but not found]) +- fi +- with_vpx=no +- ]) +- ]) +- ;; +-*) +- save_LIBS="$LIBS" +- save_CPPFLAGS="$CPPFLAGS" +- +- if test -d "$with_vpx"; then +- LIBVPX_CFLAGS="-I$with_vpx/include" +- LIBVPX_LIBS="-L$with_vpx/lib -lvpx" +- fi +- +- CPPFLAGS="$CPPFLAGS $LIBVPX_CFLAGS" +- LIBS="$LIBS $LIBVPX_LIBS" +- +- AC_CHECK_LIB(vpx,vpx_codec_destroy, +- [ +- if test -z "$LIBVPX_LIBS"; then +- LIBVPX_LIBS="-lvpx" +- fi +- with_vpx=yes +- ],[ +- if test "$with_vpx" != ""; then +- AC_MSG_ERROR([vpx support requested, but not found]) +- else +- with_vpx=no +- fi +- ]) +- +- CPPFLAGS="$save_CPPFLAGS" +- LIBS="$save_LIBS" +- ;; +-esac +- +-if test "$with_vpx" != no; then +- CPPFLAGS="$CPPFLAGS $LIBVPX_CFLAGS" +- LIBS="$LIBS $LIBVPX_LIBS" +- FEATURES="GD_VPX $FEATURES" +- AC_DEFINE(HAVE_LIBVPX, 1, [ Define if you have the VPX library. ]) +-fi +-AM_CONDITIONAL([HAVE_LIBVPX], test "$with_vpx" = yes) +- + dnl check for libtiff by default + AC_ARG_WITH(tiff,dnl + [ --with-tiff=DIR where to find the TIFF library]) +@@ -437,6 +380,27 @@ if test "$mingw_cv_win32_host" = yes; then + AC_DEFINE([BGDWIN32], [], [Define is you are building for Win32 API]) + fi + ++ ++dnl check for libwebp by default ++AC_ARG_WITH(webp,dnl ++[ --with-webp=DIR where to find the webp library], ++ [if test -d "$withval"; then ++ LDFLAGS="$LDFLAGS -L$withval/lib" ++ CFLAGS="$CFLAGS -I$withval/include" ++ fi], ++ withval=yes) ++ ++if test "$withval" != no; then ++ AC_CHECK_LIB(webp,WebPGetInfo, ++ [LIBS="-lwebp $LIBS" ++ FEATURES="GD_WEBP $FEATURES" ++ AC_DEFINE(HAVE_LIBWEBP, 1, [ Define if you have the webp library. ])]) ++ with_webp=yes ++else ++ with_webp=no ++fi ++AM_CONDITIONAL([HAVE_LIBWEBP], test "$with_webp" = yes) ++ + dnl report configuration + AC_MSG_RESULT([ + ** Configuration summary for $PACKAGE $VERSION: +@@ -444,7 +408,7 @@ AC_MSG_RESULT([ + Support for Zlib: $with_zlib + Support for PNG library: $with_png + Support for JPEG library: $ac_cv_lib_jpeg_jpeg_set_defaults +- Support for VPX library: $with_vpx ++ Support for WebP library: $with_webp + Support for TIFF library: $with_tiff + Support for Freetype 2.x library: $with_freetype + Support for Fontconfig library: $with_fontconfig +diff --git a/src/gd_webp.c b/src/gd_webp.c +index a3ae1ac..c44bd80 100644 +--- a/src/gd_webp.c ++++ b/src/gd_webp.c +@@ -2,33 +2,21 @@ + #include "config.h" + #endif /* HAVE_CONFIG_H */ + ++ ++#ifdef HAVE_LIBWEBP + #include + #include + #include + #include + #include "gd.h" + #include "gd_errors.h" +- +-#ifdef HAVE_LIBVPX +-#include "webpimg.h" + #include "gdhelpers.h" ++#include "webp/decode.h" ++#include "webp/encode.h" + +-extern void gd_YUV420toRGBA(uint8* Y, +- uint8* U, +- uint8* V, +- gdImagePtr im); +- +-extern void gd_RGBAToYUV420(gdImagePtr im2, +- uint8* Y, +- uint8* U, +- uint8* V); +- +-const char * gdWebpGetVersionString() +-{ +- return "not defined"; +-} ++#define GD_WEBP_ALLOC_STEP (4*1024) + +-BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp (FILE * inFile) ++gdImagePtr gdImageCreateFromWebp (FILE * inFile) + { + gdImagePtr im; + gdIOCtx *in = gdNewFileCtx(inFile); +@@ -38,42 +26,16 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp (FILE * inFile) + return im; + } + +-BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr (int size, void *data) ++gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile) + { +- int width, height, ret; +- unsigned char *Y = NULL; +- unsigned char *U = NULL; +- unsigned char *V = NULL; +- gdImagePtr im; +- +- ret = WebPDecode(data, size, &Y, &U, &V, &width, &height); +- if (ret != webp_success) { +- if (Y) free(Y); +- if (U) free(U); +- if (V) free(V); +- gd_error("WebP decode: fail to decode input data"); +- return NULL; +- } +- im = gdImageCreateTrueColor(width, height); +- if (!im) { +- return NULL; +- } +- gd_YUV420toRGBA(Y, U, V, im); +- return im; +-} +- +-#define GD_WEBP_ALLOC_STEP (4*1024) +- +-BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile) +-{ +- int width, height, ret; +- unsigned char *filedata = NULL; ++ int width, height; ++ uint8_t *filedata = NULL; ++ uint8_t *argb = NULL; + unsigned char *read, *temp; +- unsigned char *Y = NULL; +- unsigned char *U = NULL; +- unsigned char *V = NULL; + size_t size = 0, n; + gdImagePtr im; ++ int x, y; ++ uint8_t *p; + + do { + temp = gdRealloc(filedata, size+GD_WEBP_ALLOC_STEP); +@@ -89,23 +51,97 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile) + } + + n = gdGetBuf(read, GD_WEBP_ALLOC_STEP, infile); +- size += n; +- } while (n>0); ++ if (n>0 && n!=EOF) { ++ size += n; ++ } ++ } while (n>0 && n!=EOF); + +- ret = WebPDecode(filedata, size, &Y, &U, &V, &width, &height); +- gdFree(filedata); +- if (ret != webp_success) { +- if (Y) free(Y); +- if (U) free(U); +- if (V) free(V); +- gd_error("WebP decode: fail to decode input data"); ++ if (WebPGetInfo(filedata,size, &width, &height) == 0) { ++ gd_error("gd-webp cannot get webp info"); + return NULL; + } ++ + im = gdImageCreateTrueColor(width, height); +- gd_YUV420toRGBA(Y, U, V, im); ++ if (!im) { ++ return NULL; ++ } ++ argb = WebPDecodeARGB(filedata, size, &width, &height); ++ if (!argb) { ++ gd_error("gd-webp cannot allocate temporary buffer"); ++ gdFree(argb); ++ return NULL; ++ } ++ for (y = 0, p = argb; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ register uint8_t a = gdAlphaMax - (*(p++) >> 1); ++ register uint8_t r = *(p++); ++ register uint8_t g = *(p++); ++ register uint8_t b = *(p++); ++ im->tpixels[y][x] = gdTrueColorAlpha(r, g, b, a); ++ } ++ } ++ gdFree(filedata); ++ free(argb); ++ im->saveAlphaFlag = 1; + return im; + } + ++void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization) ++{ ++ uint8_t *argb; ++ int x, y; ++ uint8_t *p; ++ uint8_t *out; ++ size_t out_size; ++ ++ if (im == NULL) { ++ return; ++ } ++ ++ if (!gdImageTrueColor(im)) { ++ gd_error("Paletter image not supported by webp"); ++ return; ++ } ++ ++ if (quantization == -1) { ++ quantization = 80; ++ } ++ ++ argb = (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im)); ++ if (!argb) { ++ return; ++ } ++ p = argb; ++ for (y = 0; y < gdImageSY(im); y++) { ++ for (x = 0; x < gdImageSX(im); x++) { ++ register int c; ++ register char a; ++ c = im->tpixels[y][x]; ++ a = gdTrueColorGetAlpha(c); ++ if (a == 127) { ++ a = 0; ++ } else { ++ a = 255 - ((a << 1) + (a >> 6)); ++ } ++ *(p++) = gdTrueColorGetRed(c); ++ *(p++) = gdTrueColorGetGreen(c); ++ *(p++) = gdTrueColorGetBlue(c); ++ *(p++) = a; ++ } ++ } ++ out_size = WebPEncodeRGBA(argb, gdImageSX(im), gdImageSY(im), gdImageSX(im) * 4, quantization, &out); ++ printf("outsize: %i\n", out_size); ++ if (out_size == 0) { ++ gd_error("gd-webp encoding failed"); ++ goto freeargb; ++ } ++ gdPutBuf(out, out_size, outfile); ++ free(out); ++ ++freeargb: ++ gdFree(argb); ++} ++ + BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization) + { + gdIOCtx *out = gdNewFileCtx(outFile); +@@ -116,7 +152,7 @@ BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization + BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile) + { + gdIOCtx *out = gdNewFileCtx(outFile); +- gdImageWebpCtx(im, out, -1); ++ gdImageWebpCtx(im, out, -1); + out->gd_free(out); + } + +@@ -140,75 +176,4 @@ BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quantization + out->gd_free(out); + return rv; + } +- +-/* +- * Maps normalized QP (quality) to VP8 QP +- */ +-int mapQualityToVP8QP(int quality) { +-#define MIN_QUALITY 0 +-#define MAX_QUALITY 100 +-#define MIN_VP8QP 1 +-#define MAX_VP8QP 63 +- const float scale = MAX_VP8QP - MIN_VP8QP; +- const float vp8qp = +- scale * (MAX_QUALITY - quality) / (MAX_QUALITY - MIN_QUALITY) + MIN_VP8QP; +- if (quality < MIN_QUALITY || quality > MAX_QUALITY) { +- gd_error("Wrong quality value %d.", quality); +- return -1; +- } +- +- return (int)(vp8qp + 0.5); +-} +- +-/* This routine is based in part on code from Dale Lutz (Safe Software Inc.) +- * and in part on demo code from Chapter 15 of "PNG: The Definitive Guide" +- * (http://www.cdrom.com/pub/png/pngbook.html). +- */ +-BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization) +-{ +- int width = im->sx; +- int height = im->sy; +- +- int yuv_width, yuv_height, yuv_nbytes, ret; +- int vp8_quality; +- unsigned char *Y = NULL, +- *U = NULL, +- *V = NULL; +- unsigned char *filedata = NULL; +- +- /* Conversion to Y,U,V buffer */ +- yuv_width = (width + 1) >> 1; +- yuv_height = (height + 1) >> 1; +- yuv_nbytes = width * height + 2 * yuv_width * yuv_height; +- +- if ((Y = (unsigned char *)gdCalloc(yuv_nbytes, sizeof(unsigned char))) == NULL) { +- gd_error("gd-webp error: cannot allocate Y buffer"); +- return; +- } +- if (quantization == -1) { +- quantization = 80; +- } +- vp8_quality = mapQualityToVP8QP(quantization); +- +- U = Y + width * height; +- V = U + yuv_width * yuv_height; +- gd_RGBAToYUV420(im, Y, U, V); +- +- /* Encode Y,U,V and write data to file */ +- ret = WebPEncode(Y, U, V, width, height, width, yuv_width, yuv_height, yuv_width, +- vp8_quality, &filedata, &yuv_nbytes, NULL); +- gdFree(Y); +- +- if (ret != webp_success) { +- if (filedata) { +- free(filedata); +- } +- gd_error("gd-webp error: WebP Encoder failed"); +- return; +- } +- +- gdPutBuf (filedata, yuv_nbytes, outfile); +- free(filedata); +-} +- +-#endif /* HAVE_LIBVPX */ ++#endif /* HAVE_LIBWEBP */ +-- +2.3.5 + diff --git a/package/gdb/7.8.2/0001-gdbserver-fix-uClibc-whithout-MMU.patch b/package/gdb/7.8.2/0001-gdbserver-fix-uClibc-whithout-MMU.patch new file mode 100644 index 0000000000..42168df570 --- /dev/null +++ b/package/gdb/7.8.2/0001-gdbserver-fix-uClibc-whithout-MMU.patch @@ -0,0 +1,34 @@ +From 59432cbfe267ad89b7cfc73dcd702b8282ef4e9d Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 10 Apr 2015 22:58:07 +0200 +Subject: [PATCH] gdbserver: fix uClibc whithout MMU. + +Since commit d86d4aafd4fa22fa4cccb83253fb187b03f97f48, the pid +must be retrieved from current_inferior. + +The change has not been made in the function linux_read_offsets(). + +Fixes: +http://autobuild.buildroot.net/results/9e4/9e4df085319e346803c26c65478accb27eb950ae/build-end.log + +Signed-off-by: Romain Naour +--- + gdb/gdbserver/linux-low.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c +index 1a40897..71d078a 100644 +--- a/gdb/gdbserver/linux-low.c ++++ b/gdb/gdbserver/linux-low.c +@@ -4933,7 +4933,7 @@ static int + linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p) + { + unsigned long text, text_end, data; +- int pid = lwpid_of (get_thread_lwp (current_inferior)); ++ int pid = lwpid_of (current_inferior); + + errno = 0; + +-- +1.9.3 + diff --git a/package/gdb/7.8.2/0002-gdbserver-xtensa-drop-xtensa_usrregs_info.patch b/package/gdb/7.8.2/0002-gdbserver-xtensa-drop-xtensa_usrregs_info.patch new file mode 100644 index 0000000000..93fe749ef0 --- /dev/null +++ b/package/gdb/7.8.2/0002-gdbserver-xtensa-drop-xtensa_usrregs_info.patch @@ -0,0 +1,47 @@ +From deb44829ecc1dd38275af0fcf91acd319e227a89 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 17 Apr 2015 03:07:41 +0300 +Subject: [PATCH 1/2] gdbserver/xtensa: drop xtensa_usrregs_info + +xtensa_usrregs_info refers to undefined variables xtensa_num_regs and +xtensa_regmap. Drop xtensa_usrregs_info and replace pointer to usrregs +in regs_info with NULL since all registers are read/set through regsets. + +2015-04-17 Max Filippov +gdb/gdbserver/ + * linux-xtensa-low.c (xtensa_usrregs_info): Remove. + (regs_info): Replace usrregs pointer with NULL. + +Signed-off-by: Max Filippov +--- +Backported from: deb44829ecc1dd38275af0fcf91acd319e227a89 +Changes to ChangeLog are dropped. + + gdb/gdbserver/linux-xtensa-low.c | 8 +------- + 2 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c +index f7fafaf..e786da5 100644 +--- a/gdb/gdbserver/linux-xtensa-low.c ++++ b/gdb/gdbserver/linux-xtensa-low.c +@@ -186,16 +186,10 @@ static struct regsets_info xtensa_regsets_info = + NULL, /* disabled_regsets */ + }; + +-static struct usrregs_info xtensa_usrregs_info = +- { +- xtensa_num_regs, +- xtensa_regmap, +- }; +- + static struct regs_info regs_info = + { + NULL, /* regset_bitmap */ +- &xtensa_usrregs_info, ++ NULL, /* usrregs */ + &xtensa_regsets_info + }; + +-- +1.8.1.4 + diff --git a/package/gdb/7.8.2/0003-gdbserver-xtensa-fix-typo-in-XCHAL_HAVE_LOOPS.patch b/package/gdb/7.8.2/0003-gdbserver-xtensa-fix-typo-in-XCHAL_HAVE_LOOPS.patch new file mode 100644 index 0000000000..027f700b09 --- /dev/null +++ b/package/gdb/7.8.2/0003-gdbserver-xtensa-fix-typo-in-XCHAL_HAVE_LOOPS.patch @@ -0,0 +1,46 @@ +From a2d5a9d76f2366ed93095fc5a63eafa06b22f808 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 17 Apr 2015 02:52:50 +0300 +Subject: [PATCH 2/2] gdbserver/xtensa: fix typo in XCHAL_HAVE_LOOPS + +This fixes lbeg/lend/lcount registers handling through gdbserver. + +2015-04-17 Max Filippov +gdb/gdbserver/ + * linux-xtensa-low.c (xtensa_fill_gregset) + (xtensa_store_gregset): Check XCHAL_HAVE_LOOPS instead of + XCHAL_HAVE_LOOP. + +Signed-off-by: Max Filippov +--- +Backported from: a2d5a9d76f2366ed93095fc5a63eafa06b22f808 +Changes to ChangeLog are dropped. + + gdb/gdbserver/linux-xtensa-low.c | 4 ++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c +index e786da5..4daccee 100644 +--- a/gdb/gdbserver/linux-xtensa-low.c ++++ b/gdb/gdbserver/linux-xtensa-low.c +@@ -59,7 +59,7 @@ xtensa_fill_gregset (struct regcache *regcache, void *buf) + + /* Loop registers, if hardware has it. */ + +-#if XCHAL_HAVE_LOOP ++#if XCHAL_HAVE_LOOPS + collect_register_by_name (regcache, "lbeg", (char*)&rset[R_LBEG]); + collect_register_by_name (regcache, "lend", (char*)&rset[R_LEND]); + collect_register_by_name (regcache, "lcount", (char*)&rset[R_LCOUNT]); +@@ -94,7 +94,7 @@ xtensa_store_gregset (struct regcache *regcache, const void *buf) + + /* Loop registers, if hardware has it. */ + +-#if XCHAL_HAVE_LOOP ++#if XCHAL_HAVE_LOOPS + supply_register_by_name (regcache, "lbeg", (char*)&rset[R_LBEG]); + supply_register_by_name (regcache, "lend", (char*)&rset[R_LEND]); + supply_register_by_name (regcache, "lcount", (char*)&rset[R_LCOUNT]); +-- +1.8.1.4 + diff --git a/package/gdb/7.8.2/0004-Add-some-casts-for-building-on-musl.patch b/package/gdb/7.8.2/0004-Add-some-casts-for-building-on-musl.patch new file mode 100644 index 0000000000..bf20c03c23 --- /dev/null +++ b/package/gdb/7.8.2/0004-Add-some-casts-for-building-on-musl.patch @@ -0,0 +1,70 @@ +From d41401ace01c234f42697e190a2ac95991780626 Mon Sep 17 00:00:00 2001 +From: Doug Evans +Date: Mon, 26 Oct 2015 13:20:12 -0700 +Subject: [PATCH] Add some casts for building on musl. + +gdb/ChangeLog: + + * linux-thread-db.c (find_new_threads_callback): Cast ti.ti_tid to + unsigned long for debug_printf. + (thread_db_pid_to_str): Ditto. + +gdb/gdbserver/ChangeLog: + + * thread-db.c (find_one_thread): Cast ti.ti_tid to unsigned long + for debug_printf. + (attach_thread, find_new_threads_callback): Ditto. + +[Arnout: removed the parts that don't apply, including ChangeLog] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gdb/ChangeLog | 5 +++++ + gdb/gdbserver/ChangeLog | 6 ++++++ + gdb/gdbserver/thread-db.c | 9 +++++---- + gdb/linux-thread-db.c | 5 +++-- + 4 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c +index ffe722d..3df10ff 100644 +--- a/gdb/gdbserver/thread-db.c ++++ b/gdb/gdbserver/thread-db.c +@@ -278,7 +278,7 @@ find_one_thread (ptid_t ptid) + + if (debug_threads) + debug_printf ("Found thread %ld (LWP %d)\n", +- ti.ti_tid, ti.ti_lid); ++ (unsigned long) ti.ti_tid, ti.ti_lid); + + if (lwpid != ti.ti_lid) + { +@@ -319,12 +319,12 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p) + + if (debug_threads) + debug_printf ("Attaching to thread %ld (LWP %d)\n", +- ti_p->ti_tid, ti_p->ti_lid); ++ (unsigned long) ti_p->ti_tid, ti_p->ti_lid); + err = linux_attach_lwp (ptid); + if (err != 0) + { + warning ("Could not attach to thread %ld (LWP %d): %s\n", +- ti_p->ti_tid, ti_p->ti_lid, ++ (unsigned long) ti_p->ti_tid, ti_p->ti_lid, + linux_attach_fail_reason_string (ptid, err)); + return 0; + } +diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c +index 66e9595..41db29a 100644 +--- a/gdb/linux-thread-db.c ++++ b/gdb/linux-thread-db.c +@@ -1816,7 +1817,7 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid) + + tid = thread_info->priv->tid; + snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)", +- tid, ptid_get_lwp (ptid)); ++ (unsigned long) tid, ptid_get_lwp (ptid)); + + return buf; + } +-- +1.9.4 + diff --git a/package/gdb/7.8.2/0005-musl-Move-W_STOPCODE-to-common-gdb_wait-h.patch b/package/gdb/7.8.2/0005-musl-Move-W_STOPCODE-to-common-gdb_wait-h.patch new file mode 100644 index 0000000000..60c357cd80 --- /dev/null +++ b/package/gdb/7.8.2/0005-musl-Move-W_STOPCODE-to-common-gdb_wait-h.patch @@ -0,0 +1,63 @@ +From 963843d4d07aef6caa296dacf191f8adc9518596 Mon Sep 17 00:00:00 2001 +From: Doug Evans +Date: Mon, 26 Oct 2015 13:24:01 -0700 +Subject: [PATCH] musl: Move W_STOPCODE to common/gdb_wait.h. + +gdb/ChangeLog: + + * common/gdb_wait.h (W_STOPCODE): Define, moved here from + gdbserver/linux-low.c. + (WSETSTOP): Simplify. + +gdb/gdbserver/ChangeLog: + + * linux-low.c (W_STOPCODE): Moved to common/gdb_wait.h. + +[Arnout: removed the parts that don't apply, including ChangeLog] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gdb/ChangeLog | 6 ++++++ + gdb/common/gdb_wait.h | 8 ++++---- + gdb/gdbserver/ChangeLog | 4 ++++ + gdb/gdbserver/linux-low.c | 4 ---- + 4 files changed, 14 insertions(+), 8 deletions(-) + +diff --git a/gdb/common/gdb_wait.h b/gdb/common/gdb_wait.h +index 9b250d2..412f813 100644 +--- a/gdb/common/gdb_wait.h ++++ b/gdb/common/gdb_wait.h +@@ -85,12 +85,12 @@ + # endif + #endif + ++#ifndef W_STOPCODE ++#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) ++#endif ++ + #ifndef WSETSTOP +-# ifdef W_STOPCODE + #define WSETSTOP(w,sig) ((w) = W_STOPCODE(sig)) +-# else +-#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8))) +-# endif + #endif + + /* For native GNU/Linux we may use waitpid and the __WCLONE option. +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c +index 0c552b8..7ed67c7 100644 +--- a/gdb/gdbserver/linux-low.c ++++ b/gdb/gdbserver/linux-low.c +@@ -70,10 +70,6 @@ + #define O_LARGEFILE 0 + #endif + +-#ifndef W_STOPCODE +-#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) +-#endif +- + /* This is the kernel's hard limit. Not to be confused with + SIGRTMIN. */ + #ifndef __SIGRTMIN +-- +1.9.4 + diff --git a/package/gdb/7.8.2/0006-move-__SIGRTMIN.patch b/package/gdb/7.8.2/0006-move-__SIGRTMIN.patch new file mode 100644 index 0000000000..38ba1f028a --- /dev/null +++ b/package/gdb/7.8.2/0006-move-__SIGRTMIN.patch @@ -0,0 +1,58 @@ +From 682b25469e66ea45b214e95962671373983c118f Mon Sep 17 00:00:00 2001 +From: Doug Evans +Date: Mon, 26 Oct 2015 13:30:57 -0700 +Subject: [PATCH] Move __SIGRTMIN. + +gdb/ChangeLog: + + * nat/linux-nat.h (__SIGRTMIN): Move here from gdbserver/linux-low.c. + +gdb/gdbserver/ChangeLog: + + * linux-low.c (__SIGRTMIN): Move to nat/linux-nat.h. + +[Arnout: removed the parts that don't apply, including ChangeLog] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gdb/ChangeLog | 4 ++++ + gdb/gdbserver/ChangeLog | 4 ++++ + gdb/gdbserver/linux-low.c | 6 ------ + gdb/nat/linux-nat.h | 5 +++++ + 4 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c +index 7ed67c7..e778c4c 100644 +--- a/gdb/gdbserver/linux-low.c ++++ b/gdb/gdbserver/linux-low.c +@@ -70,12 +70,6 @@ + #define O_LARGEFILE 0 + #endif + +-/* This is the kernel's hard limit. Not to be confused with +- SIGRTMIN. */ +-#ifndef __SIGRTMIN +-#define __SIGRTMIN 32 +-#endif +- + /* Some targets did not define these ptrace constants from the start, + so gdbserver defines them locally here. In the future, these may + be removed after they are added to asm/ptrace.h. */ +diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h +index 0633fa9..70e6274 100644 +--- a/gdb/nat/linux-nat.h ++++ b/gdb/nat/linux-nat.h +@@ -25,6 +25,11 @@ + struct lwp_info; + struct arch_lwp_info; + ++/* This is the kernel's hard limit. Not to be confused with SIGRTMIN. */ ++#ifndef __SIGRTMIN ++#define __SIGRTMIN 32 ++#endif ++ + /* Unlike other extended result codes, WSTOPSIG (status) on + PTRACE_O_TRACESYSGOOD syscall events doesn't return SIGTRAP, but + instead SIGTRAP with bit 7 set. */ +-- +1.9.4 + diff --git a/package/gdb/7.9.1/0001-gdbserver-fix-uClibc-whithout-MMU.patch b/package/gdb/7.9.1/0001-gdbserver-fix-uClibc-whithout-MMU.patch new file mode 100644 index 0000000000..340db671f8 --- /dev/null +++ b/package/gdb/7.9.1/0001-gdbserver-fix-uClibc-whithout-MMU.patch @@ -0,0 +1,34 @@ +From 570805e96bb8c458795b04f4745700795997ef40 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Fri, 10 Apr 2015 22:58:07 +0200 +Subject: [PATCH] gdbserver: fix uClibc whithout MMU. + +Since commit d86d4aafd4fa22fa4cccb83253fb187b03f97f48, the pid +must be retrieved from current_thread. + +The change has not been made in the function linux_read_offsets(). + +Fixes: +http://autobuild.buildroot.net/results/9e4/9e4df085319e346803c26c65478accb27eb950ae/build-end.log + +Signed-off-by: Romain Naour +--- + gdb/gdbserver/linux-low.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c +index 4d19c87..7585b80 100644 +--- a/gdb/gdbserver/linux-low.c ++++ b/gdb/gdbserver/linux-low.c +@@ -4933,7 +4933,7 @@ static int + linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p) + { + unsigned long text, text_end, data; +- int pid = lwpid_of (get_thread_lwp (current_thread)); ++ int pid = lwpid_of (current_thread); + + errno = 0; + +-- +1.9.3 + diff --git a/package/gdb/7.9.1/0002-gdbserver-xtensa-drop-xtensa_usrregs_info.patch b/package/gdb/7.9.1/0002-gdbserver-xtensa-drop-xtensa_usrregs_info.patch new file mode 100644 index 0000000000..93fe749ef0 --- /dev/null +++ b/package/gdb/7.9.1/0002-gdbserver-xtensa-drop-xtensa_usrregs_info.patch @@ -0,0 +1,47 @@ +From deb44829ecc1dd38275af0fcf91acd319e227a89 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 17 Apr 2015 03:07:41 +0300 +Subject: [PATCH 1/2] gdbserver/xtensa: drop xtensa_usrregs_info + +xtensa_usrregs_info refers to undefined variables xtensa_num_regs and +xtensa_regmap. Drop xtensa_usrregs_info and replace pointer to usrregs +in regs_info with NULL since all registers are read/set through regsets. + +2015-04-17 Max Filippov +gdb/gdbserver/ + * linux-xtensa-low.c (xtensa_usrregs_info): Remove. + (regs_info): Replace usrregs pointer with NULL. + +Signed-off-by: Max Filippov +--- +Backported from: deb44829ecc1dd38275af0fcf91acd319e227a89 +Changes to ChangeLog are dropped. + + gdb/gdbserver/linux-xtensa-low.c | 8 +------- + 2 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c +index f7fafaf..e786da5 100644 +--- a/gdb/gdbserver/linux-xtensa-low.c ++++ b/gdb/gdbserver/linux-xtensa-low.c +@@ -186,16 +186,10 @@ static struct regsets_info xtensa_regsets_info = + NULL, /* disabled_regsets */ + }; + +-static struct usrregs_info xtensa_usrregs_info = +- { +- xtensa_num_regs, +- xtensa_regmap, +- }; +- + static struct regs_info regs_info = + { + NULL, /* regset_bitmap */ +- &xtensa_usrregs_info, ++ NULL, /* usrregs */ + &xtensa_regsets_info + }; + +-- +1.8.1.4 + diff --git a/package/gdb/7.9.1/0003-gdbserver-xtensa-fix-typo-in-XCHAL_HAVE_LOOPS.patch b/package/gdb/7.9.1/0003-gdbserver-xtensa-fix-typo-in-XCHAL_HAVE_LOOPS.patch new file mode 100644 index 0000000000..027f700b09 --- /dev/null +++ b/package/gdb/7.9.1/0003-gdbserver-xtensa-fix-typo-in-XCHAL_HAVE_LOOPS.patch @@ -0,0 +1,46 @@ +From a2d5a9d76f2366ed93095fc5a63eafa06b22f808 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Fri, 17 Apr 2015 02:52:50 +0300 +Subject: [PATCH 2/2] gdbserver/xtensa: fix typo in XCHAL_HAVE_LOOPS + +This fixes lbeg/lend/lcount registers handling through gdbserver. + +2015-04-17 Max Filippov +gdb/gdbserver/ + * linux-xtensa-low.c (xtensa_fill_gregset) + (xtensa_store_gregset): Check XCHAL_HAVE_LOOPS instead of + XCHAL_HAVE_LOOP. + +Signed-off-by: Max Filippov +--- +Backported from: a2d5a9d76f2366ed93095fc5a63eafa06b22f808 +Changes to ChangeLog are dropped. + + gdb/gdbserver/linux-xtensa-low.c | 4 ++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c +index e786da5..4daccee 100644 +--- a/gdb/gdbserver/linux-xtensa-low.c ++++ b/gdb/gdbserver/linux-xtensa-low.c +@@ -59,7 +59,7 @@ xtensa_fill_gregset (struct regcache *regcache, void *buf) + + /* Loop registers, if hardware has it. */ + +-#if XCHAL_HAVE_LOOP ++#if XCHAL_HAVE_LOOPS + collect_register_by_name (regcache, "lbeg", (char*)&rset[R_LBEG]); + collect_register_by_name (regcache, "lend", (char*)&rset[R_LEND]); + collect_register_by_name (regcache, "lcount", (char*)&rset[R_LCOUNT]); +@@ -94,7 +94,7 @@ xtensa_store_gregset (struct regcache *regcache, const void *buf) + + /* Loop registers, if hardware has it. */ + +-#if XCHAL_HAVE_LOOP ++#if XCHAL_HAVE_LOOPS + supply_register_by_name (regcache, "lbeg", (char*)&rset[R_LBEG]); + supply_register_by_name (regcache, "lend", (char*)&rset[R_LEND]); + supply_register_by_name (regcache, "lcount", (char*)&rset[R_LCOUNT]); +-- +1.8.1.4 + diff --git a/package/gdb/7.9.1/0004-xtensa-implement-NPTL-helpers.patch b/package/gdb/7.9.1/0004-xtensa-implement-NPTL-helpers.patch new file mode 100644 index 0000000000..e7bc74ea53 --- /dev/null +++ b/package/gdb/7.9.1/0004-xtensa-implement-NPTL-helpers.patch @@ -0,0 +1,267 @@ +From d4eb69fc4b50f9a0babd70b28d0601b40f31bd0f Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 2 Jul 2015 15:10:58 +0300 +Subject: [PATCH] xtensa: implement NPTL helpers + +These changes allow debugging multithreaded NPTL xtensa applications. + +2015-08-20 Max Filippov +gdb/gdbserver/ + * configure.srv (xtensa*-*-linux*): Add srv_linux_thread_db=yes. + * linux-xtensa-low.c (arch/xtensa.h gdb_proc_service.h): New + #includes. + (ps_get_thread_area): New function. + +2015-08-20 Max Filippov +gdb/ + * arch/xtensa.h: New file. + * xtensa-linux-nat.c (gdb_proc_service.h): New #include. + (ps_get_thread_area): New function. + * xtensa-linux-tdep.c (xtensa_linux_init_abi): Add call to + set_gdbarch_fetch_tls_load_module_address to enable TLS support. + * xtensa-tdep.c (osabi.h): New #include. + (xtensa_gdbarch_init): Call gdbarch_init_osabi to register + xtensa-specific hooks. + * xtensa-tdep.h (struct xtensa_elf_gregset_t): Add threadptr + member and move the structure to arch/xtensa.h. + +Signed-off-by: Max Filippov +--- +Backported from: 40045d91812b25c88c8275b8c08d27c234b68ba8 +Changes to ChangeLog files are dropped. + + gdb/arch/xtensa.h | 46 ++++++++++++++++++++++++++++++++++++++++ + gdb/gdbserver/configure.srv | 1 + + gdb/gdbserver/linux-xtensa-low.c | 21 ++++++++++++++++++ + gdb/xtensa-linux-nat.c | 22 ++++++++++++++++++ + gdb/xtensa-linux-tdep.c | 4 ++++ + gdb/xtensa-tdep.c | 4 ++++ + gdb/xtensa-tdep.h | 24 ++------------------ + 7 files changed, 100 insertions(+), 22 deletions(-) + create mode 100644 gdb/arch/xtensa.h + +diff --git a/gdb/arch/xtensa.h b/gdb/arch/xtensa.h +new file mode 100644 +index 0000000..fe96584 +--- /dev/null ++++ b/gdb/arch/xtensa.h +@@ -0,0 +1,46 @@ ++/* Common Target-dependent code for the Xtensa port of GDB, the GNU debugger. ++ ++ Copyright (C) 2003-2015 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef XTENSA_H ++#define XTENSA_H ++ ++/* Xtensa ELF core file register set representation ('.reg' section). ++ Copied from target-side ELF header . */ ++ ++typedef uint32_t xtensa_elf_greg_t; ++ ++typedef struct ++{ ++ xtensa_elf_greg_t pc; ++ xtensa_elf_greg_t ps; ++ xtensa_elf_greg_t lbeg; ++ xtensa_elf_greg_t lend; ++ xtensa_elf_greg_t lcount; ++ xtensa_elf_greg_t sar; ++ xtensa_elf_greg_t windowstart; ++ xtensa_elf_greg_t windowbase; ++ xtensa_elf_greg_t threadptr; ++ xtensa_elf_greg_t reserved[7+48]; ++ xtensa_elf_greg_t ar[64]; ++} xtensa_elf_gregset_t; ++ ++#define XTENSA_ELF_NGREG (sizeof (xtensa_elf_gregset_t) \ ++ / sizeof (xtensa_elf_greg_t)) ++ ++#endif +diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv +index 0b18d1d..320c26a 100644 +--- a/gdb/gdbserver/configure.srv ++++ b/gdb/gdbserver/configure.srv +@@ -352,6 +352,7 @@ case "${target}" in + xtensa*-*-linux*) srv_regobj=reg-xtensa.o + srv_tgtobj="$srv_linux_obj linux-xtensa-low.o" + srv_linux_regsets=yes ++ srv_linux_thread_db=yes + ;; + tilegx-*-linux*) srv_regobj=reg-tilegx.o + srv_regobj="${srv_regobj} reg-tilegx32.o" +diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c +index 4daccee..debe467 100644 +--- a/gdb/gdbserver/linux-xtensa-low.c ++++ b/gdb/gdbserver/linux-xtensa-low.c +@@ -26,6 +26,8 @@ extern const struct target_desc *tdesc_xtensa; + + #include + #include ++#include "arch/xtensa.h" ++#include "gdb_proc_service.h" + + #include "xtensa-xtregs.c" + +@@ -179,6 +181,25 @@ xtensa_breakpoint_at (CORE_ADDR where) + xtensa_breakpoint, xtensa_breakpoint_len) == 0; + } + ++/* Called by libthread_db. */ ++ ++ps_err_e ++ps_get_thread_area (const struct ps_prochandle *ph, ++ lwpid_t lwpid, int idx, void **base) ++{ ++ xtensa_elf_gregset_t regs; ++ ++ if (ptrace (PTRACE_GETREGS, lwpid, NULL, ®s) != 0) ++ return PS_ERR; ++ ++ /* IDX is the bias from the thread pointer to the beginning of the ++ thread descriptor. It has to be subtracted due to implementation ++ quirks in libthread_db. */ ++ *base = (void *) ((char *) regs.threadptr - idx); ++ ++ return PS_OK; ++} ++ + static struct regsets_info xtensa_regsets_info = + { + xtensa_regsets, /* regsets */ +diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c +index 77ad3e0..5538d5b 100644 +--- a/gdb/xtensa-linux-nat.c ++++ b/gdb/xtensa-linux-nat.c +@@ -37,6 +37,9 @@ + #include "gregset.h" + #include "xtensa-tdep.h" + ++/* Defines ps_err_e, struct ps_prochandle. */ ++#include "gdb_proc_service.h" ++ + /* Extended register set depends on hardware configs. + Keeping these definitions separately allows to introduce + hardware-specific overlays. */ +@@ -280,6 +283,25 @@ xtensa_linux_store_inferior_registers (struct target_ops *ops, + store_xtregs (regcache, regnum); + } + ++/* Called by libthread_db. */ ++ ++ps_err_e ++ps_get_thread_area (const struct ps_prochandle *ph, ++ lwpid_t lwpid, int idx, void **base) ++{ ++ xtensa_elf_gregset_t regs; ++ ++ if (ptrace (PTRACE_GETREGS, lwpid, NULL, ®s) != 0) ++ return PS_ERR; ++ ++ /* IDX is the bias from the thread pointer to the beginning of the ++ thread descriptor. It has to be subtracted due to implementation ++ quirks in libthread_db. */ ++ *base = (void *) ((char *) regs.threadptr - idx); ++ ++ return PS_OK; ++} ++ + void _initialize_xtensa_linux_nat (void); + + void +diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c +index 61ea9b0..99e0d3e 100644 +--- a/gdb/xtensa-linux-tdep.c ++++ b/gdb/xtensa-linux-tdep.c +@@ -106,6 +106,10 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + xtensa_linux_gdb_signal_from_target); + set_gdbarch_gdb_signal_to_target (gdbarch, + xtensa_linux_gdb_signal_to_target); ++ ++ /* Enable TLS support. */ ++ set_gdbarch_fetch_tls_load_module_address (gdbarch, ++ svr4_fetch_objfile_link_map); + } + + /* Provide a prototype to silence -Wmissing-prototypes. */ +diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c +index 55e7d98..4b693ed 100644 +--- a/gdb/xtensa-tdep.c ++++ b/gdb/xtensa-tdep.c +@@ -28,6 +28,7 @@ + #include "value.h" + #include "dis-asm.h" + #include "inferior.h" ++#include "osabi.h" + #include "floatformat.h" + #include "regcache.h" + #include "reggroups.h" +@@ -3273,6 +3274,9 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); + ++ /* Hook in the ABI-specific overrides, if they have been registered. */ ++ gdbarch_init_osabi (info, gdbarch); ++ + return gdbarch; + } + +diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h +index caa2988..5b28cab 100644 +--- a/gdb/xtensa-tdep.h ++++ b/gdb/xtensa-tdep.h +@@ -18,6 +18,8 @@ + along with this program. If not, see . */ + + ++#include "arch/xtensa.h" ++ + /* XTENSA_TDEP_VERSION can/should be changed along with XTENSA_CONFIG_VERSION + whenever the "tdep" structure changes in an incompatible way. */ + +@@ -81,28 +83,6 @@ typedef enum + } xtensa_target_flags_t; + + +-/* Xtensa ELF core file register set representation ('.reg' section). +- Copied from target-side ELF header . */ +- +-typedef uint32_t xtensa_elf_greg_t; +- +-typedef struct +-{ +- xtensa_elf_greg_t pc; +- xtensa_elf_greg_t ps; +- xtensa_elf_greg_t lbeg; +- xtensa_elf_greg_t lend; +- xtensa_elf_greg_t lcount; +- xtensa_elf_greg_t sar; +- xtensa_elf_greg_t windowstart; +- xtensa_elf_greg_t windowbase; +- xtensa_elf_greg_t reserved[8+48]; +- xtensa_elf_greg_t ar[64]; +-} xtensa_elf_gregset_t; +- +-#define XTENSA_ELF_NGREG (sizeof (xtensa_elf_gregset_t) \ +- / sizeof (xtensa_elf_greg_t)) +- + /* Mask. */ + + typedef struct +-- +1.8.1.4 + diff --git a/package/gdb/7.9.1/0005-Add-some-casts-for-building-on-musl.patch b/package/gdb/7.9.1/0005-Add-some-casts-for-building-on-musl.patch new file mode 100644 index 0000000000..2469eb79a4 --- /dev/null +++ b/package/gdb/7.9.1/0005-Add-some-casts-for-building-on-musl.patch @@ -0,0 +1,70 @@ +From d41401ace01c234f42697e190a2ac95991780626 Mon Sep 17 00:00:00 2001 +From: Doug Evans +Date: Mon, 26 Oct 2015 13:20:12 -0700 +Subject: [PATCH] Add some casts for building on musl. + +gdb/ChangeLog: + + * linux-thread-db.c (find_new_threads_callback): Cast ti.ti_tid to + unsigned long for debug_printf. + (thread_db_pid_to_str): Ditto. + +gdb/gdbserver/ChangeLog: + + * thread-db.c (find_one_thread): Cast ti.ti_tid to unsigned long + for debug_printf. + (attach_thread, find_new_threads_callback): Ditto. + +[Arnout: removed the parts that don't apply, including ChangeLog] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gdb/ChangeLog | 5 +++++ + gdb/gdbserver/ChangeLog | 6 ++++++ + gdb/gdbserver/thread-db.c | 9 +++++---- + gdb/linux-thread-db.c | 5 +++-- + 4 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c +index ffe722d..3df10ff 100644 +--- a/gdb/gdbserver/thread-db.c ++++ b/gdb/gdbserver/thread-db.c +@@ -278,7 +278,7 @@ find_one_thread (ptid_t ptid) + + if (debug_threads) + debug_printf ("Found thread %ld (LWP %d)\n", +- ti.ti_tid, ti.ti_lid); ++ (unsigned long) ti.ti_tid, ti.ti_lid); + + if (lwpid != ti.ti_lid) + { +@@ -319,12 +319,12 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p) + + if (debug_threads) + debug_printf ("Attaching to thread %ld (LWP %d)\n", +- ti_p->ti_tid, ti_p->ti_lid); ++ (unsigned long) ti_p->ti_tid, ti_p->ti_lid); + err = linux_attach_lwp (ptid); + if (err != 0) + { + warning ("Could not attach to thread %ld (LWP %d): %s\n", +- ti_p->ti_tid, ti_p->ti_lid, ++ (unsigned long) ti_p->ti_tid, ti_p->ti_lid, + linux_ptrace_attach_fail_reason_string (ptid, err)); + return 0; + } +diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c +index 66e9595..41db29a 100644 +--- a/gdb/linux-thread-db.c ++++ b/gdb/linux-thread-db.c +@@ -1816,7 +1817,7 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid) + + tid = thread_info->priv->tid; + snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)", +- tid, ptid_get_lwp (ptid)); ++ (unsigned long) tid, ptid_get_lwp (ptid)); + + return buf; + } +-- +1.9.4 + diff --git a/package/gdb/7.9.1/0006-musl-Move-W_STOPCODE-to-common-gdb_wait-h.patch b/package/gdb/7.9.1/0006-musl-Move-W_STOPCODE-to-common-gdb_wait-h.patch new file mode 100644 index 0000000000..60c357cd80 --- /dev/null +++ b/package/gdb/7.9.1/0006-musl-Move-W_STOPCODE-to-common-gdb_wait-h.patch @@ -0,0 +1,63 @@ +From 963843d4d07aef6caa296dacf191f8adc9518596 Mon Sep 17 00:00:00 2001 +From: Doug Evans +Date: Mon, 26 Oct 2015 13:24:01 -0700 +Subject: [PATCH] musl: Move W_STOPCODE to common/gdb_wait.h. + +gdb/ChangeLog: + + * common/gdb_wait.h (W_STOPCODE): Define, moved here from + gdbserver/linux-low.c. + (WSETSTOP): Simplify. + +gdb/gdbserver/ChangeLog: + + * linux-low.c (W_STOPCODE): Moved to common/gdb_wait.h. + +[Arnout: removed the parts that don't apply, including ChangeLog] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gdb/ChangeLog | 6 ++++++ + gdb/common/gdb_wait.h | 8 ++++---- + gdb/gdbserver/ChangeLog | 4 ++++ + gdb/gdbserver/linux-low.c | 4 ---- + 4 files changed, 14 insertions(+), 8 deletions(-) + +diff --git a/gdb/common/gdb_wait.h b/gdb/common/gdb_wait.h +index 9b250d2..412f813 100644 +--- a/gdb/common/gdb_wait.h ++++ b/gdb/common/gdb_wait.h +@@ -85,12 +85,12 @@ + # endif + #endif + ++#ifndef W_STOPCODE ++#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) ++#endif ++ + #ifndef WSETSTOP +-# ifdef W_STOPCODE + #define WSETSTOP(w,sig) ((w) = W_STOPCODE(sig)) +-# else +-#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8))) +-# endif + #endif + + /* For native GNU/Linux we may use waitpid and the __WCLONE option. +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c +index 0c552b8..7ed67c7 100644 +--- a/gdb/gdbserver/linux-low.c ++++ b/gdb/gdbserver/linux-low.c +@@ -70,10 +70,6 @@ + #define O_LARGEFILE 0 + #endif + +-#ifndef W_STOPCODE +-#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) +-#endif +- + /* This is the kernel's hard limit. Not to be confused with + SIGRTMIN. */ + #ifndef __SIGRTMIN +-- +1.9.4 + diff --git a/package/gdb/7.9.1/0007-move-__SIGRTMIN.patch b/package/gdb/7.9.1/0007-move-__SIGRTMIN.patch new file mode 100644 index 0000000000..38ba1f028a --- /dev/null +++ b/package/gdb/7.9.1/0007-move-__SIGRTMIN.patch @@ -0,0 +1,58 @@ +From 682b25469e66ea45b214e95962671373983c118f Mon Sep 17 00:00:00 2001 +From: Doug Evans +Date: Mon, 26 Oct 2015 13:30:57 -0700 +Subject: [PATCH] Move __SIGRTMIN. + +gdb/ChangeLog: + + * nat/linux-nat.h (__SIGRTMIN): Move here from gdbserver/linux-low.c. + +gdb/gdbserver/ChangeLog: + + * linux-low.c (__SIGRTMIN): Move to nat/linux-nat.h. + +[Arnout: removed the parts that don't apply, including ChangeLog] +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + gdb/ChangeLog | 4 ++++ + gdb/gdbserver/ChangeLog | 4 ++++ + gdb/gdbserver/linux-low.c | 6 ------ + gdb/nat/linux-nat.h | 5 +++++ + 4 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c +index 7ed67c7..e778c4c 100644 +--- a/gdb/gdbserver/linux-low.c ++++ b/gdb/gdbserver/linux-low.c +@@ -70,12 +70,6 @@ + #define O_LARGEFILE 0 + #endif + +-/* This is the kernel's hard limit. Not to be confused with +- SIGRTMIN. */ +-#ifndef __SIGRTMIN +-#define __SIGRTMIN 32 +-#endif +- + /* Some targets did not define these ptrace constants from the start, + so gdbserver defines them locally here. In the future, these may + be removed after they are added to asm/ptrace.h. */ +diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h +index 0633fa9..70e6274 100644 +--- a/gdb/nat/linux-nat.h ++++ b/gdb/nat/linux-nat.h +@@ -25,6 +25,11 @@ + struct lwp_info; + struct arch_lwp_info; + ++/* This is the kernel's hard limit. Not to be confused with SIGRTMIN. */ ++#ifndef __SIGRTMIN ++#define __SIGRTMIN 32 ++#endif ++ + /* Unlike other extended result codes, WSTOPSIG (status) on + PTRACE_O_TRACESYSGOOD syscall events doesn't return SIGTRAP, but + instead SIGTRAP with bit 7 set. */ +-- +1.9.4 + diff --git a/package/glibc/2.18-svnr23787/0001-CVE-2014-7817-eglibc.patch b/package/glibc/2.18-svnr23787/0001-CVE-2014-7817-eglibc.patch new file mode 100644 index 0000000000..da2f49de10 --- /dev/null +++ b/package/glibc/2.18-svnr23787/0001-CVE-2014-7817-eglibc.patch @@ -0,0 +1,174 @@ +From https://bugzilla.redhat.com/show_bug.cgi?id=1157689 +Modified for eglibc. + +Signed-off-by: Gustavo Zacarias + +WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! +EMBARGOED !!! EMBARGOED !!! EMARGOED !!! EMBARGOED !!! EMBARGOED !!! +SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!! + +CVE-2014-7817: + +The function wordexp() fails to properly handle the WRDE_NOCMD +flag when processing arithmetic inputs in the form of "$((... ``))" +where "..." can be anything valid. The backticks in the arithmetic +epxression are evaluated by in a shell even if WRDE_NOCMD forbade +command substitution. This allows an attacker to attempt to pass +dangerous commands via constructs of the above form, and bypass +the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD +in parse_arith(). The patch also hardens parse_backticks() and +parse_comm() to check for WRDE_NOCMD flag and return an error instead +of ever running a shell. + +We expand the testsuite and add 3 new regression tests of roughtly +the same form but with a couple of nested levels. + +On top of the 3 new tests we add fork validation to the WRDE_NOCMD +testing. If any forks are detected during the execution of a wordexp() +call with WRDE_NOCMD, the test is marked as failed. This is slightly +heuristic since vfork might be used, but it provides a higher level +of assurance that no shells were executed as part of command substitution +with WRDE_NOCMD in effect. In addition it doesn't require libpthread or +libdl, instead we use the public implementation namespace function +__register_atfork (already part of the public ABI for libpthread). + +Tested on x86_64 with no regressions. + +2014-10-27 Carlos O'Donell + + * wordexp-test.c (__dso_handle): Add prototype. + (__register_atfork): Likewise. + (__app_register_atfork): New function. + (registered_forks): New global. + (register_fork): New function. + (test_case): Add 3 new tests for WRDE_CMDSUB. + (main): Call __app_register_atfork. + (testit): If WRDE_NOCMD set registered_forks to zero, run test, and + if fork count is non-zero fail the test. + * posix/wordexp.c (parse_arith): Return WRDE_NOCMD if WRDE_NOCMD flag + is set and parsing '`'. + (parse_comm): Return WRDE_NOCMD if WRDE_NOCMD flag is set. + (parse_backtick): Return WRDE_NOCMD if WRDE_NOCMD flag is set and + parsing '`'. + +diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c +index 4957006..5ce2a1b 100644 +--- a/libc/posix/wordexp-test.c ++++ b/libc/posix/wordexp-test.c +@@ -27,6 +27,25 @@ + + #define IFS " \n\t" + ++extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden"))); ++extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *); ++ ++static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)) ++{ ++ return __register_atfork (prepare, parent, child, ++ &__dso_handle == NULL ? NULL : __dso_handle); ++} ++ ++/* Number of forks seen. */ ++static int registered_forks; ++ ++/* For each fork increment the fork count. */ ++static void ++register_fork (void) ++{ ++ registered_forks++; ++} ++ + struct test_case_struct + { + int retval; +@@ -206,6 +225,12 @@ struct test_case_struct + { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS }, + { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS }, + { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS }, ++ /* Test for CVE-2014-7817. We test 3 combinations of command ++ substitution inside an arithmetic expression to make sure that ++ no commands are executed and error is returned. */ ++ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS }, ++ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS }, ++ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS }, + + { -1, NULL, NULL, 0, 0, { NULL, }, IFS }, + }; +@@ -258,6 +283,15 @@ main (int argc, char *argv[]) + return -1; + } + ++ /* If we are not allowed to do command substitution, we install ++ fork handlers to verify that no forks happened. No forks should ++ happen at all if command substitution is disabled. */ ++ if (__app_register_atfork (register_fork, NULL, NULL) != 0) ++ { ++ printf ("Failed to register fork handler.\n"); ++ return -1; ++ } ++ + for (test = 0; test_case[test].retval != -1; test++) + if (testit (&test_case[test])) + ++fail; +@@ -367,6 +401,9 @@ testit (struct test_case_struct *tc) + + printf ("Test %d (%s): ", ++tests, tc->words); + ++ if (tc->flags & WRDE_NOCMD) ++ registered_forks = 0; ++ + if (tc->flags & WRDE_APPEND) + { + /* initial wordexp() call, to be appended to */ +@@ -378,6 +415,13 @@ testit (struct test_case_struct *tc) + } + retval = wordexp (tc->words, &we, tc->flags); + ++ if ((tc->flags & WRDE_NOCMD) ++ && (registered_forks > 0)) ++ { ++ printf ("FAILED fork called for WRDE_NOCMD\n"); ++ return 1; ++ } ++ + if (tc->flags & WRDE_DOOFFS) + start_offs = sav_we.we_offs; + +diff --git a/posix/wordexp.c b/posix/wordexp.c +index b6b65dd..d6a158f 100644 +--- a/libc/posix/wordexp.c ++++ b/libc/posix/wordexp.c +@@ -693,6 +693,12 @@ parse_arith (char **word, size_t *word_length, size_t *max_length, + break; + + case '`': ++ if (flags & WRDE_NOCMD) ++ { ++ free (expr); ++ return WRDE_NOCMD; ++ } ++ + (*offset)++; + error = parse_backtick (&expr, &expr_length, &expr_maxlen, + words, offset, flags, NULL, NULL, NULL); +@@ -1144,6 +1150,10 @@ parse_comm (char **word, size_t *word_length, size_t *max_length, + size_t comm_maxlen; + char *comm = w_newword (&comm_length, &comm_maxlen); + ++ /* Do nothing if command substitution should not succeed. */ ++ if (flags & WRDE_NOCMD) ++ return WRDE_CMDSUB; ++ + for (; words[*offset]; ++(*offset)) + { + switch (words[*offset]) +@@ -2121,6 +2131,9 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length, + switch (words[*offset]) + { + case '`': ++ if (flags & WRDE_NOCMD) ++ return WRDE_NOCMD; ++ + /* Go -- give the script to the shell */ + error = exec_comm (comm, word, word_length, max_length, flags, + pwordexp, ifs, ifs_white); diff --git a/package/glibc/2.18-svnr23787/0002-accept-make4.patch b/package/glibc/2.18-svnr23787/0002-accept-make4.patch new file mode 100644 index 0000000000..4f426f29e6 --- /dev/null +++ b/package/glibc/2.18-svnr23787/0002-accept-make4.patch @@ -0,0 +1,33 @@ +Backport upstream patch (28d708c44bc47b56f6551ff285f78edcf61c208a) to accept +make-4.0 or newer. +We patch both configure and configure.in files so if we ever have to run +autoreconf in the glibc source, then the fix will be propagated properly. + +Signed-off-by: Markos Chandras + +Index: glibc-2.18-svnr23787/libc/configure +=================================================================== +--- glibc-2.18-svnr23787.orig/libc/configure ++++ glibc-2.18-svnr23787/libc/configure +@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE... + ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; +- 3.79* | 3.[89]*) ++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + +Index: glibc-2.18-svnr23787/libc/configure.in +=================================================================== +--- glibc-2.18-svnr23787.orig/libc/configure.in ++++ glibc-2.18-svnr23787/libc/configure.in +@@ -989,7 +989,7 @@ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}g + critic_missing="$critic_missing gcc") + AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version, + [GNU Make[^0-9]*\([0-9][0-9.]*\)], +- [3.79* | 3.[89]*], critic_missing="$critic_missing make") ++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make") + + AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version, + [GNU gettext.* \([0-9]*\.[0-9.]*\)], diff --git a/package/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch b/package/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch new file mode 100644 index 0000000000..f447dcd329 --- /dev/null +++ b/package/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch @@ -0,0 +1,141 @@ +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=41488498b6 +See https://bugzilla.redhat.com/show_bug.cgi?id=1135841 + +Signed-off-by: Gustavo Zacarias + +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm1364.c eglibc-2.19/libc/iconvdata/ibm1364.c +--- eglibc-2.19.orig/libc/iconvdata/ibm1364.c 2015-01-08 16:05:53.918823240 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm1364.c 2015-01-08 16:06:02.781555143 -0300 +@@ -220,7 +220,8 @@ + ++rp2; \ + \ + uint32_t res; \ +- if (__builtin_expect (ch < rp2->start, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ ++ || __builtin_expect (ch < rp2->start, 0) \ + || (res = DB_TO_UCS4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ + { \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm932.c eglibc-2.19/libc/iconvdata/ibm932.c +--- eglibc-2.19.orig/libc/iconvdata/ibm932.c 2015-01-08 16:05:53.910818967 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm932.c 2015-01-08 16:06:02.781555143 -0300 +@@ -73,11 +73,12 @@ + } \ + \ + ch = (ch * 0x100) + inptr[1]; \ ++ /* ch was less than 0xfd. */ \ ++ assert (ch < 0xfd00); \ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ +- || __builtin_expect (ch < rp2->start, 0) \ ++ if (__builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm932db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, '\1') == 0 && ch !=0)) \ + { \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm933.c eglibc-2.19/libc/iconvdata/ibm933.c +--- eglibc-2.19.orig/libc/iconvdata/ibm933.c 2015-01-08 16:05:53.917822706 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm933.c 2015-01-08 16:06:02.781555143 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm933db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm935.c eglibc-2.19/libc/iconvdata/ibm935.c +--- eglibc-2.19.orig/libc/iconvdata/ibm935.c 2015-01-08 16:05:53.921824843 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm935.c 2015-01-08 16:06:02.782555677 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm935db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm937.c eglibc-2.19/libc/iconvdata/ibm937.c +--- eglibc-2.19.orig/libc/iconvdata/ibm937.c 2015-01-08 16:05:53.915821638 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm937.c 2015-01-08 16:06:02.782555677 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm937db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm939.c eglibc-2.19/libc/iconvdata/ibm939.c +--- eglibc-2.19.orig/libc/iconvdata/ibm939.c 2015-01-08 16:05:53.917822706 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm939.c 2015-01-08 16:06:02.782555677 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm939db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm943.c eglibc-2.19/libc/iconvdata/ibm943.c +--- eglibc-2.19.orig/libc/iconvdata/ibm943.c 2015-01-08 16:05:53.918823240 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm943.c 2015-01-08 16:06:02.782555677 -0300 +@@ -74,11 +74,12 @@ + } \ + \ + ch = (ch * 0x100) + inptr[1]; \ ++ /* ch was less than 0xfd. */ \ ++ assert (ch < 0xfd00); \ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ +- || __builtin_expect (ch < rp2->start, 0) \ ++ if (__builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm943db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, '\1') == 0 && ch !=0)) \ + { \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/Makefile eglibc-2.19/libc/iconvdata/Makefile +--- eglibc-2.19.orig/libc/iconvdata/Makefile 2015-01-08 16:05:53.903815227 -0300 ++++ eglibc-2.19/libc/iconvdata/Makefile 2015-01-08 16:06:02.782555677 -0300 +@@ -303,6 +303,7 @@ + $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \ + $(addprefix $(objpfx),$(modules.so)) \ + $(common-objdir)/iconv/iconv_prog TESTS ++ iconv_modules="$(modules)" \ + $(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@ + + $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh eglibc-2.19/libc/iconvdata/run-iconv-test.sh +--- eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:05:53.894810420 -0300 ++++ eglibc-2.19/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:06:02.782555677 -0300 +@@ -188,6 +188,24 @@ + + done < TESTS2 + ++# Check for crashes in decoders. ++printf '\016\377\377\377\377\377\377\377' > $temp1 ++for from in $iconv_modules ; do ++ echo $ac_n "test decoder $from $ac_c" ++ PROG=`eval echo $ICONV` ++ if $PROG < $temp1 >/dev/null 2>&1 ; then ++ : # fall through ++ else ++ status=$? ++ if test $status -gt 1 ; then ++ echo "/FAILED" ++ failed=1 ++ continue ++ fi ++ fi ++ echo "OK" ++done ++ + exit $failed + # Local Variables: + # mode:shell-script diff --git a/package/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch b/package/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch new file mode 100644 index 0000000000..c7aa12c1b9 --- /dev/null +++ b/package/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch @@ -0,0 +1,20 @@ +Fix CVE-2014-9402 - denial of service in getnetbyname function. +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d +See https://bugzilla.redhat.com/show_bug.cgi?id=1175369 + +Signed-off-by: Gustavo Zacarias + +diff -Nura eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c eglibc-2.19/libc/resolv/nss_dns/dns-network.c +--- eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:35.024977879 -0300 ++++ eglibc-2.19/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:42.543992357 -0300 +@@ -398,8 +398,8 @@ + + case BYNAME: + { +- char **ap = result->n_aliases++; +- while (*ap != NULL) ++ char **ap; ++ for (ap = result->n_aliases; *ap != NULL; ++ap) + { + /* Check each alias name for being of the forms: + 4.3.2.1.in-addr.arpa = net 1.2.3.4 diff --git a/package/glibc/2.18-svnr23787/0005-CVE-2015-1472.patch b/package/glibc/2.18-svnr23787/0005-CVE-2015-1472.patch new file mode 100644 index 0000000000..a0da626cbf --- /dev/null +++ b/package/glibc/2.18-svnr23787/0005-CVE-2015-1472.patch @@ -0,0 +1,88 @@ +Fix CVE-2015-1472 - heap buffer overflow in wscanf +Backport from upstream: +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5bd80bfe9ca0d955bfbbc002781bc7b01b6bcb06 +See: https://bugzilla.redhat.com/show_bug.cgi?id=1188235 + +Signed-off-by: Gustavo Zacarias + +diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c +index aece3f2..8a2eb9e 100644 +--- a/libc/stdio-common/tst-sscanf.c ++++ b/libc/stdio-common/tst-sscanf.c +@@ -233,5 +233,38 @@ main (void) + } + } + ++ /* BZ #16618 ++ The test will segfault during SSCANF if the buffer overflow ++ is not fixed. The size of `s` is such that it forces the use ++ of malloc internally and this triggers the incorrect computation. ++ Thus the value for SIZE is arbitrariy high enough that malloc ++ is used. */ ++ { ++#define SIZE 131072 ++ CHAR *s = malloc ((SIZE + 1) * sizeof (*s)); ++ if (s == NULL) ++ abort (); ++ for (size_t i = 0; i < SIZE; i++) ++ s[i] = L('0'); ++ s[SIZE] = L('\0'); ++ int i = 42; ++ /* Scan multi-digit zero into `i`. */ ++ if (SSCANF (s, L("%d"), &i) != 1) ++ { ++ printf ("FAIL: bug16618: SSCANF did not read one input item.\n"); ++ result = 1; ++ } ++ if (i != 0) ++ { ++ printf ("FAIL: bug16618: Value of `i` was not zero as expected.\n"); ++ result = 1; ++ } ++ free (s); ++ if (result != 1) ++ printf ("PASS: bug16618: Did not crash.\n"); ++#undef SIZE ++ } ++ ++ + return result; + } +diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c +index cd129a8..0e204e7 100644 +--- a/libc/stdio-common/vfscanf.c ++++ b/libc/stdio-common/vfscanf.c +@@ -272,9 +272,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr, + if (__glibc_unlikely (wpsize == wpmax)) \ + { \ + CHAR_T *old = wp; \ +- size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \ +- ? UCHAR_MAX + 1 : 2 * wpmax); \ +- if (use_malloc || !__libc_use_alloca (newsize)) \ ++ bool fits = __glibc_likely (wpmax <= SIZE_MAX / sizeof (CHAR_T) / 2); \ ++ size_t wpneed = MAX (UCHAR_MAX + 1, 2 * wpmax); \ ++ size_t newsize = fits ? wpneed * sizeof (CHAR_T) : SIZE_MAX; \ ++ if (!__libc_use_alloca (newsize)) \ + { \ + wp = realloc (use_malloc ? wp : NULL, newsize); \ + if (wp == NULL) \ +@@ -286,14 +287,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr, + } \ + if (! use_malloc) \ + MEMCPY (wp, old, wpsize); \ +- wpmax = newsize; \ ++ wpmax = wpneed; \ + use_malloc = true; \ + } \ + else \ + { \ + size_t s = wpmax * sizeof (CHAR_T); \ +- wp = (CHAR_T *) extend_alloca (wp, s, \ +- newsize * sizeof (CHAR_T)); \ ++ wp = (CHAR_T *) extend_alloca (wp, s, newsize); \ + wpmax = s / sizeof (CHAR_T); \ + if (old != NULL) \ + MEMCPY (wp, old, wpsize); \ +-- +1.9.4 + diff --git a/package/glibc/2.19-svnr25243/0001-CVE-2014-7817-eglibc.patch b/package/glibc/2.19-svnr25243/0001-CVE-2014-7817-eglibc.patch new file mode 100644 index 0000000000..da2f49de10 --- /dev/null +++ b/package/glibc/2.19-svnr25243/0001-CVE-2014-7817-eglibc.patch @@ -0,0 +1,174 @@ +From https://bugzilla.redhat.com/show_bug.cgi?id=1157689 +Modified for eglibc. + +Signed-off-by: Gustavo Zacarias + +WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! +EMBARGOED !!! EMBARGOED !!! EMARGOED !!! EMBARGOED !!! EMBARGOED !!! +SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!! + +CVE-2014-7817: + +The function wordexp() fails to properly handle the WRDE_NOCMD +flag when processing arithmetic inputs in the form of "$((... ``))" +where "..." can be anything valid. The backticks in the arithmetic +epxression are evaluated by in a shell even if WRDE_NOCMD forbade +command substitution. This allows an attacker to attempt to pass +dangerous commands via constructs of the above form, and bypass +the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD +in parse_arith(). The patch also hardens parse_backticks() and +parse_comm() to check for WRDE_NOCMD flag and return an error instead +of ever running a shell. + +We expand the testsuite and add 3 new regression tests of roughtly +the same form but with a couple of nested levels. + +On top of the 3 new tests we add fork validation to the WRDE_NOCMD +testing. If any forks are detected during the execution of a wordexp() +call with WRDE_NOCMD, the test is marked as failed. This is slightly +heuristic since vfork might be used, but it provides a higher level +of assurance that no shells were executed as part of command substitution +with WRDE_NOCMD in effect. In addition it doesn't require libpthread or +libdl, instead we use the public implementation namespace function +__register_atfork (already part of the public ABI for libpthread). + +Tested on x86_64 with no regressions. + +2014-10-27 Carlos O'Donell + + * wordexp-test.c (__dso_handle): Add prototype. + (__register_atfork): Likewise. + (__app_register_atfork): New function. + (registered_forks): New global. + (register_fork): New function. + (test_case): Add 3 new tests for WRDE_CMDSUB. + (main): Call __app_register_atfork. + (testit): If WRDE_NOCMD set registered_forks to zero, run test, and + if fork count is non-zero fail the test. + * posix/wordexp.c (parse_arith): Return WRDE_NOCMD if WRDE_NOCMD flag + is set and parsing '`'. + (parse_comm): Return WRDE_NOCMD if WRDE_NOCMD flag is set. + (parse_backtick): Return WRDE_NOCMD if WRDE_NOCMD flag is set and + parsing '`'. + +diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c +index 4957006..5ce2a1b 100644 +--- a/libc/posix/wordexp-test.c ++++ b/libc/posix/wordexp-test.c +@@ -27,6 +27,25 @@ + + #define IFS " \n\t" + ++extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden"))); ++extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *); ++ ++static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)) ++{ ++ return __register_atfork (prepare, parent, child, ++ &__dso_handle == NULL ? NULL : __dso_handle); ++} ++ ++/* Number of forks seen. */ ++static int registered_forks; ++ ++/* For each fork increment the fork count. */ ++static void ++register_fork (void) ++{ ++ registered_forks++; ++} ++ + struct test_case_struct + { + int retval; +@@ -206,6 +225,12 @@ struct test_case_struct + { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS }, + { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS }, + { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS }, ++ /* Test for CVE-2014-7817. We test 3 combinations of command ++ substitution inside an arithmetic expression to make sure that ++ no commands are executed and error is returned. */ ++ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS }, ++ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS }, ++ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS }, + + { -1, NULL, NULL, 0, 0, { NULL, }, IFS }, + }; +@@ -258,6 +283,15 @@ main (int argc, char *argv[]) + return -1; + } + ++ /* If we are not allowed to do command substitution, we install ++ fork handlers to verify that no forks happened. No forks should ++ happen at all if command substitution is disabled. */ ++ if (__app_register_atfork (register_fork, NULL, NULL) != 0) ++ { ++ printf ("Failed to register fork handler.\n"); ++ return -1; ++ } ++ + for (test = 0; test_case[test].retval != -1; test++) + if (testit (&test_case[test])) + ++fail; +@@ -367,6 +401,9 @@ testit (struct test_case_struct *tc) + + printf ("Test %d (%s): ", ++tests, tc->words); + ++ if (tc->flags & WRDE_NOCMD) ++ registered_forks = 0; ++ + if (tc->flags & WRDE_APPEND) + { + /* initial wordexp() call, to be appended to */ +@@ -378,6 +415,13 @@ testit (struct test_case_struct *tc) + } + retval = wordexp (tc->words, &we, tc->flags); + ++ if ((tc->flags & WRDE_NOCMD) ++ && (registered_forks > 0)) ++ { ++ printf ("FAILED fork called for WRDE_NOCMD\n"); ++ return 1; ++ } ++ + if (tc->flags & WRDE_DOOFFS) + start_offs = sav_we.we_offs; + +diff --git a/posix/wordexp.c b/posix/wordexp.c +index b6b65dd..d6a158f 100644 +--- a/libc/posix/wordexp.c ++++ b/libc/posix/wordexp.c +@@ -693,6 +693,12 @@ parse_arith (char **word, size_t *word_length, size_t *max_length, + break; + + case '`': ++ if (flags & WRDE_NOCMD) ++ { ++ free (expr); ++ return WRDE_NOCMD; ++ } ++ + (*offset)++; + error = parse_backtick (&expr, &expr_length, &expr_maxlen, + words, offset, flags, NULL, NULL, NULL); +@@ -1144,6 +1150,10 @@ parse_comm (char **word, size_t *word_length, size_t *max_length, + size_t comm_maxlen; + char *comm = w_newword (&comm_length, &comm_maxlen); + ++ /* Do nothing if command substitution should not succeed. */ ++ if (flags & WRDE_NOCMD) ++ return WRDE_CMDSUB; ++ + for (; words[*offset]; ++(*offset)) + { + switch (words[*offset]) +@@ -2121,6 +2131,9 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length, + switch (words[*offset]) + { + case '`': ++ if (flags & WRDE_NOCMD) ++ return WRDE_NOCMD; ++ + /* Go -- give the script to the shell */ + error = exec_comm (comm, word, word_length, max_length, flags, + pwordexp, ifs, ifs_white); diff --git a/package/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch b/package/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch new file mode 100644 index 0000000000..f447dcd329 --- /dev/null +++ b/package/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch @@ -0,0 +1,141 @@ +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=41488498b6 +See https://bugzilla.redhat.com/show_bug.cgi?id=1135841 + +Signed-off-by: Gustavo Zacarias + +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm1364.c eglibc-2.19/libc/iconvdata/ibm1364.c +--- eglibc-2.19.orig/libc/iconvdata/ibm1364.c 2015-01-08 16:05:53.918823240 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm1364.c 2015-01-08 16:06:02.781555143 -0300 +@@ -220,7 +220,8 @@ + ++rp2; \ + \ + uint32_t res; \ +- if (__builtin_expect (ch < rp2->start, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ ++ || __builtin_expect (ch < rp2->start, 0) \ + || (res = DB_TO_UCS4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ + { \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm932.c eglibc-2.19/libc/iconvdata/ibm932.c +--- eglibc-2.19.orig/libc/iconvdata/ibm932.c 2015-01-08 16:05:53.910818967 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm932.c 2015-01-08 16:06:02.781555143 -0300 +@@ -73,11 +73,12 @@ + } \ + \ + ch = (ch * 0x100) + inptr[1]; \ ++ /* ch was less than 0xfd. */ \ ++ assert (ch < 0xfd00); \ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ +- || __builtin_expect (ch < rp2->start, 0) \ ++ if (__builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm932db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, '\1') == 0 && ch !=0)) \ + { \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm933.c eglibc-2.19/libc/iconvdata/ibm933.c +--- eglibc-2.19.orig/libc/iconvdata/ibm933.c 2015-01-08 16:05:53.917822706 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm933.c 2015-01-08 16:06:02.781555143 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm933db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm935.c eglibc-2.19/libc/iconvdata/ibm935.c +--- eglibc-2.19.orig/libc/iconvdata/ibm935.c 2015-01-08 16:05:53.921824843 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm935.c 2015-01-08 16:06:02.782555677 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm935db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm937.c eglibc-2.19/libc/iconvdata/ibm937.c +--- eglibc-2.19.orig/libc/iconvdata/ibm937.c 2015-01-08 16:05:53.915821638 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm937.c 2015-01-08 16:06:02.782555677 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm937db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm939.c eglibc-2.19/libc/iconvdata/ibm939.c +--- eglibc-2.19.orig/libc/iconvdata/ibm939.c 2015-01-08 16:05:53.917822706 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm939.c 2015-01-08 16:06:02.782555677 -0300 +@@ -161,7 +161,7 @@ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ ++ if (__builtin_expect (rp2->start == 0xffff, 0) \ + || __builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm939db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm943.c eglibc-2.19/libc/iconvdata/ibm943.c +--- eglibc-2.19.orig/libc/iconvdata/ibm943.c 2015-01-08 16:05:53.918823240 -0300 ++++ eglibc-2.19/libc/iconvdata/ibm943.c 2015-01-08 16:06:02.782555677 -0300 +@@ -74,11 +74,12 @@ + } \ + \ + ch = (ch * 0x100) + inptr[1]; \ ++ /* ch was less than 0xfd. */ \ ++ assert (ch < 0xfd00); \ + while (ch > rp2->end) \ + ++rp2; \ + \ +- if (__builtin_expect (rp2 == NULL, 0) \ +- || __builtin_expect (ch < rp2->start, 0) \ ++ if (__builtin_expect (ch < rp2->start, 0) \ + || (res = __ibm943db_to_ucs4[ch + rp2->idx], \ + __builtin_expect (res, '\1') == 0 && ch !=0)) \ + { \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/Makefile eglibc-2.19/libc/iconvdata/Makefile +--- eglibc-2.19.orig/libc/iconvdata/Makefile 2015-01-08 16:05:53.903815227 -0300 ++++ eglibc-2.19/libc/iconvdata/Makefile 2015-01-08 16:06:02.782555677 -0300 +@@ -303,6 +303,7 @@ + $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \ + $(addprefix $(objpfx),$(modules.so)) \ + $(common-objdir)/iconv/iconv_prog TESTS ++ iconv_modules="$(modules)" \ + $(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@ + + $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \ +diff -Nura eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh eglibc-2.19/libc/iconvdata/run-iconv-test.sh +--- eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:05:53.894810420 -0300 ++++ eglibc-2.19/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:06:02.782555677 -0300 +@@ -188,6 +188,24 @@ + + done < TESTS2 + ++# Check for crashes in decoders. ++printf '\016\377\377\377\377\377\377\377' > $temp1 ++for from in $iconv_modules ; do ++ echo $ac_n "test decoder $from $ac_c" ++ PROG=`eval echo $ICONV` ++ if $PROG < $temp1 >/dev/null 2>&1 ; then ++ : # fall through ++ else ++ status=$? ++ if test $status -gt 1 ; then ++ echo "/FAILED" ++ failed=1 ++ continue ++ fi ++ fi ++ echo "OK" ++done ++ + exit $failed + # Local Variables: + # mode:shell-script diff --git a/package/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch b/package/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch new file mode 100644 index 0000000000..c7aa12c1b9 --- /dev/null +++ b/package/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch @@ -0,0 +1,20 @@ +Fix CVE-2014-9402 - denial of service in getnetbyname function. +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d +See https://bugzilla.redhat.com/show_bug.cgi?id=1175369 + +Signed-off-by: Gustavo Zacarias + +diff -Nura eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c eglibc-2.19/libc/resolv/nss_dns/dns-network.c +--- eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:35.024977879 -0300 ++++ eglibc-2.19/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:42.543992357 -0300 +@@ -398,8 +398,8 @@ + + case BYNAME: + { +- char **ap = result->n_aliases++; +- while (*ap != NULL) ++ char **ap; ++ for (ap = result->n_aliases; *ap != NULL; ++ap) + { + /* Check each alias name for being of the forms: + 4.3.2.1.in-addr.arpa = net 1.2.3.4 diff --git a/package/glibc/2.19-svnr25243/0004-CVE-2015-1472.patch b/package/glibc/2.19-svnr25243/0004-CVE-2015-1472.patch new file mode 100644 index 0000000000..a0da626cbf --- /dev/null +++ b/package/glibc/2.19-svnr25243/0004-CVE-2015-1472.patch @@ -0,0 +1,88 @@ +Fix CVE-2015-1472 - heap buffer overflow in wscanf +Backport from upstream: +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5bd80bfe9ca0d955bfbbc002781bc7b01b6bcb06 +See: https://bugzilla.redhat.com/show_bug.cgi?id=1188235 + +Signed-off-by: Gustavo Zacarias + +diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c +index aece3f2..8a2eb9e 100644 +--- a/libc/stdio-common/tst-sscanf.c ++++ b/libc/stdio-common/tst-sscanf.c +@@ -233,5 +233,38 @@ main (void) + } + } + ++ /* BZ #16618 ++ The test will segfault during SSCANF if the buffer overflow ++ is not fixed. The size of `s` is such that it forces the use ++ of malloc internally and this triggers the incorrect computation. ++ Thus the value for SIZE is arbitrariy high enough that malloc ++ is used. */ ++ { ++#define SIZE 131072 ++ CHAR *s = malloc ((SIZE + 1) * sizeof (*s)); ++ if (s == NULL) ++ abort (); ++ for (size_t i = 0; i < SIZE; i++) ++ s[i] = L('0'); ++ s[SIZE] = L('\0'); ++ int i = 42; ++ /* Scan multi-digit zero into `i`. */ ++ if (SSCANF (s, L("%d"), &i) != 1) ++ { ++ printf ("FAIL: bug16618: SSCANF did not read one input item.\n"); ++ result = 1; ++ } ++ if (i != 0) ++ { ++ printf ("FAIL: bug16618: Value of `i` was not zero as expected.\n"); ++ result = 1; ++ } ++ free (s); ++ if (result != 1) ++ printf ("PASS: bug16618: Did not crash.\n"); ++#undef SIZE ++ } ++ ++ + return result; + } +diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c +index cd129a8..0e204e7 100644 +--- a/libc/stdio-common/vfscanf.c ++++ b/libc/stdio-common/vfscanf.c +@@ -272,9 +272,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr, + if (__glibc_unlikely (wpsize == wpmax)) \ + { \ + CHAR_T *old = wp; \ +- size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \ +- ? UCHAR_MAX + 1 : 2 * wpmax); \ +- if (use_malloc || !__libc_use_alloca (newsize)) \ ++ bool fits = __glibc_likely (wpmax <= SIZE_MAX / sizeof (CHAR_T) / 2); \ ++ size_t wpneed = MAX (UCHAR_MAX + 1, 2 * wpmax); \ ++ size_t newsize = fits ? wpneed * sizeof (CHAR_T) : SIZE_MAX; \ ++ if (!__libc_use_alloca (newsize)) \ + { \ + wp = realloc (use_malloc ? wp : NULL, newsize); \ + if (wp == NULL) \ +@@ -286,14 +287,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr, + } \ + if (! use_malloc) \ + MEMCPY (wp, old, wpsize); \ +- wpmax = newsize; \ ++ wpmax = wpneed; \ + use_malloc = true; \ + } \ + else \ + { \ + size_t s = wpmax * sizeof (CHAR_T); \ +- wp = (CHAR_T *) extend_alloca (wp, s, \ +- newsize * sizeof (CHAR_T)); \ ++ wp = (CHAR_T *) extend_alloca (wp, s, newsize); \ + wpmax = s / sizeof (CHAR_T); \ + if (old != NULL) \ + MEMCPY (wp, old, wpsize); \ +-- +1.9.4 + diff --git a/package/gstreamer1/gst1-plugins-bad/0001-use-gettext-0.18.patch b/package/gstreamer1/gst1-plugins-bad/0001-use-gettext-0.18.patch new file mode 100644 index 0000000000..ebf4567b00 --- /dev/null +++ b/package/gstreamer1/gst1-plugins-bad/0001-use-gettext-0.18.patch @@ -0,0 +1,17 @@ +Use newer version of gettext to match current buildroot gettext. + +Signed-off-by: Spenser Gilliland +---- +Index: gst1-plugins-bad-1.1.1/po/Makefile.in.in +=================================================================== +--- gst1-plugins-bad-1.1.1.orig/po/Makefile.in.in ++++ gst1-plugins-bad-1.1.1/po/Makefile.in.in +@@ -9,7 +9,7 @@ + # General Public License and is *not* in the public domain. + # + # Origin: gettext-0.17 +-GETTEXT_MACRO_VERSION = 0.17 ++GETTEXT_MACRO_VERSION = 0.18 + + PACKAGE = @PACKAGE@ + VERSION = @VERSION@ diff --git a/package/guile/0003-remove_unused_funcs.patch b/package/guile/0003-remove_unused_funcs.patch new file mode 100644 index 0000000000..3d70ee9fc9 --- /dev/null +++ b/package/guile/0003-remove_unused_funcs.patch @@ -0,0 +1,36 @@ +Remove unused static inline functions str_upcase_l() and +str_downcase_l() that cause the compilation error: +'dereferencing pointer to incomplete type'. + +Signed-off-by: Pedro Aguilar + +diff -Nau guile-2.0.11.orig/libguile/i18n.c guile-2.0.11/libguile/i18n.c +--- guile-2.0.11.orig/libguile/i18n.c 2014-01-21 22:25:11.000000000 +0100 ++++ guile-2.0.11/libguile/i18n.c 2014-11-04 23:18:52.675435613 +0100 +@@ -851,26 +851,6 @@ + *dst = '\0'; + } + +-#ifdef USE_GNU_LOCALE_API +-static inline void +-str_upcase_l (register char *dst, register const char *src, +- scm_t_locale locale) +-{ +- for (; *src != '\0'; src++, dst++) +- *dst = toupper_l (*src, locale); +- *dst = '\0'; +-} +- +-static inline void +-str_downcase_l (register char *dst, register const char *src, +- scm_t_locale locale) +-{ +- for (; *src != '\0'; src++, dst++) +- *dst = tolower_l (*src, locale); +- *dst = '\0'; +-} +-#endif +- + + SCM_DEFINE (scm_string_locale_lt, "string-locale for instructions. +... + +Tweak libguile/vm-i-system.c to add boundary value check to workaround it. + +Upstream-Status: Pending + +Signed-off-by: Hongxu Jia + +Fixes Buildroot autobuilder failures on AArch64. + +Signed-off-by: Thomas Petazzoni +--- + libguile/vm-i-system.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c +--- a/libguile/vm-i-system.c ++++ b/libguile/vm-i-system.c +@@ -625,10 +625,22 @@ VM_DEFINE_INSTRUCTION (47, bind_optionals_shuffle, "bind-optionals/shuffle", 6, + /* now shuffle up, from walk to ntotal */ + { + scm_t_ptrdiff nshuf = sp - walk + 1, i; +- sp = (fp - 1) + ntotal + nshuf; +- CHECK_OVERFLOW (); +- for (i = 0; i < nshuf; i++) +- sp[-i] = walk[nshuf-i-1]; ++ /* check the value of nshuf to workaround ice ssa corruption */ ++ /* while compiling with -O -g */ ++ if (nshuf > 0) ++ { ++ sp = (fp - 1) + ntotal + nshuf; ++ CHECK_OVERFLOW (); ++ for (i = 0; i < nshuf; i++) ++ sp[-i] = walk[nshuf-i-1]; ++ } ++ else ++ { ++ sp = (fp - 1) + ntotal + nshuf; ++ CHECK_OVERFLOW (); ++ for (i = 0; i < nshuf; i++) ++ sp[-i] = walk[nshuf-i-1]; ++ } + } + /* and fill optionals & keyword args with SCM_UNDEFINED */ + while (walk <= (fp - 1) + ntotal) +-- +1.9.1 + diff --git a/package/heimdal/0001-vendor.patch b/package/heimdal/0001-vendor.patch new file mode 100644 index 0000000000..1ccd629b69 --- /dev/null +++ b/package/heimdal/0001-vendor.patch @@ -0,0 +1,19 @@ +Add --vendor option to krb5-config, required by samba 4. +Status: Backport from upstream git. + +Signed-off-by: Gustavo Zacarias + +diff -Nura heimdal-1.5.3.orig/tools/krb5-config.in heimdal-1.5.3.vendor/tools/krb5-config.in +--- heimdal-1.5.3.orig/tools/krb5-config.in 2012-12-09 19:06:44.000000000 -0300 ++++ heimdal-1.5.3.vendor/tools/krb5-config.in 2013-12-18 15:49:45.283986300 -0300 +@@ -50,6 +50,10 @@ + do_usage=yes + usage_exit=0 + ;; ++ --vendor) ++ echo "Heimdal"; ++ exit 0 ++ ;; + --version) + echo "@PACKAGE@ @VERSION@" + exit 0 diff --git a/package/heimdal/0002-kadm5-fix-race-in-Makefile-with-kadm5_err.h.patch b/package/heimdal/0002-kadm5-fix-race-in-Makefile-with-kadm5_err.h.patch new file mode 100644 index 0000000000..7361bf2f77 --- /dev/null +++ b/package/heimdal/0002-kadm5-fix-race-in-Makefile-with-kadm5_err.h.patch @@ -0,0 +1,35 @@ +From 18fe7d300f133c2b9eb93bb4bd81e4644979a74b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20=C4=8Cajka?= +Date: Tue, 1 Jul 2014 13:13:43 -0600 +Subject: [PATCH] kadm5: fix race in Makefile with kadm5_err.h + +When running make with -j4, occasionally kadm5 fails due to a missing +header file kadm5_err.h. Fix the race condition. + +Reported at https://bugzilla.redhat.com/1115164 + +Reviewed-by: Ken Dreyer + +Backported from upstream commit +6affa4cceceaa1369dd895f8acdd7a883ee65674. + +Signed-off-by: Thomas Petazzoni +--- + lib/kadm5/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/kadm5/Makefile.am b/lib/kadm5/Makefile.am +index f8be3b1..1b399b1 100644 +--- a/lib/kadm5/Makefile.am ++++ b/lib/kadm5/Makefile.am +@@ -155,6 +155,7 @@ iprop-commands.c iprop-commands.h: iprop-commands.in + $(SLC) $(srcdir)/iprop-commands.in + + $(libkadm5srv_la_OBJECTS): kadm5_err.h ++$(libkadm5clnt_la_OBJECTS): kadm5_err.h + $(iprop_log_OBJECTS): iprop-commands.h + + client_glue.lo server_glue.lo: $(srcdir)/common_glue.c +-- +2.4.5 + diff --git a/package/hostapd/0001-EAP-pwd-peer-Fix-last-fragment-length-validation.patch b/package/hostapd/0001-EAP-pwd-peer-Fix-last-fragment-length-validation.patch new file mode 100644 index 0000000000..82c26398b6 --- /dev/null +++ b/package/hostapd/0001-EAP-pwd-peer-Fix-last-fragment-length-validation.patch @@ -0,0 +1,54 @@ +From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Nov 2015 18:18:17 +0200 +Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation + +All but the last fragment had their length checked against the remaining +room in the reassembly buffer. This allowed a suitably constructed last +fragment frame to try to add extra data that would go beyond the buffer. +The length validation code in wpabuf_put_data() prevents an actual +buffer write overflow from occurring, but this results in process +termination. (CVE-2015-5315) + +Signed-off-by: Jouni Malinen +--- + src/eap_peer/eap_pwd.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c +index 1f78544..75ceef1 100644 +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + /* + * buffer and ACK the fragment + */ +- if (EAP_PWD_GET_MORE_BIT(lm_exch)) { ++ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) { + data->in_frag_pos += len; + if (data->in_frag_pos > wpabuf_size(data->inbuf)) { + wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack " +@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + return NULL; + } + wpabuf_put_data(data->inbuf, pos, len); +- ++ } ++ if (EAP_PWD_GET_MORE_BIT(lm_exch)) { + resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, + EAP_PWD_HDR_SIZE, + EAP_CODE_RESPONSE, eap_get_id(reqData)); +@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + * we're buffering and this is the last fragment + */ + if (data->in_frag_pos) { +- wpabuf_put_data(data->inbuf, pos, len); + wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes", + (int) len); +- data->in_frag_pos += len; + pos = wpabuf_head_u8(data->inbuf); + len = data->in_frag_pos; + } +-- +1.9.1 + diff --git a/package/hostapd/0002-EAP-pwd-server-Fix-last-fragment-length-validation.patch b/package/hostapd/0002-EAP-pwd-server-Fix-last-fragment-length-validation.patch new file mode 100644 index 0000000000..bfc4c74e95 --- /dev/null +++ b/package/hostapd/0002-EAP-pwd-server-Fix-last-fragment-length-validation.patch @@ -0,0 +1,51 @@ +From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Nov 2015 18:24:16 +0200 +Subject: [PATCH] EAP-pwd server: Fix last fragment length validation + +All but the last fragment had their length checked against the remaining +room in the reassembly buffer. This allowed a suitably constructed last +fragment frame to try to add extra data that would go beyond the buffer. +The length validation code in wpabuf_put_data() prevents an actual +buffer write overflow from occurring, but this results in process +termination. (CVE-2015-5314) + +Signed-off-by: Jouni Malinen +--- + src/eap_server/eap_server_pwd.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c +index cb83ff7..9f787ab 100644 +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + /* + * the first and all intermediate fragments have the M bit set + */ +- if (EAP_PWD_GET_MORE_BIT(lm_exch)) { ++ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) { + if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) { + wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow " + "attack detected! (%d+%d > %d)", +@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + } + wpabuf_put_data(data->inbuf, pos, len); + data->in_frag_pos += len; ++ } ++ if (EAP_PWD_GET_MORE_BIT(lm_exch)) { + wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment", + (int) len); + return; +@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + * buffering fragments so that's how we know it's the last) + */ + if (data->in_frag_pos) { +- wpabuf_put_data(data->inbuf, pos, len); +- data->in_frag_pos += len; + pos = wpabuf_head_u8(data->inbuf); + len = data->in_frag_pos; + wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes", +-- +1.9.1 + diff --git a/package/hostapd/0003-vlan-fix-musl-build-error.patch b/package/hostapd/0003-vlan-fix-musl-build-error.patch new file mode 100644 index 0000000000..da1ffcb7d5 --- /dev/null +++ b/package/hostapd/0003-vlan-fix-musl-build-error.patch @@ -0,0 +1,60 @@ +From 67ba6ed9871b2cab16eeee93818f05d9c49ccbab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Tue, 8 Mar 2016 12:05:01 +0100 +Subject: [PATCH] vlan: fix musl build error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +caddr_t is legacy BSD and should be avoided [1]. + +This fixes compile errors with the musl libc: + +../src/ap/vlan_init.c: In function 'br_delif': +../src/ap/vlan_init.c:218:18: error: '__caddr_t' undeclared (first use in this function) + ifr.ifr_data = (__caddr_t) args; + +Upstream status: Pending [2] + +[1] http://stackoverflow.com/questions/6381526/what-is-the-significance-of-caddr-t-and-when-is-it-used +[2] http://lists.infradead.org/pipermail/hostap/2016-March/035350.html + +Signed-off-by: Jörg Krause +--- + src/ap/vlan_init.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c +index fd1c8dd..1670c0d 100644 +--- a/src/ap/vlan_init.c ++++ b/src/ap/vlan_init.c +@@ -215,7 +215,7 @@ static int br_delif(const char *br_name, const char *if_name) + args[1] = if_index; + + os_strlcpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name)); +- ifr.ifr_data = (__caddr_t) args; ++ ifr.ifr_data = (void *) args; + + if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0 && errno != EINVAL) { + /* No error if interface already removed. */ +@@ -266,7 +266,7 @@ static int br_addif(const char *br_name, const char *if_name) + args[1] = if_index; + + os_strlcpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name)); +- ifr.ifr_data = (__caddr_t) args; ++ ifr.ifr_data = (void *) args; + + if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0) { + if (errno == EBUSY) { +@@ -394,7 +394,7 @@ static int br_getnumports(const char *br_name) + + os_memset(ifindices, 0, sizeof(ifindices)); + os_strlcpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name)); +- ifr.ifr_data = (__caddr_t) arg; ++ ifr.ifr_data = (void *) arg; + + if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0) { + wpa_printf(MSG_ERROR, "VLAN: %s: BRCTL_GET_PORT_LIST " +-- +2.7.2 + diff --git a/package/hostapd/0004-vlan-fix-musl-libc-conflict-with-Linux-kernel-header.patch b/package/hostapd/0004-vlan-fix-musl-libc-conflict-with-Linux-kernel-header.patch new file mode 100644 index 0000000000..3e753d619a --- /dev/null +++ b/package/hostapd/0004-vlan-fix-musl-libc-conflict-with-Linux-kernel-header.patch @@ -0,0 +1,60 @@ +From 71a517e922c91e2c6cad28d339a081b5f6de0932 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Tue, 8 Mar 2016 21:07:12 +0100 +Subject: [PATCH] vlan: fix musl libc conflict with Linux kernel headers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Due to both (in "utils/includes.h") and (in +) being included, the in6_addr is being redefined: once from +the C library headers and once from the Linux kernel headers. This causes some +build failures with for example the musl C library: + +In file included from /usr/include/linux/if_bridge.h:18, + from ../src/ap/vlan_init.c:17: +/usr/include/linux/in6.h:32: error: redefinition of 'struct in6_addr' +/usr/include/linux/in6.h:49: error: redefinition of 'struct sockaddr_in6' +/usr/include/linux/in6.h:59: error: redefinition of 'struct ipv6_mreq' + +Mixing C library and Linux kernel headers is a bit problematic [1] and should be +avoided if possible [2]. In order to fix this, define just the macros needed +from as done in Busybox for the brctl applet [3]. + +Upstream status: Pending [4] + +[1] https://sourceware.org/bugzilla/show_bug.cgi?id=15850 +[2] http://www.openwall.com/lists/musl/2015/10/06/1 +[3] https://git.busybox.net/busybox/commit/?id=5fa6d1a632505789409a2ba6cf8e112529f9db18 +[4] http://lists.infradead.org/pipermail/hostap/2016-March/035357.html + +Signed-off-by: Jörg Krause +--- + src/ap/vlan_init.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c +index 1670c0d..f2e3da0 100644 +--- a/src/ap/vlan_init.c ++++ b/src/ap/vlan_init.c +@@ -14,7 +14,16 @@ + #include + #include + #include +-#include ++/* From */ ++#define BRCTL_GET_VERSION 0 ++#define BRCTL_GET_BRIDGES 1 ++#define BRCTL_ADD_BRIDGE 2 ++#define BRCTL_DEL_BRIDGE 3 ++#define BRCTL_ADD_IF 4 ++#define BRCTL_DEL_IF 5 ++#define BRCTL_GET_BRIDGE_INFO 6 ++#define BRCTL_GET_PORT_LIST 7 ++#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 + #endif /* CONFIG_FULL_DYNAMIC_VLAN */ + + #include "utils/common.h" +-- +2.7.2 + diff --git a/package/hostapd/0005-WPS-Reject-a-Credential-with-invalid-passphrase.patch b/package/hostapd/0005-WPS-Reject-a-Credential-with-invalid-passphrase.patch new file mode 100644 index 0000000000..282aa952b5 --- /dev/null +++ b/package/hostapd/0005-WPS-Reject-a-Credential-with-invalid-passphrase.patch @@ -0,0 +1,85 @@ +From ecbb0b3dc122b0d290987cf9c84010bbe53e1022 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 4 Mar 2016 17:20:18 +0200 +Subject: [PATCH] WPS: Reject a Credential with invalid passphrase + +WPA/WPA2-Personal passphrase is not allowed to include control +characters. Reject a Credential received from a WPS Registrar both as +STA (Credential) and AP (AP Settings) if the credential is for WPAPSK or +WPA2PSK authentication type and includes an invalid passphrase. + +This fixes an issue where hostapd or wpa_supplicant could have updated +the configuration file PSK/passphrase parameter with arbitrary data from +an external device (Registrar) that may not be fully trusted. Should +such data include a newline character, the resulting configuration file +could become invalid and fail to be parsed. + +Signed-off-by: Jouni Malinen +Signed-off-by: Baruch Siach +--- +Patch status: upstream (ecbb0b3dc122b0d290987cf9c84010bbe53e1022) + + src/utils/common.c | 12 ++++++++++++ + src/utils/common.h | 1 + + src/wps/wps_attr_process.c | 10 ++++++++++ + 3 files changed, 23 insertions(+) + +diff --git a/src/utils/common.c b/src/utils/common.c +index 450e2c6519ba..27b7c02de10b 100644 +--- a/src/utils/common.c ++++ b/src/utils/common.c +@@ -697,6 +697,18 @@ int is_hex(const u8 *data, size_t len) + } + + ++int has_ctrl_char(const u8 *data, size_t len) ++{ ++ size_t i; ++ ++ for (i = 0; i < len; i++) { ++ if (data[i] < 32 || data[i] == 127) ++ return 1; ++ } ++ return 0; ++} ++ ++ + size_t merge_byte_arrays(u8 *res, size_t res_len, + const u8 *src1, size_t src1_len, + const u8 *src2, size_t src2_len) +diff --git a/src/utils/common.h b/src/utils/common.h +index 701dbb236ed5..a97224070385 100644 +--- a/src/utils/common.h ++++ b/src/utils/common.h +@@ -488,6 +488,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len); + + char * wpa_config_parse_string(const char *value, size_t *len); + int is_hex(const u8 *data, size_t len); ++int has_ctrl_char(const u8 *data, size_t len); + size_t merge_byte_arrays(u8 *res, size_t res_len, + const u8 *src1, size_t src1_len, + const u8 *src2, size_t src2_len); +diff --git a/src/wps/wps_attr_process.c b/src/wps/wps_attr_process.c +index eadb22fe2e78..e8c4579309ab 100644 +--- a/src/wps/wps_attr_process.c ++++ b/src/wps/wps_attr_process.c +@@ -229,6 +229,16 @@ static int wps_workaround_cred_key(struct wps_credential *cred) + cred->key_len--; + #endif /* CONFIG_WPS_STRICT */ + } ++ ++ ++ if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) && ++ (cred->key_len < 8 || has_ctrl_char(cred->key, cred->key_len))) { ++ wpa_printf(MSG_INFO, "WPS: Reject credential with invalid WPA/WPA2-Personal passphrase"); ++ wpa_hexdump_ascii_key(MSG_INFO, "WPS: Network Key", ++ cred->key, cred->key_len); ++ return -1; ++ } ++ + return 0; + } + +-- +2.8.1 + diff --git a/package/htop/0001-native-affinity.patch b/package/htop/0001-native-affinity.patch new file mode 100644 index 0000000000..bf68e53ed1 --- /dev/null +++ b/package/htop/0001-native-affinity.patch @@ -0,0 +1,25 @@ +# This patch removes the check for native_affinity for cross compiling. +# This patch has been pushed to htop on 23 November 2011, however, is +# not in the 1.0 release and may not be exactly what Hisham puts into +# the official build. +# +# Signed-off-by: Andy Kennedy +diff -Naur a/configure.ac b/configure.ac +--- a/configure.ac 2011-11-20 20:46:48.000000000 -0600 ++++ b/configure.ac 2011-11-23 10:41:44.000000000 -0600 +@@ -111,7 +111,6 @@ + if test "$cross_compiling" = "no"; then + AC_CHECK_FILE($PROCDIR/stat,,AC_MSG_ERROR(Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.)) + AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find /proc/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.)) +-fi + + AC_ARG_ENABLE(native_affinity, [AC_HELP_STRING([--enable-native-affinity], [enable native sched_setaffinity and sched_getaffinity for affinity support, disables hwloc])], ,enable_native_affinity="yes") + if test "x$enable_native_affinity" = xyes; then +@@ -130,6 +129,7 @@ + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + fi ++fi + + AC_ARG_ENABLE(hwloc, [AC_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity])],, enable_hwloc="no") + if test "x$enable_hwloc" = xyes diff --git a/package/i2c-tools/i2c-tools.hash b/package/i2c-tools/i2c-tools.hash new file mode 100644 index 0000000000..c12ffe845b --- /dev/null +++ b/package/i2c-tools/i2c-tools.hash @@ -0,0 +1,2 @@ +# locally computed hash +sha256 db5e69f2e2a6e3aa2ecdfe6a5f490b149c504468770f58921c8c5b8a7860a441 i2c-tools-3.1.2.tar.bz2 diff --git a/package/igmpproxy/0001-uclinux.patch b/package/igmpproxy/0001-uclinux.patch new file mode 100644 index 0000000000..7fa4a23830 --- /dev/null +++ b/package/igmpproxy/0001-uclinux.patch @@ -0,0 +1,16 @@ +configure.ac: uclinux is also linux + +Signed-off-by: Gustavo Zacarias + +diff -Nura igmpproxy-0.1.orig/configure.ac igmpproxy-0.1/configure.ac +--- igmpproxy-0.1.orig/configure.ac 2014-03-12 18:43:02.369323771 -0300 ++++ igmpproxy-0.1/configure.ac 2014-03-12 18:43:22.129979179 -0300 +@@ -7,7 +7,7 @@ + + AC_CANONICAL_HOST + case $host_os in +- linux*) os=linux;; ++ linux*|uclinux*) os=linux;; + freebsd*) os=freebsd;; + netbsd*) os=netbsd;; + openbsd*) os=openbsd;; diff --git a/package/intltool/Config.in b/package/intltool/Config.in new file mode 100644 index 0000000000..4643a899d7 --- /dev/null +++ b/package/intltool/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_INTLTOOL + bool "intltool" + # Hide from configuration as we only support the host package + # for the moment + depends on BR2_HOST_ONLY + help + Utility scripts for internationalizing XML + + http://www.freedesktop.org/wiki/Software/intltool diff --git a/package/iozone/0002-no-nptl-support.patch b/package/iozone/0002-no-nptl-support.patch new file mode 100644 index 0000000000..493f52cc77 --- /dev/null +++ b/package/iozone/0002-no-nptl-support.patch @@ -0,0 +1,37 @@ +Dummy pthread_setaffinity_np() when not available + +On uClibc configurations that do not use the NPTL thread +implementation, pthread_setaffinity_np() is not available. This patch +defines a dummy (empty) implementation of this function for such +cases. + +The only few architectures that do not provide the NPTL thread +implementation are very likely to be non-SMP architectures, and +therefore, setting the affinity of the thread is not doing anything +useful, so having an empty stub for pthread_setaffinity_np() is not a +problem. + +Signed-off-by: Thomas Petazzoni + +Index: b/src/current/iozone.c +=================================================================== +--- a/src/current/iozone.c ++++ b/src/current/iozone.c +@@ -306,6 +306,17 @@ + #endif + #endif + ++#if defined (__linux__) ++#include ++#if defined (__UCLIBC__) && !defined (__UCLIBC_HAS_THREADS_NATIVE__) ++static int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, ++ const cpu_set_t *cpuset) ++{ ++ return 0; ++} ++#endif ++#endif ++ + #if ((defined(solaris) && defined(__LP64__)) || defined(__s390x__)) + /* If we are building for 64-bit Solaris, all functions that return pointers + * must be declared before they are used; otherwise the compiler will assume diff --git a/package/ipkg/0001-fix-musl-build.patch b/package/ipkg/0001-fix-musl-build.patch new file mode 100644 index 0000000000..fce3ec4afb --- /dev/null +++ b/package/ipkg/0001-fix-musl-build.patch @@ -0,0 +1,50 @@ +Remove __P macro usage to fix musl build + +__P() is used for compatibility with old K&R C compilers. With ANSI C +this macro has no effect. + +This fixes a compilation error with musl libc because of undeclared +__P. + +Signed-off-by: Thomas Petazzoni + +Index: b/md5.c +=================================================================== +--- a/md5.c ++++ b/md5.c +@@ -97,21 +97,21 @@ + + /* Initialize structure containing state of computation. + (RFC 1321, 3.3: Step 3) */ +-static void md5_init_ctx __P ((struct md5_ctx *ctx)); ++static void md5_init_ctx (struct md5_ctx *ctx); + + /* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +-static void md5_process_block __P ((const void *buffer, size_t len, +- struct md5_ctx *ctx)); ++static void md5_process_block (const void *buffer, size_t len, ++ struct md5_ctx *ctx); + + /* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +-static void md5_process_bytes __P ((const void *buffer, size_t len, +- struct md5_ctx *ctx)); ++static void md5_process_bytes (const void *buffer, size_t len, ++ struct md5_ctx *ctx); + + /* Process the remaining bytes in the buffer and put result from CTX + in first 16 bytes following RESBUF. The result is always in little +@@ -120,7 +120,7 @@ + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +-static void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); ++static void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); + + //---------------------------------------------------------------------------- + //--------end of md5.h diff --git a/package/ipkg/Config.in b/package/ipkg/Config.in new file mode 100644 index 0000000000..4b2078d9cd --- /dev/null +++ b/package/ipkg/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_IPKG + bool "ipkg" + help + The Itsy Package Installer from handhelds.org + + http://www.handhelds.org diff --git a/package/ipkg/ipkg-build b/package/ipkg/ipkg-build new file mode 100755 index 0000000000..f3f5d0c621 --- /dev/null +++ b/package/ipkg/ipkg-build @@ -0,0 +1,127 @@ +#!/bin/sh + +# ipkg-build -- construct a .ipk from a directory +# Carl Worth +# based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001 +set -e + +ipkg_extract_value() { + sed -e "s/^[^:]*:[[:space:]]*//" +} + +required_field() { + field=$1 + + value=`grep "^$field:" < $CONTROL/control | ipkg_extract_value` + if [ -z "$value" ]; then + echo "ipkg-build: Error: $CONTROL/control is missing field $field" ; + PKG_ERROR=1 + fi + echo $value +} + +pkg_appears_sane() { + local pkg_dir=$1 + + local owd=`pwd` + cd $pkg_dir + + PKG_ERROR=0 + if [ ! -f "$CONTROL/control" ]; then + echo "ipkg-build: Error: Control file $pkg_dir/$CONTROL/control not found." + cd $owd + return 1 + fi + + pkg=`required_field Package` + version=`required_field Version` + arch=`required_field Architecture` + required_field Maintainer >/dev/null + required_field Description >/dev/null + + if echo $pkg | grep '[^a-z0-9.+-]'; then + echo "ipkg-build: Error: Package name $name contains illegal characters, (other than [a-z0-9.+-])" + PKG_ERROR=1; + fi + + local bad_fields=`sed -ne 's/^\([^[:space:]][^:[:space:]]\+[[:space:]]\+\)[^:].*/\1/p' < $CONTROL/control | sed -e 's/\\n//'` + if [ -n "$bad_fields" ]; then + bad_fields=`echo $bad_fields` + echo "ipkg-build: Error: The following fields in $CONTROL/control are missing a ':'" + echo " $bad_fields" + echo "ipkg-build: This may be due to a missing initial space for a multi-line field value" + PKG_ERROR=1 + fi + + for script in $CONTROL/preinst $CONTROL/postinst $CONTROL/prerm $CONTROL/postrm; do + if [ -f $script -a ! -x $script ]; then + echo "ipkg-build: Error: package script $script is not executable" + PKG_ERROR=1 + fi + done + + if [ -f $CONTROL/conffiles ]; then + for cf in `cat $CONTROL/conffiles`; do + if [ ! -f ./$cf ]; then + echo "ipkg-build: Error: $CONTROL/conffiles mentions conffile $cf which does not exist" + PKG_ERROR=1 + fi + done + fi + + cd $owd + return $PKG_ERROR +} + +### +# ipkg-build "main" +### + +case $# in +1) + dest_dir=. + ;; +2) + dest_dir=$2 + ;; +*) + echo "Usage: ipkg-build []" ; + exit 1 + ;; +esac + +pkg_dir=$1 + +if [ ! -d $pkg_dir ]; then + echo "ipkg-build: Error: Directory $pkg_dir does not exist" + exit 1 +fi + +# CONTROL is second so that it takes precedence +CONTROL= +[ -d $pkg_dir/DEBIAN ] && CONTROL=DEBIAN +[ -d $pkg_dir/CONTROL ] && CONTROL=CONTROL +if [ -z "$CONTROL" ]; then + echo "ipkg-build: Error: Directory $pkg_dir has no CONTROL subdirectory." + exit 1 +fi + +if ! pkg_appears_sane $pkg_dir; then + echo "Please fix the above errors and try again." + exit 1 +fi + +tmp_dir=$dest_dir/IPKG_BUILD.$$ +mkdir $tmp_dir + +tar -C $pkg_dir -czf $tmp_dir/data.tar.gz . --exclude=$CONTROL +tar -C $pkg_dir/$CONTROL -czf $tmp_dir/control.tar.gz . + +echo "2.0" > $tmp_dir/debian-binary + +pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk +tar -C $tmp_dir -czf $pkg_file debian-binary data.tar.gz control.tar.gz +rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz +rmdir $tmp_dir + +echo "Packaged contents of $pkg_dir into $pkg_file" diff --git a/package/ipkg/ipkg.mk b/package/ipkg/ipkg.mk new file mode 100644 index 0000000000..10ef207242 --- /dev/null +++ b/package/ipkg/ipkg.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# ipkg +# +################################################################################ + +IPKG_VERSION = 0.99.163 +IPKG_SITE = http://www.handhelds.org/download/packages/ipkg +IPKG_INSTALL_STAGING = YES +IPKG_LICENSE = GPLv2+ +IPKG_LICENSE_FILES = COPYING + +$(eval $(autotools-package)) diff --git a/package/ipmitool/0001-Make-the-package-autoreconfigurable.patch b/package/ipmitool/0001-Make-the-package-autoreconfigurable.patch new file mode 100644 index 0000000000..17b4076269 --- /dev/null +++ b/package/ipmitool/0001-Make-the-package-autoreconfigurable.patch @@ -0,0 +1,38 @@ +From 0d4b9d5d547b4a6e79108ac8c455e01f72a9aefa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Sun, 10 Apr 2016 11:47:14 +0200 +Subject: [PATCH 1/3] Make the package autoreconfigurable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ipmitool is not a compliant GNU package as it does not provide some necessary +files, like NEWS, AUTHORS, etc. + +Therefor set the Automake strictness to foreign to make the package +autoreconfigurable. + +Upstream status: Pending +https://sourceforge.net/p/ipmitool/mailman/message/35004711/ + +Signed-off-by: Jörg Krause +--- + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 94e267a..9f3f7e1 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -33,7 +33,7 @@ DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top + + EXTRA_DIST = $(DOCLIST) + +-AUTOMAKE_OPTIONS = dist-bzip2 ++AUTOMAKE_OPTIONS = dist-bzip2 foreign + + MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \ + config.guess config.sub depcomp install-sh ltmain.sh missing \ +-- +2.8.0 + diff --git a/package/ipmitool/0002-Avoid-wchar_t-redefinition.patch b/package/ipmitool/0002-Avoid-wchar_t-redefinition.patch new file mode 100644 index 0000000000..99598e0a7d --- /dev/null +++ b/package/ipmitool/0002-Avoid-wchar_t-redefinition.patch @@ -0,0 +1,60 @@ +From 7d1863b47877129376f37613d29d3a5ba084af66 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Sat, 2 Apr 2016 19:45:14 +0200 +Subject: [PATCH 2/3] Avoid wchar_t redefinition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The musl C library does not define _WCHAR_T. Use autoconf to check for wchar_t. + +Upstream status: Pending +https://sourceforge.net/p/ipmitool/mailman/message/35007331/ + +Signed-off-by: Jörg Krause +--- + configure.ac | 2 ++ + src/plugins/imb/imbapi.h | 7 ++++++- + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 1d74fcf..c2ba1eb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -22,6 +22,8 @@ AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h paths.h]) + AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/socket.h]) + AC_CHECK_HEADERS([sys/byteorder.h byteswap.h]) + ++AC_CHECK_TYPES([wchar_t]) ++ + AC_C_CONST + AC_C_INLINE + AC_C_BIGENDIAN +diff --git a/src/plugins/imb/imbapi.h b/src/plugins/imb/imbapi.h +index 74975c6..ead8956 100644 +--- a/src/plugins/imb/imbapi.h ++++ b/src/plugins/imb/imbapi.h +@@ -35,6 +35,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *----------------------------------------------------------------------*/ + #ifndef _WINDEFS_H + #define _WINDEFS_H ++ ++#if HAVE_CONFIG_H ++# include ++#endif ++ + #ifndef FALSE + #define FALSE 0 + #endif +@@ -46,7 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #endif + #ifndef WIN32 + /* WIN32 defines this in stdio.h */ +-#ifndef _WCHAR_T ++#if !defined(HAVE_WCHAR_T) + #define _WCHAR_T + typedef long wchar_t; + #endif +-- +2.8.0 + diff --git a/package/ipmitool/0003-Add-missing-linux-param.h-header-include.patch b/package/ipmitool/0003-Add-missing-linux-param.h-header-include.patch new file mode 100644 index 0000000000..a3bd7257fb --- /dev/null +++ b/package/ipmitool/0003-Add-missing-linux-param.h-header-include.patch @@ -0,0 +1,39 @@ +From 661095378b74df564bc621ced4db72b688d87399 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Sat, 2 Apr 2016 19:47:21 +0200 +Subject: [PATCH 3/3] Add missing linux/param.h header include +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes the following build failure under musl: + +imbapi.c: In function 'MapPhysicalMemory': +imbapi.c:109:19: error: 'EXEC_PAGESIZE' undeclared (first use in this function) + # define PAGESIZE EXEC_PAGESIZE + +Upstream status: Pending +https://sourceforge.net/p/ipmitool/mailman/message/35007330/ + +Signed-off-by: Jörg Krause +--- + src/plugins/imb/imbapi.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/plugins/imb/imbapi.c b/src/plugins/imb/imbapi.c +index 899c47a..8a6421d 100644 +--- a/src/plugins/imb/imbapi.c ++++ b/src/plugins/imb/imbapi.c +@@ -95,6 +95,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + #include + #include ++#ifdef __linux__ ++#include ++#endif + #endif + #include "imbapi.h" + #include +-- +2.8.0 + diff --git a/package/ipmitool/0004-Fix-missing-stddef.h-include.patch b/package/ipmitool/0004-Fix-missing-stddef.h-include.patch new file mode 100644 index 0000000000..e58c8b09ea --- /dev/null +++ b/package/ipmitool/0004-Fix-missing-stddef.h-include.patch @@ -0,0 +1,37 @@ +From 2b149f7723fbd6153e6605ea8efb2c9f2940c8e5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Mon, 18 Apr 2016 21:17:26 +0200 +Subject: [PATCH] Fix missing stddef.h include +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Needed for wchar_t. Fixes build error: + +imbapi.h:140:9: error: unknown type name 'wchar_t' + typedef wchar_t WCHAR; + +Upstream status: Pending +https://sourceforge.net/p/ipmitool/mailman/message/35022779/ + +Signed-off-by: Jörg Krause +--- + src/plugins/imb/imbapi.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/plugins/imb/imbapi.h b/src/plugins/imb/imbapi.h +index ead8956..8d0c7ae 100644 +--- a/src/plugins/imb/imbapi.h ++++ b/src/plugins/imb/imbapi.h +@@ -40,6 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # include + #endif + ++#include ++ + #ifndef FALSE + #define FALSE 0 + #endif +-- +2.8.0 + diff --git a/package/ipmiutil/0002-lib-Makefile.am-fix-lanplus-disable.patch b/package/ipmiutil/0002-lib-Makefile.am-fix-lanplus-disable.patch new file mode 100644 index 0000000000..35d1d679ba --- /dev/null +++ b/package/ipmiutil/0002-lib-Makefile.am-fix-lanplus-disable.patch @@ -0,0 +1,38 @@ +From: Baruch Siach +Date: Tue, 27 Oct 2015 14:23:44 +0200 +Subject: [PATCH] lib/Makefile.am: fix lanplus disable + +Protect the install target as well when lanplus is disabled. Fixes the +following installation failure when openssl is missing: + +In file included from lanplus.c:78:0: +./inc/ipmitool/ipmi.h:51:25: fatal error: openssl/evp.h: No such file or directory + +Patch status: sent upstream +(http://sourceforge.net/p/ipmiutil/mailman/message/34572580/) + +Signed-off-by: Baruch Siach +--- + lib/Makefile.am | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lib/Makefile.am b/lib/Makefile.am +index 805a218ab7eb..939594cfd3e5 100644 +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -51,8 +51,10 @@ distclean: + cd lanplus; make distclean + + install: +- $(MKDIR) ${datato} +- cd lanplus; make install ++ if [ "$(PLUSFLAGS)" = "-DHAVE_LANPLUS" ]; then \ ++ $(MKDIR) ${datato} ; \ ++ cd lanplus; make install ; \ ++ fi + + check: + +-- +2.6.1 + diff --git a/package/ipmiutil/0003-configure.ac-fix-stack-protector-test.patch b/package/ipmiutil/0003-configure.ac-fix-stack-protector-test.patch new file mode 100644 index 0000000000..d6ad6045dd --- /dev/null +++ b/package/ipmiutil/0003-configure.ac-fix-stack-protector-test.patch @@ -0,0 +1,45 @@ +From: Baruch Siach +Date: Tue, 27 Oct 2015 13:58:24 +0200 +Subject: [PATCH] configure.ac: fix stack protector test + +gcc does not generate stack protection check code for function that does not +use its stack. Some toolchain (most notable uClibc based) accept the +-fstack-protector option, but don't provide libssp. The current test will +incorrectly identify this case, leading to link failures like: + +ipmiutil.o: In function `main': +ipmiutil.c:(.text.startup+0x1c0): undefined reference to +`__stack_chk_fail_local' +ialarms.o: In function `get_alarms_picmg': +ialarms.c:(.text+0x1c5): undefined reference to `__stack_chk_fail_local' +ialarms.o: In function `.L46': +ialarms.c:(.text+0x362): undefined reference to `__stack_chk_fail_local' +ialarms.o: In function `get_enc_leds': +ialarms.c:(.text+0x45f): undefined reference to `__stack_chk_fail_local' + +Add stack usage code to the test to correctly identify missing libssp. + +Patch status: sent upstream +(http://sourceforge.net/p/ipmiutil/mailman/message/34572536/) + +Signed-off-by: Baruch Siach +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 41b6ea89167a..f3f60fb9ff69 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -334,7 +334,7 @@ else + rm -f $tmpc $tmpo >/dev/null 2>&1 + echo $ECHO_N "checking compile fortify flags ... $ECHO_C" + cfhard="-fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2" +- echo "int main() { return(1); }" >$tmpc ++ echo "int main() { alloca(100); return(1); }" >$tmpc + $CC -o $tmpo $cfhard $tmpc >/dev/null 2>&1 + if test $? -ne 0 ; then + cfhard= +-- +2.6.1 + diff --git a/package/iproute2/0001-Avoid-in6_addr-redefinition.patch b/package/iproute2/0001-Avoid-in6_addr-redefinition.patch new file mode 100644 index 0000000000..3417339b2b --- /dev/null +++ b/package/iproute2/0001-Avoid-in6_addr-redefinition.patch @@ -0,0 +1,79 @@ +From 48596709d8ab59727b79a5c6db33ebb251c36543 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Thu, 19 Nov 2015 17:44:25 +0100 +Subject: [PATCH] Avoid in6_addr redefinition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Due to both and being included, the +in6_addr is being redefined: once from the C library headers and once +from the kernel headers. This causes some build failures with for +example the musl C library: + +In file included from ../include/linux/xfrm.h:4:0, + from xfrm.h:29, + from ipxfrm.c:39: +../include/linux/in6.h:32:8: error: redefinition of ‘struct in6_addr’ + struct in6_addr { + ^ +In file included from .../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netdb.h:9:0, + from ipxfrm.c:34: +.../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:24:8: note: originally defined here + struct in6_addr + ^ + +In order to fix this, use just the C library header . + +Original patch taken from +http://git.alpinelinux.org/cgit/aports/tree/main/iproute2/musl-fixes.patch. + +Signed-off-by: Thomas Petazzoni +[Gustavo: drop ipt_kernel_headers.h chunk since no longer necessary] +Signed-off-by: Gustavo Zacarias +--- + include/linux/if_bridge.h | 1 - + include/linux/netfilter.h | 2 -- + include/linux/xfrm.h | 1 - + 3 files changed, 4 deletions(-) + +diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h +index ee197a3..f823aa4 100644 +--- a/include/linux/if_bridge.h ++++ b/include/linux/if_bridge.h +@@ -15,7 +15,6 @@ + + #include + #include +-#include + + #define SYSFS_BRIDGE_ATTR "bridge" + #define SYSFS_BRIDGE_FDB "brforward" +diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h +index b71b4c9..3e4e6ae 100644 +--- a/include/linux/netfilter.h ++++ b/include/linux/netfilter.h +@@ -4,8 +4,6 @@ + #include + + #include +-#include +-#include + + /* Responses from hook functions. */ + #define NF_DROP 0 +diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h +index b8f5451..a9761a5 100644 +--- a/include/linux/xfrm.h ++++ b/include/linux/xfrm.h +@@ -1,7 +1,6 @@ + #ifndef _LINUX_XFRM_H + #define _LINUX_XFRM_H + +-#include + #include + + /* All of the structures in this file may not change size as they are +-- +2.6.3 + diff --git a/package/iproute2/0003-iproute2-tc_bpf.c-fix-building-with-musl-libc..patch b/package/iproute2/0003-iproute2-tc_bpf.c-fix-building-with-musl-libc..patch new file mode 100644 index 0000000000..0342abef33 --- /dev/null +++ b/package/iproute2/0003-iproute2-tc_bpf.c-fix-building-with-musl-libc..patch @@ -0,0 +1,37 @@ +From 01b287582f25cc3a8a36caee5ce13e14b9233f49 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Fri, 8 Apr 2016 09:52:55 -0300 +Subject: [PATCH] iproute2: tc_bpf.c: fix building with musl libc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We need limits.h for PATH_MAX, fixes: + +tc_bpf.c: In function ‘bpf_map_selfcheck_pinned’: +tc_bpf.c:222:12: error: ‘PATH_MAX’ undeclared (first use in this +function) + char file[PATH_MAX], buff[4096]; + +Signed-off-by: Gustavo Zacarias +--- +Patch status: submitted upstream + + tc/tc_bpf.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tc/tc_bpf.c b/tc/tc_bpf.c +index d94af82..042e76f 100644 +--- a/tc/tc_bpf.c ++++ b/tc/tc_bpf.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_ELF + #include +-- +2.7.3 + diff --git a/package/iproute2/0004-iproute-no-iptables.patch b/package/iproute2/0004-iproute-no-iptables.patch new file mode 100644 index 0000000000..7f7f37b1d4 --- /dev/null +++ b/package/iproute2/0004-iproute-no-iptables.patch @@ -0,0 +1,48 @@ +Fix build issues when there's no iptables present. + +Patch from Matt Whitlock +See https://bugs.gentoo.org/show_bug.cgi?id=577464 +Status: in theory submitted upstream by Lars Wendler. + +--- iproute2-4.5.0/configure~ 2016-03-14 23:02:31.000000000 +0000 ++++ iproute2-4.5.0/configure 2016-03-17 13:24:17.634743197 +0000 +@@ -169,10 +169,25 @@ + + check_ipt() + { +- if ! grep TC_CONFIG_XT Config > /dev/null ++ if grep -q TC_CONFIG_XT Config + then ++ return ++ fi ++ ++ cat >$TMPDIR/ipttest.c < ++int main() { return 0; } ++EOF ++ ++ if $CC -std=c90 -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL \ ++ $(${PKG_CONFIG} libiptc --cflags --libs 2>/dev/null) -ldl >/dev/null 2>&1 ++ then ++ echo "TC_CONFIG_IPT:=y" >>Config + echo "using iptables" ++ else ++ echo "no" + fi ++ rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest + } + + check_ipt_lib_dir() +--- iproute2-4.5.0/tc/Makefile~ 2016-03-14 23:02:31.000000000 +0000 ++++ iproute2-4.5.0/tc/Makefile 2016-03-17 13:18:18.686689985 +0000 +@@ -88,7 +88,9 @@ + CFLAGS += -DTC_CONFIG_XT_H + TCSO += m_xt_old.so + else +- TCMODULES += m_ipt.o ++ ifeq ($(TC_CONFIG_IPT),y) ++ TCMODULES += m_ipt.o ++ endif + endif + endif + endif diff --git a/package/iptables/0001-fix-build-with-musl.patch b/package/iptables/0001-fix-build-with-musl.patch new file mode 100644 index 0000000000..d5e0c2ed6c --- /dev/null +++ b/package/iptables/0001-fix-build-with-musl.patch @@ -0,0 +1,67 @@ +From 2f2fde48594ec34e93ab409cd83442efe58e10ad Mon Sep 17 00:00:00 2001 +From: Brendan Heading +Date: Mon, 31 Aug 2015 15:24:44 +0100 +Subject: [PATCH 3/3] fix build with musl + +Add needed headers they are just not needed for glibc6+ but also +for musl +Define additional TCOPTS if not there + +u_initX types are in sys/types.h be explicit about it + +Upstream-Status: Pending + +bh: this is a copy of the patch at the link below, modified to remove +the changes to include/libiptc/ipt_kernel_headers.h as these are +already integrated in the upstream tree. See : + +http://lists.openembedded.org/pipermail/openembedded-core/2015-April/103613.html + +Signed-off-by: Khem Raj +Signed-off-by: Brendan Heading +--- + extensions/libxt_TCPOPTSTRIP.c | 15 +++++++++++++++ + include/linux/netfilter_ipv4/ip_tables.h | 1 + + 2 files changed, 16 insertions(+) + +diff --git a/extensions/libxt_TCPOPTSTRIP.c b/extensions/libxt_TCPOPTSTRIP.c +index 6897857..8a170b2 100644 +--- a/extensions/libxt_TCPOPTSTRIP.c ++++ b/extensions/libxt_TCPOPTSTRIP.c +@@ -12,6 +12,21 @@ + #ifndef TCPOPT_MD5SIG + # define TCPOPT_MD5SIG 19 + #endif ++#ifndef TCPOPT_MAXSEG ++# define TCPOPT_MAXSEG 2 ++#endif ++#ifndef TCPOPT_WINDOW ++# define TCPOPT_WINDOW 3 ++#endif ++#ifndef TCPOPT_SACK_PERMITTED ++# define TCPOPT_SACK_PERMITTED 4 ++#endif ++#ifndef TCPOPT_SACK ++# define TCPOPT_SACK 5 ++#endif ++#ifndef TCPOPT_TIMESTAMP ++# define TCPOPT_TIMESTAMP 8 ++#endif + + enum { + O_STRIP_OPTION = 0, +diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h +index 57fd82a..4807246 100644 +--- a/include/linux/netfilter_ipv4/ip_tables.h ++++ b/include/linux/netfilter_ipv4/ip_tables.h +@@ -15,6 +15,7 @@ + #ifndef _IPTABLES_H + #define _IPTABLES_H + ++#include + #include + + #include +-- +2.4.3 + diff --git a/package/iptables/0002-iptables-add-xtables-config-parser.h-to-BUILT_SOURCES.patch b/package/iptables/0002-iptables-add-xtables-config-parser.h-to-BUILT_SOURCES.patch new file mode 100644 index 0000000000..761c04894f --- /dev/null +++ b/package/iptables/0002-iptables-add-xtables-config-parser.h-to-BUILT_SOURCES.patch @@ -0,0 +1,39 @@ +From 4dc8e2aa91bd4151f7e5cd56d88d3731b4c1525e Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Wed, 30 Dec 2015 14:39:35 -0300 +Subject: [PATCH] iptables: add xtables-config-parser.h to BUILT_SOURCES + +Otherwise other sources that use it might be built before it's ready leading +to build failure, for example by iptables/nft.c + +Signed-off-by: Gustavo Zacarias +--- +Status: sent upstream (mailing list, no link yet) + + iptables/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/iptables/Makefile.am b/iptables/Makefile.am +index 3c0faa5..c3eb8a8 100644 +--- a/iptables/Makefile.am ++++ b/iptables/Makefile.am +@@ -4,6 +4,8 @@ AM_CFLAGS = ${regular_CFLAGS} + AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS} + AM_YFLAGS = -d + ++BUILT_SOURCES = ++ + xtables_multi_SOURCES = xtables-multi.c iptables-xml.c + xtables_multi_CFLAGS = ${AM_CFLAGS} + xtables_multi_LDADD = ../extensions/libext.a +@@ -27,6 +29,7 @@ xtables_multi_LDADD += ../libxtables/libxtables.la -lm + + # nftables compatibility layer + if ENABLE_NFTABLES ++BUILT_SOURCES += xtables-config-parser.h + xtables_compat_multi_SOURCES = xtables-compat-multi.c iptables-xml.c + xtables_compat_multi_CFLAGS = ${AM_CFLAGS} + xtables_compat_multi_LDADD = ../extensions/libext.a ../extensions/libext_ebt.a +-- +2.4.10 + diff --git a/package/jack2/0001-Add-support-for-nios2.patch b/package/jack2/0001-Add-support-for-nios2.patch new file mode 100644 index 0000000000..f6d60af215 --- /dev/null +++ b/package/jack2/0001-Add-support-for-nios2.patch @@ -0,0 +1,34 @@ +From 3651f95d0433c84d2b67e30e68dd6140585535b0 Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls +Date: Tue, 19 Apr 2016 19:32:35 +0200 +Subject: [PATCH 1/1] Add support for nios2 + +When compiling jack on nios2, compilation fails because NGREGS is not +defined. Since this is only for debug output on segmentation faults, stub +the debug print out like it's been done for other platforms before. + +Inspired by +https://github.com/jackaudio/jack2/commit/d11bb095291d8880508c87adfe625bf2bcab1456 + +Signed-off-by: Bernd Kuhls +[Patch sent upstream: https://github.com/jackaudio/jack2/pull/199] +--- + dbus/sigsegv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c +index 64c3986..ee12f91 100644 +--- a/dbus/sigsegv.c ++++ b/dbus/sigsegv.c +@@ -104,7 +104,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) { + jack_error("info.si_errno = %d", info->si_errno); + jack_error("info.si_code = %d (%s)", info->si_code, si_code_str); + jack_error("info.si_addr = %p", info->si_addr); +-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__) ++#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__) && !defined(nios2) + for(i = 0; i < NGREG; i++) + jack_error("reg[%02d] = 0x" REGFORMAT, i, + #if defined(__powerpc64__) +-- +2.8.0.rc3 + diff --git a/package/jamvm/0001-Use-fenv.h-instead-of-fpu_control.h.patch b/package/jamvm/0001-Use-fenv.h-instead-of-fpu_control.h.patch new file mode 100644 index 0000000000..50f95cde57 --- /dev/null +++ b/package/jamvm/0001-Use-fenv.h-instead-of-fpu_control.h.patch @@ -0,0 +1,86 @@ +From 7152ded5219453c9ff1cd062cecbeaf4d77e4cab Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Thu, 26 May 2016 15:05:48 +0200 +Subject: [PATCH] Use instead of + +musl libc (http://musl-libc.org lack the non-standard +header, which is used in src/os/linux/{i386,x86_64}/init.c files to +setup the floating point precision. This patch makes it use the +standard C header instead. + +Original patch at Felix Janda at +https://sourceforge.net/p/jamvm/patches/6/. + +Signed-off-by: Thomas Petazzoni +--- + src/os/linux/i386/init.c | 12 ++++++------ + src/os/linux/x86_64/init.c | 16 ++++++---------- + 2 files changed, 12 insertions(+), 16 deletions(-) + +diff --git a/src/os/linux/i386/init.c b/src/os/linux/i386/init.c +index d9c6648..94a733e 100644 +--- a/src/os/linux/i386/init.c ++++ b/src/os/linux/i386/init.c +@@ -19,18 +19,18 @@ + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +-#include ++#include + + /* Change floating point precision to double (64-bit) from + * the extended (80-bit) Linux default. */ + + void setDoublePrecision() { +- fpu_control_t cw; ++ fenv_t fenv; + +- _FPU_GETCW(cw); +- cw &= ~_FPU_EXTENDED; +- cw |= _FPU_DOUBLE; +- _FPU_SETCW(cw); ++ fegetenv(&fenv); ++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */ ++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */ ++ fesetenv(&fenv); + } + + void initialisePlatform() { +diff --git a/src/os/linux/x86_64/init.c b/src/os/linux/x86_64/init.c +index 9d55229..a76a923 100644 +--- a/src/os/linux/x86_64/init.c ++++ b/src/os/linux/x86_64/init.c +@@ -19,9 +19,7 @@ + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +-#ifdef __linux__ +-#include +-#endif ++#include + + /* Change the x87 FPU precision to double (64-bit) from the extended + (80-bit) Linux default. Note, unlike on i386, my testcases pass +@@ -30,14 +28,12 @@ + */ + + void setDoublePrecision() { +-#ifdef __linux__ +- fpu_control_t cw; ++ fenv_t fenv; + +- _FPU_GETCW(cw); +- cw &= ~_FPU_EXTENDED; +- cw |= _FPU_DOUBLE; +- _FPU_SETCW(cw); +-#endif ++ fegetenv(&fenv); ++ fenv.__control_word &= ~0x300; /*_FPU_EXTENDED */ ++ fenv.__control_word |= 0x200; /*_FPU_DOUBLE */ ++ fesetenv(&fenv); + } + + void initialisePlatform() { +-- +2.7.4 + diff --git a/package/jasper/0001-fix-CVE-2014-9029.patch b/package/jasper/0001-fix-CVE-2014-9029.patch new file mode 100644 index 0000000000..c2e95a8d14 --- /dev/null +++ b/package/jasper/0001-fix-CVE-2014-9029.patch @@ -0,0 +1,36 @@ +Fix CVE-2014-9029 + +Patch taken from https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2014-9029 + +Signed-off-by: Baruch Siach +--- + +--- jasper-1.900.1.orig/src/libjasper/jpc/jpc_dec.c 2014-11-27 12:45:44.000000000 +0100 ++++ jasper-1.900.1.orig/src/libjasper/jpc/jpc_dec.c 2014-11-27 12:44:58.000000000 +0100 +@@ -1281,7 +1281,7 @@ static int jpc_dec_process_coc(jpc_dec_t + jpc_coc_t *coc = &ms->parms.coc; + jpc_dec_tile_t *tile; + +- if (JAS_CAST(int, coc->compno) > dec->numcomps) { ++ if (JAS_CAST(int, coc->compno) >= dec->numcomps) { + jas_eprintf("invalid component number in COC marker segment\n"); + return -1; + } +@@ -1307,7 +1307,7 @@ static int jpc_dec_process_rgn(jpc_dec_t + jpc_rgn_t *rgn = &ms->parms.rgn; + jpc_dec_tile_t *tile; + +- if (JAS_CAST(int, rgn->compno) > dec->numcomps) { ++ if (JAS_CAST(int, rgn->compno) >= dec->numcomps) { + jas_eprintf("invalid component number in RGN marker segment\n"); + return -1; + } +@@ -1356,7 +1356,7 @@ static int jpc_dec_process_qcc(jpc_dec_t + jpc_qcc_t *qcc = &ms->parms.qcc; + jpc_dec_tile_t *tile; + +- if (JAS_CAST(int, qcc->compno) > dec->numcomps) { ++ if (JAS_CAST(int, qcc->compno) >= dec->numcomps) { + jas_eprintf("invalid component number in QCC marker segment\n"); + return -1; + } diff --git a/package/jasper/0002-fix-CVE-2014-8138.patch b/package/jasper/0002-fix-CVE-2014-8138.patch new file mode 100644 index 0000000000..e107123ce8 --- /dev/null +++ b/package/jasper/0002-fix-CVE-2014-8138.patch @@ -0,0 +1,18 @@ +See https://bugzilla.redhat.com/show_bug.cgi?id=1173162 + +Signed-off-by: Gustavo Zacarias + +--- jasper-1.900.1.orig/src/libjasper/jp2/jp2_dec.c 2014-12-11 14:06:44.000000000 +0100 ++++ jasper-1.900.1/src/libjasper/jp2/jp2_dec.c 2014-12-11 14:06:26.000000000 +0100 +@@ -386,6 +386,11 @@ jas_image_t *jp2_decode(jas_stream_t *in + /* Determine the type of each component. */ + if (dec->cdef) { + for (i = 0; i < dec->numchans; ++i) { ++ /* Is the channel number reasonable? */ ++ if (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) { ++ jas_eprintf("error: invalid channel number in CDEF box\n"); ++ goto error; ++ } + jas_image_setcmpttype(dec->image, + dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo], + jp2_getct(jas_image_clrspc(dec->image), diff --git a/package/jasper/0003-fix-CVE-2014-8137-1.patch b/package/jasper/0003-fix-CVE-2014-8137-1.patch new file mode 100644 index 0000000000..0253c62839 --- /dev/null +++ b/package/jasper/0003-fix-CVE-2014-8137-1.patch @@ -0,0 +1,47 @@ +See https://bugzilla.redhat.com/show_bug.cgi?id=1173157 + +Signed-off-by: Gustavo Zacarias + +--- jasper-1.900.1.orig/src/libjasper/base/jas_icc.c 2014-12-11 14:06:44.000000000 +0100 ++++ jasper-1.900.1/src/libjasper/base/jas_icc.c 2014-12-11 15:16:37.971272386 +0100 +@@ -1009,7 +1009,6 @@ static int jas_icccurv_input(jas_iccattr + return 0; + + error: +- jas_icccurv_destroy(attrval); + return -1; + } + +@@ -1127,7 +1126,6 @@ static int jas_icctxtdesc_input(jas_icca + #endif + return 0; + error: +- jas_icctxtdesc_destroy(attrval); + return -1; + } + +@@ -1206,8 +1204,6 @@ static int jas_icctxt_input(jas_iccattrv + goto error; + return 0; + error: +- if (txt->string) +- jas_free(txt->string); + return -1; + } + +@@ -1328,7 +1324,6 @@ static int jas_icclut8_input(jas_iccattr + goto error; + return 0; + error: +- jas_icclut8_destroy(attrval); + return -1; + } + +@@ -1497,7 +1492,6 @@ static int jas_icclut16_input(jas_iccatt + goto error; + return 0; + error: +- jas_icclut16_destroy(attrval); + return -1; + } + diff --git a/package/jasper/0004-fix-CVE-2014-8137-2.patch b/package/jasper/0004-fix-CVE-2014-8137-2.patch new file mode 100644 index 0000000000..e052709d55 --- /dev/null +++ b/package/jasper/0004-fix-CVE-2014-8137-2.patch @@ -0,0 +1,18 @@ +See https://bugzilla.redhat.com/show_bug.cgi?id=1173157 + +Signed-off-by: Gustavo Zacarias + +--- jasper-1.900.1.orig/src/libjasper/jp2/jp2_dec.c 2014-12-11 14:30:54.193209780 +0100 ++++ jasper-1.900.1/src/libjasper/jp2/jp2_dec.c 2014-12-11 14:36:46.313217814 +0100 +@@ -291,7 +291,10 @@ jas_image_t *jp2_decode(jas_stream_t *in + case JP2_COLR_ICC: + iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp, + dec->colr->data.colr.iccplen); +- assert(iccprof); ++ if (!iccprof) { ++ jas_eprintf("error: failed to parse ICC profile\n"); ++ goto error; ++ } + jas_iccprof_gethdr(iccprof, &icchdr); + jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc); + jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc)); diff --git a/package/jasper/0005-fix-CVE-2014-8157.patch b/package/jasper/0005-fix-CVE-2014-8157.patch new file mode 100644 index 0000000000..ab81674f93 --- /dev/null +++ b/package/jasper/0005-fix-CVE-2014-8157.patch @@ -0,0 +1,17 @@ +Fix CVE-2014-8157 - dec->numtiles off-by-one check in jpc_dec_process_sot() +From https://bugzilla.redhat.com/show_bug.cgi?id=1179282 + +Signed-off-by: Gustavo Zacarias + +diff -up jasper-1.900.1/src/libjasper/jpc/jpc_dec.c.CVE-2014-8157 jasper-1.900.1/src/libjasper/jpc/jpc_dec.c +--- jasper-1.900.1/src/libjasper/jpc/jpc_dec.c.CVE-2014-8157 2015-01-19 16:59:36.000000000 +0100 ++++ jasper-1.900.1/src/libjasper/jpc/jpc_dec.c 2015-01-19 17:07:41.609863268 +0100 +@@ -489,7 +489,7 @@ static int jpc_dec_process_sot(jpc_dec_t + dec->curtileendoff = 0; + } + +- if (JAS_CAST(int, sot->tileno) > dec->numtiles) { ++ if (JAS_CAST(int, sot->tileno) >= dec->numtiles) { + jas_eprintf("invalid tile number in SOT marker segment\n"); + return -1; + } diff --git a/package/jasper/0006-fix-CVE-2014-8158.patch b/package/jasper/0006-fix-CVE-2014-8158.patch new file mode 100644 index 0000000000..8413d2ef93 --- /dev/null +++ b/package/jasper/0006-fix-CVE-2014-8158.patch @@ -0,0 +1,334 @@ +Fix CVE-2014-8158 - unrestricted stack memory use in jpc_qmfb.c +From https://bugzilla.redhat.com/show_bug.cgi?id=1179298 + +Signed-off-by: Gustavo Zacarias + +diff -up jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c.CVE-2014-8158 jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c +--- jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c.CVE-2014-8158 2015-01-19 17:25:28.730195502 +0100 ++++ jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c 2015-01-19 17:27:20.214663127 +0100 +@@ -306,11 +306,7 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in + { + + int bufsize = JPC_CEILDIVPOW2(numcols, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; +-#else +- jpc_fix_t splitbuf[bufsize]; +-#endif + jpc_fix_t *buf = splitbuf; + register jpc_fix_t *srcptr; + register jpc_fix_t *dstptr; +@@ -318,7 +314,6 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in + register int m; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Get a buffer. */ + if (bufsize > QMFB_SPLITBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { +@@ -326,7 +321,6 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in + abort(); + } + } +-#endif + + if (numcols >= 2) { + hstartcol = (numcols + 1 - parity) >> 1; +@@ -360,12 +354,10 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in + } + } + +-#if !defined(HAVE_VLA) + /* If the split buffer was allocated on the heap, free this memory. */ + if (buf != splitbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -374,11 +366,7 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in + { + + int bufsize = JPC_CEILDIVPOW2(numrows, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; +-#else +- jpc_fix_t splitbuf[bufsize]; +-#endif + jpc_fix_t *buf = splitbuf; + register jpc_fix_t *srcptr; + register jpc_fix_t *dstptr; +@@ -386,7 +374,6 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in + register int m; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Get a buffer. */ + if (bufsize > QMFB_SPLITBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { +@@ -394,7 +381,6 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in + abort(); + } + } +-#endif + + if (numrows >= 2) { + hstartcol = (numrows + 1 - parity) >> 1; +@@ -428,12 +414,10 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in + } + } + +-#if !defined(HAVE_VLA) + /* If the split buffer was allocated on the heap, free this memory. */ + if (buf != splitbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -442,11 +426,7 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, + { + + int bufsize = JPC_CEILDIVPOW2(numrows, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; +-#else +- jpc_fix_t splitbuf[bufsize * JPC_QMFB_COLGRPSIZE]; +-#endif + jpc_fix_t *buf = splitbuf; + jpc_fix_t *srcptr; + jpc_fix_t *dstptr; +@@ -457,7 +437,6 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, + int m; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Get a buffer. */ + if (bufsize > QMFB_SPLITBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { +@@ -465,7 +444,6 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, + abort(); + } + } +-#endif + + if (numrows >= 2) { + hstartcol = (numrows + 1 - parity) >> 1; +@@ -517,12 +495,10 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, + } + } + +-#if !defined(HAVE_VLA) + /* If the split buffer was allocated on the heap, free this memory. */ + if (buf != splitbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -531,11 +507,7 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, + { + + int bufsize = JPC_CEILDIVPOW2(numrows, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; +-#else +- jpc_fix_t splitbuf[bufsize * numcols]; +-#endif + jpc_fix_t *buf = splitbuf; + jpc_fix_t *srcptr; + jpc_fix_t *dstptr; +@@ -546,7 +518,6 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, + int m; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Get a buffer. */ + if (bufsize > QMFB_SPLITBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { +@@ -554,7 +525,6 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, + abort(); + } + } +-#endif + + if (numrows >= 2) { + hstartcol = (numrows + 1 - parity) >> 1; +@@ -606,12 +576,10 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, + } + } + +-#if !defined(HAVE_VLA) + /* If the split buffer was allocated on the heap, free this memory. */ + if (buf != splitbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -619,18 +587,13 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int + { + + int bufsize = JPC_CEILDIVPOW2(numcols, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; +-#else +- jpc_fix_t joinbuf[bufsize]; +-#endif + jpc_fix_t *buf = joinbuf; + register jpc_fix_t *srcptr; + register jpc_fix_t *dstptr; + register int n; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Allocate memory for the join buffer from the heap. */ + if (bufsize > QMFB_JOINBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { +@@ -638,7 +601,6 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int + abort(); + } + } +-#endif + + hstartcol = (numcols + 1 - parity) >> 1; + +@@ -670,12 +632,10 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int + ++srcptr; + } + +-#if !defined(HAVE_VLA) + /* If the join buffer was allocated on the heap, free this memory. */ + if (buf != joinbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -684,18 +644,13 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int + { + + int bufsize = JPC_CEILDIVPOW2(numrows, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; +-#else +- jpc_fix_t joinbuf[bufsize]; +-#endif + jpc_fix_t *buf = joinbuf; + register jpc_fix_t *srcptr; + register jpc_fix_t *dstptr; + register int n; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Allocate memory for the join buffer from the heap. */ + if (bufsize > QMFB_JOINBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { +@@ -703,7 +658,6 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int + abort(); + } + } +-#endif + + hstartcol = (numrows + 1 - parity) >> 1; + +@@ -735,12 +689,10 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int + ++srcptr; + } + +-#if !defined(HAVE_VLA) + /* If the join buffer was allocated on the heap, free this memory. */ + if (buf != joinbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -749,11 +701,7 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, + { + + int bufsize = JPC_CEILDIVPOW2(numrows, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; +-#else +- jpc_fix_t joinbuf[bufsize * JPC_QMFB_COLGRPSIZE]; +-#endif + jpc_fix_t *buf = joinbuf; + jpc_fix_t *srcptr; + jpc_fix_t *dstptr; +@@ -763,7 +711,6 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, + register int i; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Allocate memory for the join buffer from the heap. */ + if (bufsize > QMFB_JOINBUFSIZE) { + if (!(buf = jas_alloc2(bufsize, JPC_QMFB_COLGRPSIZE * sizeof(jpc_fix_t)))) { +@@ -771,7 +718,6 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, + abort(); + } + } +-#endif + + hstartcol = (numrows + 1 - parity) >> 1; + +@@ -821,12 +767,10 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, + srcptr += JPC_QMFB_COLGRPSIZE; + } + +-#if !defined(HAVE_VLA) + /* If the join buffer was allocated on the heap, free this memory. */ + if (buf != joinbuf) { + jas_free(buf); + } +-#endif + + } + +@@ -835,11 +779,7 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, + { + + int bufsize = JPC_CEILDIVPOW2(numrows, 1); +-#if !defined(HAVE_VLA) + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; +-#else +- jpc_fix_t joinbuf[bufsize * numcols]; +-#endif + jpc_fix_t *buf = joinbuf; + jpc_fix_t *srcptr; + jpc_fix_t *dstptr; +@@ -849,7 +789,6 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, + register int i; + int hstartcol; + +-#if !defined(HAVE_VLA) + /* Allocate memory for the join buffer from the heap. */ + if (bufsize > QMFB_JOINBUFSIZE) { + if (!(buf = jas_alloc3(bufsize, numcols, sizeof(jpc_fix_t)))) { +@@ -857,7 +796,6 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, + abort(); + } + } +-#endif + + hstartcol = (numrows + 1 - parity) >> 1; + +@@ -907,12 +845,10 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, + srcptr += numcols; + } + +-#if !defined(HAVE_VLA) + /* If the join buffer was allocated on the heap, free this memory. */ + if (buf != joinbuf) { + jas_free(buf); + } +-#endif + + } + diff --git a/package/jasper/0007-preserve-cflags.patch b/package/jasper/0007-preserve-cflags.patch new file mode 100644 index 0000000000..7e4c4a26f0 --- /dev/null +++ b/package/jasper/0007-preserve-cflags.patch @@ -0,0 +1,27 @@ +From: Max Filippov +Subject: Don't overwrite CFLAGS when configured with --enable-debug + +This drops architecture-specific ABI flags, which may be important. + +Signded-off-by: Max Filippov + +--- jasper-1.900.1/configure.ac.orig 2015-05-18 22:27:53.057512760 +0300 ++++ jasper-1.900.1/configure.ac 2015-05-18 22:28:36.090415422 +0300 +@@ -327,7 +327,7 @@ + AC_DEFINE(DEBUG) + AC_DEFINE(DEBUG_OVERFLOW) + if test "$GCC" = yes; then +- CFLAGS="-g -O0" ++ CFLAGS="$CFLAGS -g -O0" + fi + ;; + no) +@@ -357,7 +357,7 @@ + case "${enableval}" in + yes) + if test "$GCC" = yes; then +- CFLAGS="-g -O0" ++ CFLAGS="$CFLAGS -g -O0" + fi + ;; + no) diff --git a/package/jsoncpp/0001-CMakeLists.txt-Treat-conversion-warning-as-error-onl.patch b/package/jsoncpp/0001-CMakeLists.txt-Treat-conversion-warning-as-error-onl.patch new file mode 100644 index 0000000000..3e009b93a6 --- /dev/null +++ b/package/jsoncpp/0001-CMakeLists.txt-Treat-conversion-warning-as-error-onl.patch @@ -0,0 +1,37 @@ +From 98a7f56ed41071240274063b2d4e39e4e1c9589f Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls +Date: Mon, 25 Apr 2016 19:41:28 +0200 +Subject: [PATCH 1/1] CMakeLists.txt: Treat conversion warning as error only + with JSONCPP_WITH_WARNING_AS_ERROR=On + +Fixes errors when building with buildroot: +http://autobuild.buildroot.net/?reason=jsoncpp-1.7.2 + +Signed-off-by: Bernd Kuhls +(Patch sent upstream: + https://github.com/open-source-parsers/jsoncpp/pull/466) +--- + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7787850..637fc34 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -107,11 +107,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # using GCC +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra") + # not yet ready for -Wsign-conversion + + if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion -pedantic") + endif () + endif() + +-- +2.8.0.rc3 + diff --git a/package/kodi-addon-xvdr/0001-xbmc-rebrand.patch b/package/kodi-addon-xvdr/0001-xbmc-rebrand.patch new file mode 100644 index 0000000000..6e87b79b64 --- /dev/null +++ b/package/kodi-addon-xvdr/0001-xbmc-rebrand.patch @@ -0,0 +1,19 @@ +Update for Kodi + +Ported from OpenELEC: +https://github.com/OpenELEC/OpenELEC.tv/blob/master/packages/mediacenter/kodi-addon-xvdr/patches/kodi-addon-xvdr-xbmc-rebrand.patch + +Signed-off-by: Bernd Kuhls + +diff -Naur xbmc-addon-xvdr-2bf2563/configure.ac xbmc-addon-xvdr-2bf2563.patch/configure.ac +--- xbmc-addon-xvdr-2bf2563/configure.ac 2014-10-18 22:02:18.000000000 +0200 ++++ xbmc-addon-xvdr-2bf2563.patch/configure.ac 2014-10-20 03:03:20.525526996 +0200 +@@ -6,7 +6,7 @@ + AC_INIT([xbmc-addon-xvdr], [MAJOR.MINOR.MICRO], [alexander.pipelka@gmail.com]) + + AC_CONFIG_AUX_DIR(autotools) +-AC_PREFIX_DEFAULT(/usr/lib/xbmc) ++AC_PREFIX_DEFAULT(/usr/lib/kodi) + + AC_CANONICAL_HOST + AC_CANONICAL_TARGET diff --git a/package/kodi-addon-xvdr/Config.in b/package/kodi-addon-xvdr/Config.in new file mode 100644 index 0000000000..85e9d600c8 --- /dev/null +++ b/package/kodi-addon-xvdr/Config.in @@ -0,0 +1,16 @@ +config BR2_PACKAGE_KODI_ADDON_XVDR + bool "kodi-addon-xvdr" + # upstream discontinued the development + depends on BR2_DEPRECATED_SINCE_2016_05 + help + This is a PVR add-on for Kodi to add VDR (http://tvdr.de/) + as a TV/PVR Backend to Kodi. + + It adds support for Live TV watching, replaying of Recordings, + programming Timers and EPG TV Guide to use on same computer or + over the Network. + + https://github.com/pipelka/xbmc-addon-xvdr + + Note: since the VDR server is not packaged in Buildroot, using + this addon requires that a remote VDR server be used. diff --git a/package/kodi-addon-xvdr/kodi-addon-xvdr.hash b/package/kodi-addon-xvdr/kodi-addon-xvdr.hash new file mode 100644 index 0000000000..933c7b8de2 --- /dev/null +++ b/package/kodi-addon-xvdr/kodi-addon-xvdr.hash @@ -0,0 +1,2 @@ +# Locally computed +sha256 783796eccc19c639c59b7a05cad1df705d557993b15cc7e29f7dbbd8388d698b kodi-addon-xvdr-ae66610bc2e1a3efe49f4fa0db55ff3a7808a247.tar.gz diff --git a/package/kodi-addon-xvdr/kodi-addon-xvdr.mk b/package/kodi-addon-xvdr/kodi-addon-xvdr.mk new file mode 100644 index 0000000000..ac7f3cb0b5 --- /dev/null +++ b/package/kodi-addon-xvdr/kodi-addon-xvdr.mk @@ -0,0 +1,26 @@ +################################################################################ +# +# kodi-addon-xvdr +# +################################################################################ + +# This cset is on master. When a Jarvis branch is made, we should +# follow it, as incompatible changes in the plugins API can happen +# on the master branch. +KODI_ADDON_XVDR_VERSION = ae66610bc2e1a3efe49f4fa0db55ff3a7808a247 +KODI_ADDON_XVDR_SITE = $(call github,pipelka,xbmc-addon-xvdr,$(KODI_ADDON_XVDR_VERSION)) +KODI_ADDON_XVDR_LICENSE = GPLv2+ +KODI_ADDON_XVDR_LICENSE_FILES = COPYING + +# There's no ./configure in the git tree, we need to generate it +# kodi-addon-xvdr uses a weird autogen.sh script, which +# is even incorrect (it's missing the #! ) Sigh... :-( +# Fortunately, with our little patch, it autoreconfs nicely! :-) +KODI_ADDON_XVDR_AUTORECONF = YES + +# This really is a runtime dependency, but we need KODI to be installed +# first, since we'll install files in KODI's directories _after_ KODI has +# installed his own files +KODI_ADDON_XVDR_DEPENDENCIES = kodi + +$(eval $(autotools-package)) diff --git a/package/lcdapi/0001-Remove-installation-of-docs-examples.patch b/package/lcdapi/0001-Remove-installation-of-docs-examples.patch new file mode 100644 index 0000000000..dcadcf4a1b --- /dev/null +++ b/package/lcdapi/0001-Remove-installation-of-docs-examples.patch @@ -0,0 +1,39 @@ +From ede0fa7d410be407164b68570a1540378bf0bd09 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 19 Jul 2014 10:40:59 +0200 +Subject: [PATCH] Remove installation of docs/examples + +They get installed in the wrong directory, i.e if DESTDIR is +/path/to/output/target, they will be installed in +/path/to/output/target./examples and /path/to/output/target./docs. + +Since we don't need docs and examples in Buildroot anyway, simply get +rid of them. + +Signed-off-by: Thomas Petazzoni +--- + Makefile.am | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index c56860a..6b1267b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -69,14 +69,3 @@ liblcdapi_la_CXXFLAGS = \ + -g0 -DNODEBUG -Os + + ACLOCAL_AMFLAGS = -I m4 +- +-docsdir = $(top_srcdir)/docs +-exampledir = $(top_srcdir)/example +-dist_docs_DATA = \ +- docs/Makefile.am \ +- docs/Makefile.in \ +- docs/Doxyfile.in +-dist_example_DATA = \ +- example/client.cpp \ +- example/Makefile.am \ +- example/Makefile.in +-- +2.0.0 + diff --git a/package/libarchive/0001-fix-CVE-2016-1541.patch b/package/libarchive/0001-fix-CVE-2016-1541.patch new file mode 100644 index 0000000000..ef2448c04b --- /dev/null +++ b/package/libarchive/0001-fix-CVE-2016-1541.patch @@ -0,0 +1,71 @@ +From d0331e8e5b05b475f20b1f3101fe1ad772d7e7e7 Mon Sep 17 00:00:00 2001 +From: Tim Kientzle +Date: Sun, 24 Apr 2016 17:13:45 -0700 +Subject: [PATCH] Issue #656: Fix CVE-2016-1541, VU#862384 + +When reading OS X metadata entries in Zip archives that were stored +without compression, libarchive would use the uncompressed entry size +to allocate a buffer but would use the compressed entry size to limit +the amount of data copied into that buffer. Since the compressed +and uncompressed sizes are provided by data in the archive itself, +an attacker could manipulate these values to write data beyond +the end of the allocated buffer. + +This fix provides three new checks to guard against such +manipulation and to make libarchive generally more robust when +handling this type of entry: + 1. If an OS X metadata entry is stored without compression, + abort the entire archive if the compressed and uncompressed + data sizes do not match. + 2. When sanity-checking the size of an OS X metadata entry, + abort this entry if either the compressed or uncompressed + size is larger than 4MB. + 3. When copying data into the allocated buffer, check the copy + size against both the compressed entry size and uncompressed + entry size. + +Signed-off-by: Gustavo Zacarias +--- +Status: from upstream https://github.com/libarchive/libarchive/issues/656 + + libarchive/archive_read_support_format_zip.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c +index 0f8262c..0a0be96 100644 +--- a/libarchive/archive_read_support_format_zip.c ++++ b/libarchive/archive_read_support_format_zip.c +@@ -2778,6 +2778,11 @@ zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry, + + switch(rsrc->compression) { + case 0: /* No compression. */ ++ if (rsrc->uncompressed_size != rsrc->compressed_size) { ++ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ++ "Malformed OS X metadata entry: inconsistent size"); ++ return (ARCHIVE_FATAL); ++ } + #ifdef HAVE_ZLIB_H + case 8: /* Deflate compression. */ + #endif +@@ -2798,6 +2803,12 @@ zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry, + (intmax_t)rsrc->uncompressed_size); + return (ARCHIVE_WARN); + } ++ if (rsrc->compressed_size > (4 * 1024 * 1024)) { ++ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ++ "Mac metadata is too large: %jd > 4M bytes", ++ (intmax_t)rsrc->compressed_size); ++ return (ARCHIVE_WARN); ++ } + + metadata = malloc((size_t)rsrc->uncompressed_size); + if (metadata == NULL) { +@@ -2836,6 +2847,8 @@ zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry, + bytes_avail = remaining_bytes; + switch(rsrc->compression) { + case 0: /* No compression. */ ++ if ((size_t)bytes_avail > metadata_bytes) ++ bytes_avail = metadata_bytes; + memcpy(mp, p, bytes_avail); + bytes_used = (size_t)bytes_avail; + metadata_bytes -= bytes_used; diff --git a/package/libbsd/0001-build-clock_gettime-might-need-librt.patch b/package/libbsd/0001-build-clock_gettime-might-need-librt.patch new file mode 100644 index 0000000000..ad6fcdbdf0 --- /dev/null +++ b/package/libbsd/0001-build-clock_gettime-might-need-librt.patch @@ -0,0 +1,49 @@ +From 188049ac7adcabfa66e5b6a674ac28a2f7da81f3 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Fri, 12 Feb 2016 11:06:58 -0300 +Subject: [PATCH] build: clock_gettime might need librt + +In older glibc versions (< 2.17) clock_gettime is in librt. +Add a check for this to avoid build breakage for programs/libraries that +use libbsd on such systems. + +Signed-off-by: Gustavo Zacarias +--- +Patch status: submitted upstream + + configure.ac | 5 +++++ + src/Makefile.am | 2 ++ + 2 files changed, 7 insertions(+) + +diff --git a/configure.ac b/configure.ac +index d334774..1862d19 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -44,6 +44,11 @@ AC_SUBST([TESTU01_LIBS]) + AM_CONDITIONAL([HAVE_LIBTESTU01], + [test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"]) + ++# In old glibc versions (< 2.17) clock_gettime() is in librt ++AC_SEARCH_LIBS([clock_gettime], [rt], ++ [LIB_CLOCK_GETTIME="-lrt"]) ++AC_SUBST([LIB_CLOCK_GETTIME]) ++ + # Checks for header files. + AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h]) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 4649937..6b705f0 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -52,6 +52,8 @@ hash/md5hl.c: $(srcdir)/hash/helper.c + libbsd_la_DEPENDENCIES = \ + $(libbsd_la_included_sources) \ + libbsd.map ++libbsd_la_LIBADD = \ ++ $(LIB_CLOCK_GETTIME) + libbsd_la_LDFLAGS = \ + -Wl,--version-script=$(srcdir)/libbsd.map \ + -version-number $(LIBBSD_ABI) +-- +2.4.10 + diff --git a/package/libcap-ng/0001-add-missing-include.patch b/package/libcap-ng/0001-add-missing-include.patch new file mode 100644 index 0000000000..c30c40dc18 --- /dev/null +++ b/package/libcap-ng/0001-add-missing-include.patch @@ -0,0 +1,22 @@ +Add missing include + +This include is needed to get the pid_t definition, at least with the +musl C library. + +Patch inspired from Alpine Linux patch +http://git.alpinelinux.org/cgit/aports/tree/main/libcap-ng/fix-includes.patch. + +Signed-off-by: Thomas Petazzoni + +Index: b/utils/proc-llist.h +=================================================================== +--- a/utils/proc-llist.h ++++ b/utils/proc-llist.h +@@ -26,6 +26,7 @@ + + #include "config.h" + ++#include + + /* This is the node of the linked list. Any data elements that are per + * record goes here. */ diff --git a/package/libdrm/0002-xf86drm.c-Include-limits.h-to-fix-build-error-on-Sol.patch b/package/libdrm/0002-xf86drm.c-Include-limits.h-to-fix-build-error-on-Sol.patch new file mode 100644 index 0000000000..03b4524510 --- /dev/null +++ b/package/libdrm/0002-xf86drm.c-Include-limits.h-to-fix-build-error-on-Sol.patch @@ -0,0 +1,31 @@ +From 3fed80daf1dcb0b5d20e623d27228726c735e138 Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls +Date: Sun, 27 Sep 2015 19:09:47 +0200 +Subject: [PATCH 1/1] xf86drm.c: Include limits.h to fix build error on Solaris + and with musl + +musl's strict implementation requires #include for PATH_MAX. + +Patch suggested by evgeny for Solaris: +https://bugs.freedesktop.org/show_bug.cgi?id=92082 + +Signed-off-by: Bernd Kuhls +--- + xf86drm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xf86drm.c b/xf86drm.c +index a9f5c29..ec985eb 100644 +--- a/xf86drm.c ++++ b/xf86drm.c +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + #ifdef HAVE_SYS_MKDEV_H + # include /* defines major(), minor(), and makedev() on Solaris */ + #endif +-- +2.5.3 + diff --git a/package/libdrm/0003-xf86atomic-require-CAS-support-in-libatomic_ops.patch b/package/libdrm/0003-xf86atomic-require-CAS-support-in-libatomic_ops.patch new file mode 100644 index 0000000000..ff920fb5a7 --- /dev/null +++ b/package/libdrm/0003-xf86atomic-require-CAS-support-in-libatomic_ops.patch @@ -0,0 +1,32 @@ +From 7384f79f69fdb7b691cc5b0c28c301b3fe8b633e Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Thu, 26 May 2016 10:46:57 +0200 +Subject: [PATCH] xf86atomic: require CAS support in libatomic_ops + +Since AO_compare_and_swap_full() is used by libdrm, AO_REQUIRE_CAS +must be defined before including so that we are sure +that CAS support will be provided. This is necessary to make sure that +the AO_compare_and_swap_full() function will be provided on all +architectures, including the ones that don't have built-in CAS support +such as SPARCv8. + +Signed-off-by: Thomas Petazzoni +--- + xf86atomic.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xf86atomic.h b/xf86atomic.h +index 922b37d..d7017a5 100644 +--- a/xf86atomic.h ++++ b/xf86atomic.h +@@ -58,6 +58,7 @@ typedef struct { + #endif + + #if HAVE_LIB_ATOMIC_OPS ++#define AO_REQUIRE_CAS + #include + + #define HAS_ATOMIC_OPS 1 +-- +2.7.4 + diff --git a/package/libdvdnav/0001-fix-os2-support.patch b/package/libdvdnav/0001-fix-os2-support.patch new file mode 100644 index 0000000000..0f75f2fbd7 --- /dev/null +++ b/package/libdvdnav/0001-fix-os2-support.patch @@ -0,0 +1,32 @@ +configure: fix build on NIOS II platform + +NIOS II is a CPU architecture from Altera, which uses 'nios2' as the +architecture part of the tuple. Unfortunately, 'nios2' matches the +current '*os2*' test done by libdvdnav's configure script to detect +the OS/2 operating system. This leads to build issues as the build +process of libdvdnav then tries to use OS/2 specific compiler +options, that do not exist in the gcc used for Linux/NIOS2. + +To fix this, this patch makes the test for OS/2 a little bit more +specific: in the case of the OS/2 operating system, the OS part of the +tuple contains just 'os2' (confirmed by looking at config.guess and +config.sub in the gnuconfig project). So using '*-os2-*' will properly +match the OS/2 operating system but not the NIOS II architecture. + +Upstream-status: not needed, newer upstream versions no longer have + this test +Signed-off-by: Thomas Petazzoni + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -166,7 +166,7 @@ + *cygwin*) + LDFLAGS="-no-undefined $LDFLAGS" + ;; +- *os2*) ++ *-os2-*) + LDFLAGS="-no-undefined -Zbin-files $LDFLAGS" + ;; + *) diff --git a/package/libdvdread/0001-fix-os2-support.patch b/package/libdvdread/0001-fix-os2-support.patch new file mode 100644 index 0000000000..755bfaf3ee --- /dev/null +++ b/package/libdvdread/0001-fix-os2-support.patch @@ -0,0 +1,31 @@ +configure: fix build on NIOS II platform + +NIOS II is a CPU architecture from Altera, which uses 'nios2' as the +architecture part of the tuple. Unfortunately, 'nios2' matches the +current '*os2*' test done by libdvdread's configure script to detect +the OS/2 operating system. This leads to build issues as the build +process of libdvdread then tries to use OS/2 specific compiler +options, that do not exist in the gcc used for Linux/NIOS2. + +To fix this, this patch makes the test for OS/2 a little bit more +specific: in the case of the OS/2 operating system, the OS part of the +tuple contains just 'os2' (confirmed by looking at config.guess and +config.sub in the gnuconfig project). So using '*-os2-*' will properly +match the OS/2 operating system but not the NIOS II architecture. + +Upstream-status: submitted +Signed-off-by: Thomas Petazzoni + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -146,7 +146,7 @@ + *cygwin*) + LDFLAGS="-no-undefined $LDFLAGS" + ;; +- *os2*) ++ *-os2-*) + LDFLAGS="-no-undefined -Zbin-files $LDFLAGS" + ;; + *) diff --git a/package/libevas-generic-loaders/Config.in b/package/libevas-generic-loaders/Config.in new file mode 100644 index 0000000000..c171d47193 --- /dev/null +++ b/package/libevas-generic-loaders/Config.in @@ -0,0 +1,41 @@ +config BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS + bool "libevas generic loaders" + depends on BR2_PACKAGE_EFL + select BR2_PACKAGE_ZLIB + help + These are additional "generic" loaders for Evas that are + stand-alone executables that evas may run from its generic + loader module. + + https://www.enlightenment.org/ + +if BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS + +config BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS_LIBRAW + bool "libraw loader" + depends on BR2_INSTALL_LIBSTDCPP # libraw + select BR2_PACKAGE_LIBRAW + help + This option enables the Evas generic Libraw loader + +comment "libraw loader needs a toolchain w/ C++" + depends on !BR2_INSTALL_LIBSTDCPP + +config BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS_SVG + bool "SVG loader" + depends on BR2_USE_MMU # librsvg -> glib2 + depends on BR2_USE_WCHAR # librsvg -> glib2 + depends on BR2_TOOLCHAIN_HAS_THREADS # librsvg -> glib2 + depends on BR2_INSTALL_LIBSTDCPP # librsvg -> pango + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # librsvg -> pango -> harfbuzz + select BR2_PACKAGE_LIBRSVG + select BR2_PACKAGE_CAIRO + help + This option enables the Evas generic SVG loader + +comment "SVG loader needs a toolchain w/ wchar, threads, C++" + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + depends on BR2_USE_MMU + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP + +endif diff --git a/package/libevas-generic-loaders/libevas-generic-loaders.hash b/package/libevas-generic-loaders/libevas-generic-loaders.hash new file mode 100644 index 0000000000..32723ba9b3 --- /dev/null +++ b/package/libevas-generic-loaders/libevas-generic-loaders.hash @@ -0,0 +1,2 @@ +# From https://download.enlightenment.org/rel/libs/evas_generic_loaders/evas_generic_loaders-1.15.0.tar.xz.sha256 +sha256 1e539e4d4d4e1590345caeb7fdd84f47ec7cd63bb76b6b7107a87420a401fd7f evas_generic_loaders-1.15.0.tar.xz diff --git a/package/libevas-generic-loaders/libevas-generic-loaders.mk b/package/libevas-generic-loaders/libevas-generic-loaders.mk new file mode 100644 index 0000000000..ff8ea372ad --- /dev/null +++ b/package/libevas-generic-loaders/libevas-generic-loaders.mk @@ -0,0 +1,38 @@ +################################################################################ +# +# libevas-generic-loaders +# +################################################################################ + +LIBEVAS_GENERIC_LOADERS_VERSION = 1.15.0 +LIBEVAS_GENERIC_LOADERS_SOURCE = evas_generic_loaders-$(LIBEVAS_GENERIC_LOADERS_VERSION).tar.xz +LIBEVAS_GENERIC_LOADERS_SITE = http://download.enlightenment.org/rel/libs/evas_generic_loaders +LIBEVAS_GENERIC_LOADERS_LICENSE = GPLv2 +LIBEVAS_GENERIC_LOADERS_LICENSE_FILES = COPYING + +LIBEVAS_GENERIC_LOADERS_INSTALL_STAGING = YES + +LIBEVAS_GENERIC_LOADERS_DEPENDENCIES = host-pkgconf efl zlib + +# poppler >= 0.32 is not supported by the current version of +# libevas-generic-loaders. +LIBEVAS_GENERIC_LOADERS_CONF_OPTS += \ + --disable-poppler \ + --disable-spectre \ + --disable-gstreamer + +ifeq ($(BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS_LIBRAW),y) +LIBEVAS_GENERIC_LOADERS_DEPENDENCIES += libraw +LIBEVAS_GENERIC_LOADERS_CONF_OPTS += --enable-libraw +else +LIBEVAS_GENERIC_LOADERS_CONF_OPTS += --disable-libraw +endif + +ifeq ($(BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS_SVG),y) +LIBEVAS_GENERIC_LOADERS_DEPENDENCIES += librsvg cairo +LIBEVAS_GENERIC_LOADERS_CONF_OPTS += --enable-svg +else +LIBEVAS_GENERIC_LOADERS_CONF_OPTS += --disable-svg +endif + +$(eval $(autotools-package)) diff --git a/package/libfslcodec/Config.in b/package/libfslcodec/Config.in new file mode 100644 index 0000000000..d2007fe1ea --- /dev/null +++ b/package/libfslcodec/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_LIBFSLCODEC + bool "libfslcodec" + depends on BR2_arm # Only relevant for i.MX + depends on BR2_TOOLCHAIN_USES_GLIBC # prebuilt binaries + help + Binary codec libraries for the Freescale i.MX SoCs. + + This library is provided by Freescale as-is and doesn't have + an upstream. + +comment "libfslcodec needs an (e)glibc toolchain" + depends on BR2_arm + depends on !BR2_TOOLCHAIN_USES_GLIBC diff --git a/package/libfslcodec/libfslcodec.hash b/package/libfslcodec/libfslcodec.hash new file mode 100644 index 0000000000..fd934f7506 --- /dev/null +++ b/package/libfslcodec/libfslcodec.hash @@ -0,0 +1,2 @@ +# locally computed +sha256 544ffc5989bce18ca50c7a826cc03370b1cf8455335e4291ef0c0779b4c33de0 libfslcodec-4.0.8.bin diff --git a/package/libfslcodec/libfslcodec.mk b/package/libfslcodec/libfslcodec.mk new file mode 100644 index 0000000000..502390fb99 --- /dev/null +++ b/package/libfslcodec/libfslcodec.mk @@ -0,0 +1,23 @@ +################################################################################ +# +# libfslcodec +# +################################################################################ + +LIBFSLCODEC_VERSION = 4.0.8 +LIBFSLCODEC_SITE = $(FREESCALE_IMX_SITE) +LIBFSLCODEC_SOURCE = libfslcodec-$(LIBFSLCODEC_VERSION).bin +LIBFSLCODEC_INSTALL_STAGING = YES + +LIBFSLCODEC_LICENSE = Freescale Semiconductor Software License Agreement, BSD-3c (flac, ogg headers) +LIBFSLCODEC_LICENSE_FILES = EULA COPYING +LIBFSLCODEC_REDISTRIBUTE = NO + +define LIBFSLCODEC_EXTRACT_CMDS + $(call FREESCALE_IMX_EXTRACT_HELPER,$(DL_DIR)/$(LIBFSLCODEC_SOURCE)) +endef + +# FIXME The Makefile installs both the arm9 and arm11 versions of the +# libraries, but we only need one of them. + +$(eval $(autotools-package)) diff --git a/package/libfslparser/Config.in b/package/libfslparser/Config.in new file mode 100644 index 0000000000..e3ab980ec9 --- /dev/null +++ b/package/libfslparser/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_LIBFSLPARSER + bool "libfslparser" + depends on BR2_arm # Only relevant for i.MX + help + Binary parser libraries for the Freescale i.MX SoCs. + + This library is provided by Freescale as-is and doesn't have + an upstream. diff --git a/package/libfslparser/libfslparser.hash b/package/libfslparser/libfslparser.hash new file mode 100644 index 0000000000..c49345fa09 --- /dev/null +++ b/package/libfslparser/libfslparser.hash @@ -0,0 +1,2 @@ +# locally computed +sha256 a04621783c84a9776216caff9563c7f840fddd584b0b2d27738d6ca6d2c77f32 libfslparser-4.0.8.bin diff --git a/package/libfslparser/libfslparser.mk b/package/libfslparser/libfslparser.mk new file mode 100644 index 0000000000..44e6039c6a --- /dev/null +++ b/package/libfslparser/libfslparser.mk @@ -0,0 +1,23 @@ +################################################################################ +# +# libfslparser +# +################################################################################ + +LIBFSLPARSER_VERSION = 4.0.8 +LIBFSLPARSER_SITE = $(FREESCALE_IMX_SITE) +LIBFSLPARSER_SOURCE = libfslparser-$(LIBFSLPARSER_VERSION).bin +LIBFSLPARSER_INSTALL_STAGING = YES + +LIBFSLPARSER_LICENSE = Freescale Semiconductor Software License Agreement +LIBFSLPARSER_LICENSE_FILES = EULA COPYING +LIBFSLPARSER_REDISTRIBUTE = NO + +define LIBFSLPARSER_EXTRACT_CMDS + $(call FREESCALE_IMX_EXTRACT_HELPER,$(DL_DIR)/$(LIBFSLPARSER_SOURCE)) +endef + +# The Makefile installs several versions of the libraries, but we only +# need one of them, depending on the platform. + +$(eval $(autotools-package)) diff --git a/package/libfslvpuwrap/Config.in b/package/libfslvpuwrap/Config.in new file mode 100644 index 0000000000..72f7126307 --- /dev/null +++ b/package/libfslvpuwrap/Config.in @@ -0,0 +1,19 @@ +comment "libfslvpuwrap needs an imx-specific Linux kernel to be built" + depends on BR2_arm + depends on !BR2_LINUX_KERNEL + +comment "libfslvpuwrap needs an i.MX platform with VPU support" + depends on BR2_arm + depends on BR2_LINUX_KERNEL && !BR2_PACKAGE_FREESCALE_IMX_HAS_VPU + +config BR2_PACKAGE_LIBFSLVPUWRAP + bool "libfslvpuwrap" + depends on BR2_LINUX_KERNEL + depends on BR2_arm # Only relevant for i.MX + depends on BR2_PACKAGE_FREESCALE_IMX_HAS_VPU + select BR2_PACKAGE_IMX_VPU + help + Wrapper library for the vpu library, giving it a different API. + + This library is provided by Freescale as-is and doesn't have + an upstream. diff --git a/package/libfslvpuwrap/libfslvpuwrap.hash b/package/libfslvpuwrap/libfslvpuwrap.hash new file mode 100644 index 0000000000..e98707731f --- /dev/null +++ b/package/libfslvpuwrap/libfslvpuwrap.hash @@ -0,0 +1,2 @@ +# locally computed +sha256 0717faccb5413dc95ce9ad919400095ecf722320478c924366793a6cc450ae16 libfslvpuwrap-1.0.62.bin diff --git a/package/libfslvpuwrap/libfslvpuwrap.mk b/package/libfslvpuwrap/libfslvpuwrap.mk new file mode 100644 index 0000000000..12a4e864c8 --- /dev/null +++ b/package/libfslvpuwrap/libfslvpuwrap.mk @@ -0,0 +1,21 @@ +################################################################################ +# +# libfslvpuwrap +# +################################################################################ + +LIBFSLVPUWRAP_VERSION = 1.0.62 +LIBFSLVPUWRAP_SITE = $(FREESCALE_IMX_SITE) +LIBFSLVPUWRAP_SOURCE = libfslvpuwrap-$(LIBFSLVPUWRAP_VERSION).bin +LIBFSLVPUWRAP_DEPENDENCIES = imx-vpu +LIBFSLVPUWRAP_INSTALL_STAGING = YES + +LIBFSLVPUWRAP_LICENSE = Freescale Semiconductor Software License Agreement +LIBFSLVPUWRAP_LICENSE_FILES = EULA COPYING +LIBFSLVPUWRAP_REDISTRIBUTE = NO + +define LIBFSLVPUWRAP_EXTRACT_CMDS + $(call FREESCALE_IMX_EXTRACT_HELPER,$(DL_DIR)/$(LIBFSLVPUWRAP_SOURCE)) +endef + +$(eval $(autotools-package)) diff --git a/package/libgail/0001-Relax-X11-dependencies.patch b/package/libgail/0001-Relax-X11-dependencies.patch new file mode 100644 index 0000000000..97e56560d6 --- /dev/null +++ b/package/libgail/0001-Relax-X11-dependencies.patch @@ -0,0 +1,42 @@ +From cca72c48b5643fa62e1d55b7b181e147f5ba7fe9 Mon Sep 17 00:00:00 2001 +From: Lionel Landwerlin +Date: Sun, 28 Mar 2010 21:47:38 +0200 +Subject: [PATCH] Relax X11 dependency + +Signed-off-by: Lionel Landwerlin +--- + configure.in | 4 +++- + gail/gailwindow.c | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/configure.in b/configure.in +index 3801655..abaf417 100644 +--- a/configure.in ++++ b/configure.in +@@ -86,7 +86,9 @@ GTK_REQUIRED_VERSION=2.9.4 + PKG_CHECK_MODULES(DEP, $ATK_PACKAGES >= $ATK_REQUIRED_VERSION \ + $GTK_PACKAGES >= $GTK_REQUIRED_VERSION) + +-if test "$gail_native_win32" != "yes"; then ++AC_ARG_ENABLE(x, [ --disable-x disable x11 backend ],x11_backend=no,x11_backend=yes) ++ ++if test "$gail_native_win32" != "yes" -a "$x11_backend" != "no"; then + + PKG_CHECK_MODULES(X, x11, :, [ + # pkg-config modules not found (only present since X11R7 aka Xorg); use +diff --git a/gail/gailwindow.c b/gail/gailwindow.c +index 616b25e..add454b 100644 +--- a/gail/gailwindow.c ++++ b/gail/gailwindow.c +@@ -1071,7 +1071,7 @@ gail_window_get_mdi_zorder (AtkComponent *component) + return get_window_zorder (widget->window); + } + +-#elif defined (GDK_WINDOWING_WIN32) ++#elif defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_DIRECTFB) + + static gint + gail_window_get_mdi_zorder (AtkComponent *component) +-- +1.7.0.2 + diff --git a/package/libgail/Config.in b/package/libgail/Config.in new file mode 100644 index 0000000000..821a922fa5 --- /dev/null +++ b/package/libgail/Config.in @@ -0,0 +1,31 @@ +config BR2_PACKAGE_LIBGAIL + bool "libgail" + depends on BR2_USE_WCHAR # pango -> libglib2 + depends on BR2_TOOLCHAIN_HAS_THREADS # pango -> libglib2 + depends on BR2_USE_MMU # pango -> libglib2 + depends on BR2_INSTALL_LIBSTDCPP # pango -> freetype + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz + depends on BR2_PACKAGE_LIBGTK2 + depends on BR2_DEPRECATED_SINCE_2015_08 + select BR2_PACKAGE_PANGO + help + GAIL provides accessibility support for gtk+ and + libgnomecanvas by implementing AtkObjects for widgets in + gtk+ and libgnomecanvas. + + The GAIL library is a GTK+ module. For example, if the + module is loaded in a program which calls + gtk_widget_get_accessible() for a GtkEntry an instance of + GailEntry is returned. This module is normally used with the + atk-bridge GTK+ module from at-spi to allow an assistive + technology, e.g a screenreader, to query or drive the + program. + + http://developer.gnome.org/projects/gap + +comment "libgail needs a toolchain w/ C++, wchar, threads" + depends on BR2_PACKAGE_LIBGTK2 + depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + depends on BR2_DEPRECATED_SINCE_2015_08 diff --git a/package/libgail/libgail.hash b/package/libgail/libgail.hash new file mode 100644 index 0000000000..5cfd7525bd --- /dev/null +++ b/package/libgail/libgail.hash @@ -0,0 +1,2 @@ +# From http://ftp.gnome.org/pub/gnome/sources/gail/1.22/gail-1.22.3.sha256sum +sha256 03f03029277eb4f0e2c15a825fe716245d8647ede0435645475110289b059ae8 gail-1.22.3.tar.bz2 diff --git a/package/libgail/libgail.mk b/package/libgail/libgail.mk new file mode 100644 index 0000000000..4c5c8684e9 --- /dev/null +++ b/package/libgail/libgail.mk @@ -0,0 +1,22 @@ +################################################################################ +# +# libgail +# +################################################################################ + +LIBGAIL_VERSION_MAJOR = 1.22 +LIBGAIL_VERSION = $(LIBGAIL_VERSION_MAJOR).3 +LIBGAIL_SOURCE = gail-$(LIBGAIL_VERSION).tar.bz2 +LIBGAIL_SITE = http://ftp.gnome.org/pub/gnome/sources/gail/$(LIBGAIL_VERSION_MAJOR) +LIBGAIL_AUTORECONF = YES +LIBGAIL_INSTALL_STAGING = YES +LIBGAIL_LICENSE = LGPLv2+ +LIBGAIL_LICENSE_FILES = COPYING + +ifneq ($(BR2_PACKAGE_XLIB_LIBX11),y) +LIBGAIL_CONF_OPTS += --disable-x +endif + +LIBGAIL_DEPENDENCIES = host-pkgconf libgtk2 pango + +$(eval $(autotools-package)) diff --git a/package/libgpg-error/0001-avoid-breakage-with-gcc-5.patch b/package/libgpg-error/0001-avoid-breakage-with-gcc-5.patch new file mode 100644 index 0000000000..96dc569cb3 --- /dev/null +++ b/package/libgpg-error/0001-avoid-breakage-with-gcc-5.patch @@ -0,0 +1,56 @@ +Patch ported from Debian +http://anonscm.debian.org/cgit/pkg-gnupg/libgpg-error.git/diff/?id=c3d7571 + +Signed-off-by: Bernd Kuhls + + +From 91da4f5dbbc9d93975ef9753652a4e71719f9f27 Mon Sep 17 00:00:00 2001 +From: Daniel Kahn Gillmor +Date: Mon, 16 Mar 2015 13:26:00 -0400 +Subject: [LIBGPG-ERROR PATCH] avoid breakage with gcc 5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + * src/Makefile.am: add -P to the C preprocessor when building + mkerrcodes.h, to avoid a noisy intermediate pipeline. + +-- + +With gcc 5 without this patch, we see many errors like the following: + +gcc -I. -I. -o mkerrcodes ./mkerrcodes.c +In file included from ./mkerrcodes.c:26:0: +./mkerrcodes.h:9:5: error: expected expression before ‘,’ token + { , "GPG_ERR_E2BIG" }, + ^ +./mkerrcodes.h:10:5: error: expected expression before ‘,’ token + { , "GPG_ERR_EACCES" }, + ^ + +This patch cleans up the generated mkerrcodes.h by making the +intermediate stage clean for all the versions of gcc i tested (4.x and +5). + +Debian-Bug-Id: 777374 +Signed-Off-By: Daniel Kahn Gillmor +--- + src/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 99c2c53..f847a80 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -213,7 +213,7 @@ code-to-errno.h: Makefile mkerrnos.awk errnos.in + # It is correct to use $(CPP). We want the host's idea of the error codes. + mkerrcodes.h: Makefile mkerrcodes.awk $(gpg_extra_headers) + $(AWK) -f $(srcdir)/mkerrcodes1.awk $(srcdir)/errnos.in >_$@ +- $(CPP) $(CPPFLAGS) $(extra_cppflags) _$@ | grep GPG_ERR_ | \ ++ $(CPP) $(CPPFLAGS) $(extra_cppflags) -P _$@ | grep GPG_ERR_ | \ + $(AWK) -f $(srcdir)/mkerrcodes.awk >$@ + -rm _$@ + +-- +2.1.4 + diff --git a/package/libiio/0001-cmake-libxml2-detection-try-first-the-CMake-module-f.patch b/package/libiio/0001-cmake-libxml2-detection-try-first-the-CMake-module-f.patch new file mode 100644 index 0000000000..9f441698f8 --- /dev/null +++ b/package/libiio/0001-cmake-libxml2-detection-try-first-the-CMake-module-f.patch @@ -0,0 +1,42 @@ +From 4f849e1d2287206cfb7ff0fdeca96c22383b0d53 Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Mon, 29 Dec 2014 19:05:13 +0100 +Subject: [PATCH] cmake: libxml2 detection: try first the CMake module from + libxml2 + +Libxml2 >=2.9.2 provides its own CMake module, so check for it before +falling back on the CMake's module FindLibXml2.cmake. + +Signed-off-by: Samuel Martin +--- + CMakeLists.txt | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 393fee3..b4f1d26 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -38,7 +38,19 @@ endif() + find_library(AVAHI_CLIENT_LIBRARIES avahi-client) + find_library(AVAHI_COMMON_LIBRARIES avahi-common) + find_library(PTHREAD_LIBRARIES pthread) +-include(FindLibXml2) ++ ++# Since libxml2-2.9.2, libxml2 provides its own LibXml2-config.cmake, with all ++# variables correctly set. ++# So, try first to find the CMake module provided by libxml2 package, then fallback ++# on the CMake's FindLibXml2.cmake module (which can lack some definition, especially ++# in static build case). ++find_package(LibXml2 QUIET NO_MODULE) ++if(DEFINED LIBXML2_VERSION_STRING) ++ set(LIBXML2_FOUND ON) ++ set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS}) ++else() ++ include(FindLibXml2) ++endif() + + set(LIBIIO_CFILES channel.c device.c context.c buffer.c utilities.c) + set(LIBIIO_HEADERS iio.h) +-- +2.2.1 + diff --git a/package/libiio/0002-cmake-fix-build-on-unix-systems-without-cpp.patch b/package/libiio/0002-cmake-fix-build-on-unix-systems-without-cpp.patch new file mode 100644 index 0000000000..4839a394cc --- /dev/null +++ b/package/libiio/0002-cmake-fix-build-on-unix-systems-without-cpp.patch @@ -0,0 +1,36 @@ +From 2e6fa357ffbe755bfecaecad4fc82e3307fe2831 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Wed, 22 Jul 2015 10:25:01 +0200 +Subject: [PATCH] CMake: Fix build on UNIX systems without a C++ compiler + +Signed-off-by: Paul Cercueil +--- + bindings/csharp/CMakeLists.txt | 2 +- + bindings/python/CMakeLists.txt | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/bindings/csharp/CMakeLists.txt b/bindings/csharp/CMakeLists.txt +index 8aafb8f..fceab88 100644 +--- a/bindings/csharp/CMakeLists.txt ++++ b/bindings/csharp/CMakeLists.txt +@@ -1,5 +1,5 @@ + cmake_minimum_required(VERSION 2.8.7) +-project(libiio-sharp) ++project(libiio-sharp LANGUAGES NONE) + + find_program(MCS_EXECUTABLE + NAMES mcs csc +diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt +index 22ffdb4..76ceae8 100644 +--- a/bindings/python/CMakeLists.txt ++++ b/bindings/python/CMakeLists.txt +@@ -1,5 +1,5 @@ + cmake_minimum_required(VERSION 2.8.7) +-project(libiio-py) ++project(libiio-py LANGUAGES NONE) + + include(FindPythonInterp) + +-- +2.1.4 + diff --git a/package/libinput/0001-rename-log_msg-to-libinput_log_msg.patch b/package/libinput/0001-rename-log_msg-to-libinput_log_msg.patch new file mode 100644 index 0000000000..e36862a12d --- /dev/null +++ b/package/libinput/0001-rename-log_msg-to-libinput_log_msg.patch @@ -0,0 +1,77 @@ +From bf4a4a4e2b0479322fe16c9e1f15f146daa893ee Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Thu, 21 Aug 2014 18:18:16 +0200 +Subject: [PATCH] rename log_msg to libinput_log_msg + +This fixes a conflict between libevdev and libinput on the definition +of the log_msg() symbol. + +http://autobuild.buildroot.net/results/c13/c133b7c706ee31302125df8ca94f4d0f0152c6c6/build-end.log + +Signed-off-by: Romain Naour +[yann.morin.1998@free.fr: rebase on-top of 0.6.0] +Signed-off-by: "Yann E. MORIN" +[ps.report@gmx.net: rebase on top of 0.7.0] +Signed-off-by: Peter Seiderer +--- + src/libinput-private.h | 14 +++++++------- + src/libinput.c | 2 +- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/libinput-private.h b/src/libinput-private.h +index b36dc95..98f91b3 100644 +--- a/src/libinput-private.h ++++ b/src/libinput-private.h +@@ -259,12 +259,12 @@ + + typedef void (*libinput_source_dispatch_t)(void *data); + +-#define log_debug(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__) +-#define log_info(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__) +-#define log_error(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__) +-#define log_bug_kernel(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__) +-#define log_bug_libinput(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__) +-#define log_bug_client(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__) ++#define log_debug(li_, ...) libinput_log_msg((li_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__) ++#define log_info(li_, ...) libinput_log_msg((li_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__) ++#define log_error(li_, ...) libinput_log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__) ++#define log_bug_kernel(li_, ...) libinput_log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__) ++#define log_bug_libinput(li_, ...) libinput_log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__) ++#define log_bug_client(li_, ...) libinput_log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__) + + #define log_debug_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__) + #define log_info_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__) +@@ -281,7 +281,7 @@ + LIBINPUT_ATTRIBUTE_PRINTF(4, 5); + + void +-log_msg(struct libinput *libinput, ++libinput_log_msg(struct libinput *libinput, + enum libinput_log_priority priority, + const char *format, ...) + LIBINPUT_ATTRIBUTE_PRINTF(3, 4); +diff --git a/src/libinput.c b/src/libinput.c +index 279cce0..5748e5e 100644 +--- a/src/libinput.c ++++ b/src/libinput.c +@@ -155,7 +155,7 @@ + } + + void +-log_msg(struct libinput *libinput, ++libinput_log_msg(struct libinput *libinput, + enum libinput_log_priority priority, + const char *format, ...) + { +@@ -184,7 +184,7 @@ + va_end(args); + + if (state == RATELIMIT_THRESHOLD) +- log_msg(libinput, ++ libinput_log_msg(libinput, + priority, + "WARNING: log rate limit exceeded (%d msgs per %dms). Discarding future messages.\n", + ratelimit->burst, +-- +2.1.2 + diff --git a/package/libinput/0002-Add-configure.ac-check-for-static_assert.patch b/package/libinput/0002-Add-configure.ac-check-for-static_assert.patch new file mode 100644 index 0000000000..4df47b9a2b --- /dev/null +++ b/package/libinput/0002-Add-configure.ac-check-for-static_assert.patch @@ -0,0 +1,34 @@ +From 0df21f54942dc82ddde4095824e7b65efb96d261 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 16 May 2016 13:32:07 +1000 +Subject: [PATCH] Add configure.ac check for static_assert + +Part of C11, defined via assert.h. + +Signed-off-by: Peter Hutterer +Signed-off-by: Baruch Siach +--- +Patch status: suggested upstream +(https://lists.freedesktop.org/archives/wayland-devel/2016-May/028881.html) + + configure.ac | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 602a86026544..28a5197cfa2e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -55,6 +55,10 @@ AC_CHECK_DECL(TFD_CLOEXEC,[], + AC_CHECK_DECL(CLOCK_MONOTONIC,[], + [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile libinput")], + [[#include ]]) ++AC_CHECK_DECL(static_assert, [], ++ [AC_DEFINE(static_assert(...), [/* */], [noop static_assert() replacement]), ++ AC_MSG_RESULT([no])], ++ [[#include ]]) + + PKG_PROG_PKG_CONFIG() + PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0]) +-- +2.8.1 + diff --git a/package/libmnl/0001-uclinux.patch b/package/libmnl/0001-uclinux.patch new file mode 100644 index 0000000000..e8f97c6c17 --- /dev/null +++ b/package/libmnl/0001-uclinux.patch @@ -0,0 +1,26 @@ +From ae2acfa7d287e3ffc0bb66091059b86f62775bd5 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Tue, 10 Sep 2013 15:24:47 -0300 +Subject: [PATCH] configure: uclinux is also linux + +Signed-off-by: Gustavo Zacarias +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index dcd3cf8..313a015 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -17,7 +17,7 @@ AC_DISABLE_STATIC + LT_INIT + CHECK_GCC_FVISIBILITY + case "$host" in +-*-*-linux*) ;; ++*-*-linux* | *-*-uclinux*) ;; + *) AC_MSG_ERROR([Linux only, dude!]);; + esac + +-- +1.8.1.5 + diff --git a/package/libnetfilter_acct/0001-uclinux.patch b/package/libnetfilter_acct/0001-uclinux.patch new file mode 100644 index 0000000000..070f02cdce --- /dev/null +++ b/package/libnetfilter_acct/0001-uclinux.patch @@ -0,0 +1,26 @@ +From bfcaf00a8c972e2c10412d917f08626eb05079c7 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Tue, 10 Sep 2013 15:32:03 -0300 +Subject: [PATCH] configure: uclinux is also linux + +Signed-off-by: Gustavo Zacarias +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index ad1bef8..24a7bb9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -22,7 +22,7 @@ AC_DISABLE_STATIC + LT_INIT + CHECK_GCC_FVISIBILITY + case "$host" in +-*-*-linux*) ;; ++*-*-linux* | *-*-uclinux*) ;; + *) AC_MSG_ERROR([Linux only, dude!]);; + esac + +-- +1.8.1.5 + diff --git a/package/libpcap/0001-remove-libnl-include-path.patch b/package/libpcap/0001-remove-libnl-include-path.patch new file mode 100644 index 0000000000..d0760d4f9d --- /dev/null +++ b/package/libpcap/0001-remove-libnl-include-path.patch @@ -0,0 +1,25 @@ +Remove hardcoded path to libnl3 include directory + +Signed-off-by: Thomas Petazzoni +[Gustavo: update for 1.7.2] + +diff -Nura libpcap-1.7.2.orig/configure.in libpcap-1.7.2/configure.in +--- libpcap-1.7.2.orig/configure.in 2015-03-14 08:02:05.538706347 -0300 ++++ libpcap-1.7.2/configure.in 2015-03-14 08:17:22.637519050 -0300 +@@ -461,14 +461,13 @@ + # + # Yes, we have libnl 3.x. + # +- LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS" ++ LIBS="-lnl-genl-3 -lnl-3 $LIBS" + AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) + AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x]) + AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) + AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) +- V_INCLS="$V_INCLS ${incdir}" + have_any_nl="yes" +- ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 ) ++ ],[], -lnl-genl-3 -lnl-3 ) + + if test x$have_any_nl = xno ; then + # diff --git a/package/libpcap/0002-configure.in-fix-detect-of-if_bonding.h-on-uclinux.patch b/package/libpcap/0002-configure.in-fix-detect-of-if_bonding.h-on-uclinux.patch new file mode 100644 index 0000000000..7838c6f256 --- /dev/null +++ b/package/libpcap/0002-configure.in-fix-detect-of-if_bonding.h-on-uclinux.patch @@ -0,0 +1,30 @@ +From 5b8dc4eaeab60d5effc33055e5bce9ac0d98d339 Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Tue, 2 Jun 2015 21:39:15 +0300 +Subject: [PATCH] configure.in: fix detect of if_bonding.h on uclinux + +noMMU Linux (uClinux) is also Linux + +Upstream status: https://github.com/the-tcpdump-group/libpcap/pull/440 + +Signed-off-by: Baruch Siach +--- + configure.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.in b/configure.in +index be4b29e2f8ba..31287d0dbe61 100644 +--- a/configure.in ++++ b/configure.in +@@ -149,7 +149,7 @@ struct rtentry; + fi + + case "$host_os" in +-linux*) ++linux*|uclinux*) + AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,, + [ + #include +-- +2.1.4 + diff --git a/package/libpjsip/0001-Use-mutex-types-compatible-with-musl-fixes-musl-buil.patch b/package/libpjsip/0001-Use-mutex-types-compatible-with-musl-fixes-musl-buil.patch new file mode 100644 index 0000000000..ab3444b710 --- /dev/null +++ b/package/libpjsip/0001-Use-mutex-types-compatible-with-musl-fixes-musl-buil.patch @@ -0,0 +1,53 @@ +From ba1057d74aac6c2dde5477bd6a2deea79f14962c Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli +Date: Sat, 12 Mar 2016 15:19:34 +0100 +Subject: [PATCH 1/2] Use mutex types compatible with musl (fixes musl build) + +PTHREAD_MUTEX_FAST_NP and PTHREAD_MUTEX_RECURSIVE_NP are not defined +in the musl C library. Use values that map to the same mutex type in +GNU libc and uClibc-ng. + +Fixes the following build errors when building with musl: + + ../src/pj/os_core_unix.c: In function 'init_mutex': + ../src/pj/os_core_unix.c:1128:40: error: 'PTHREAD_MUTEX_FAST_NP' undeclared (first use in this function) + rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP); + ^ + ../src/pj/os_core_unix.c:1128:40: note: each undeclared identifier is reported only once for each function it appears in + ../src/pj/os_core_unix.c:1138:40: error: 'PTHREAD_MUTEX_RECURSIVE_NP' undeclared (first use in this function) + rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); + ^ + +Original patch: +http://git.alpinelinux.org/cgit/aports/plain/main/pjproject/musl-fixes.patch + +Signed-off-by: Luca Ceresoli +--- + pjlib/src/pj/os_core_unix.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c +index 1c87b2f..f08ba27 100644 +--- a/pjlib/src/pj/os_core_unix.c ++++ b/pjlib/src/pj/os_core_unix.c +@@ -1125,7 +1125,7 @@ static pj_status_t init_mutex(pj_mutex_t *mutex, const char *name, int type) + if (type == PJ_MUTEX_SIMPLE) { + #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ + defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE) +- rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP); ++ rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); + #elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \ + defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE) + /* Nothing to do, default is simple */ +@@ -1135,7 +1135,7 @@ static pj_status_t init_mutex(pj_mutex_t *mutex, const char *name, int type) + } else { + #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ + defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE) +- rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); ++ rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + #elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \ + defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE) + // Phil Torre : +-- +1.9.1 + diff --git a/package/libpjsip/0002-Replace-__sched_priority-with-sched_priority-fixes-m.patch b/package/libpjsip/0002-Replace-__sched_priority-with-sched_priority-fixes-m.patch new file mode 100644 index 0000000000..e1cb00229a --- /dev/null +++ b/package/libpjsip/0002-Replace-__sched_priority-with-sched_priority-fixes-m.patch @@ -0,0 +1,82 @@ +From cca93ce25f993c97ef3d96fa32461d5717c30518 Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli +Date: Sat, 12 Mar 2016 15:31:47 +0100 +Subject: [PATCH 2/2] Replace __sched_priority with sched_priority(fixes musl + build) + +The musl C library defines sched_priority, not __sched_priority as GNU +libc and uClibc-ng do. Use sched_priority instead. + +This does not break compatibility with GNU libc and uClibc-ng because +both define in sched.h: + + #define sched_priority __sched_priority + +Fixes the following build errors when building with musl: + + ../src/samples/siprtp.c: In function 'boost_priority': + ../src/samples/siprtp.c:1137:7: error: 'struct sched_param' has no member named '__sched_priority' + tp.__sched_priority = max_prio; + ^ + In file included from /home/murray/devel/buildroot/test-musl-eabi/build/libpjsip-2.4.5/pjlib/include/pj/except.h:30:0, + from /home/murray/devel/buildroot/test-musl-eabi/build/libpjsip-2.4.5/pjlib/include/pjlib.h:35, + from ../src/samples/siprtp.c:76: + ../src/samples/siprtp.c:1146:18: error: 'struct sched_param' has no member named '__sched_priority' + policy, tp.__sched_priority)); + ^ + +Original patch: +http://git.alpinelinux.org/cgit/aports/plain/main/pjproject/musl-fixes.patch + +Signed-off-by: Luca Ceresoli +--- + pjsip-apps/src/samples/siprtp.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c +index 796464f..6e32a8f 100644 +--- a/pjsip-apps/src/samples/siprtp.c ++++ b/pjsip-apps/src/samples/siprtp.c +@@ -1134,7 +1134,7 @@ static void boost_priority(void) + PJ_RETURN_OS_ERROR(rc)); + return; + } +- tp.__sched_priority = max_prio; ++ tp.sched_priority = max_prio; + + rc = sched_setscheduler(0, POLICY, &tp); + if (rc != 0) { +@@ -1143,7 +1143,7 @@ static void boost_priority(void) + } + + PJ_LOG(4, (THIS_FILE, "New process policy=%d, priority=%d", +- policy, tp.__sched_priority)); ++ policy, tp.sched_priority)); + + /* + * Adjust thread scheduling algorithm and priority +@@ -1156,10 +1156,10 @@ static void boost_priority(void) + } + + PJ_LOG(4, (THIS_FILE, "Old thread policy=%d, priority=%d", +- policy, tp.__sched_priority)); ++ policy, tp.sched_priority)); + + policy = POLICY; +- tp.__sched_priority = max_prio; ++ tp.sched_priority = max_prio; + + rc = pthread_setschedparam(pthread_self(), policy, &tp); + if (rc != 0) { +@@ -1169,7 +1169,7 @@ static void boost_priority(void) + } + + PJ_LOG(4, (THIS_FILE, "New thread policy=%d, priority=%d", +- policy, tp.__sched_priority)); ++ policy, tp.sched_priority)); + } + + #else +-- +1.9.1 + diff --git a/package/libplatform/0001-platform-config.cmake-fix-paths-for-cross-compilatio.patch b/package/libplatform/0001-platform-config.cmake-fix-paths-for-cross-compilatio.patch new file mode 100644 index 0000000000..89f35bdb3d --- /dev/null +++ b/package/libplatform/0001-platform-config.cmake-fix-paths-for-cross-compilatio.patch @@ -0,0 +1,40 @@ +From 65ba437ed5514dd5762a796d349ed5db49e40fe7 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 29 Jul 2015 21:26:16 +0200 +Subject: [PATCH] platform-config.cmake: fix paths for cross-compilation + +Headers and library paths in platform-config.cmake must take into +account ${CMAKE_FIND_ROOT_PATH} to work in cross-compilation. + +Signed-off-by: Thomas Petazzoni +--- + platform-config.cmake.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/platform-config.cmake.in b/platform-config.cmake.in +index 7fe35fe..78b5085 100644 +--- a/platform-config.cmake.in ++++ b/platform-config.cmake.in +@@ -10,16 +10,16 @@ + # + # propagate these properties from one build system to the other + set (platform_VERSION "@platform_VERSION_MAJOR@.@platform_VERSION_MINOR@") +-set (platform_INCLUDE_DIRS @platform_INCLUDE_DIRS@ @CMAKE_INSTALL_PREFIX@/include) ++set (platform_INCLUDE_DIRS ${CMAKE_FIND_ROOT_PATH}/@platform_INCLUDE_DIRS@ ${CMAKE_FIND_ROOT_PATH}/@CMAKE_INSTALL_PREFIX@/include) + set (platform_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") + set (platform_LINKER_FLAGS "@platform_LINKER_FLAGS@") + set (platform_CONFIG_VARS "@platform_CONFIG_VARS@") + + # libraries come from the build tree where this file was generated + if(WIN32) +- set (platform_LIBRARY "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/platform.lib") ++ set (platform_LIBRARY "${CMAKE_FIND_ROOT_PATH}/@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/platform.lib") + else(WIN32) +- set (platform_LIBRARY "-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -lplatform") ++ set (platform_LIBRARY "-L${CMAKE_FIND_ROOT_PATH}/@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -lplatform") + endif(WIN32) + set (platform_LIBRARIES ${platform_LIBRARY} "@platform_LIBRARIES@") + mark_as_advanced (platform_LIBRARY) +-- +2.5.0 + diff --git a/package/libpng/0001-disable-tools.patch b/package/libpng/0001-disable-tools.patch new file mode 100644 index 0000000000..e30eca9ffc --- /dev/null +++ b/package/libpng/0001-disable-tools.patch @@ -0,0 +1,30 @@ +Disable the new pngfix and png-fix-itxt tools: they take up space, fail to +build on some oddball toolchain configurations and aren't expected/needed +in a non-interactive embedded system. + +Signed-off-by: Gustavo Zacarias + +diff -Nura libpng-1.6.10.orig/Makefile.am libpng-1.6.10/Makefile.am +--- libpng-1.6.10.orig/Makefile.am 2014-03-17 08:51:25.812005079 -0300 ++++ libpng-1.6.10/Makefile.am 2014-03-17 09:14:28.807586433 -0300 +@@ -10,7 +10,7 @@ + check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage + + # Utilities - installed +-bin_PROGRAMS= pngfix png-fix-itxt ++bin_PROGRAMS= + + # This ensures that pnglibconf.h gets built at the start of 'make all' or + # 'make check', but it does not add dependencies to the individual programs, +diff -Nura libpng-1.6.10.orig/Makefile.in libpng-1.6.10/Makefile.in +--- libpng-1.6.10.orig/Makefile.in 2014-03-17 08:51:25.807005070 -0300 ++++ libpng-1.6.10/Makefile.in 2014-03-17 09:14:44.846617623 -0300 +@@ -87,7 +87,7 @@ + host_triplet = @host@ + check_PROGRAMS = pngtest$(EXEEXT) pngunknown$(EXEEXT) \ + pngstest$(EXEEXT) pngvalid$(EXEEXT) pngimage$(EXEEXT) +-bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT) ++bin_PROGRAMS = + @PNG_ARM_NEON_TRUE@am__append_1 = arm/arm_init.c\ + @PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c + diff --git a/package/libpng/0002-ignore-symbol-prefix.patch b/package/libpng/0002-ignore-symbol-prefix.patch new file mode 100644 index 0000000000..5a8ede58a9 --- /dev/null +++ b/package/libpng/0002-ignore-symbol-prefix.patch @@ -0,0 +1,48 @@ +From dbfea83a7436cbac34cc883ab2b7befacaf02c40 Mon Sep 17 00:00:00 2001 +From: Danomi Manchego +Date: Tue, 23 Jun 2015 13:54:42 -0400 +Subject: libpng: don't append prefix to symbol names in version script + +Even if Blackfin GNU toolchain add prefix '_' to all symbols, +symbol prefix is not accepted in the link flag --version-script. +Don't append prefix in the symbols in the version script file. + +Original patch by: Sonic Zhang + +Rebase to apply cleanly. + +Signed-off-by: Danomi Manchego +--- + Makefile.am | 2 +- + Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index dcc5439..e543c81 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -231,7 +231,7 @@ contrib/tools/pngfix.o: pnglibconf.h + # interfering with the symbol file format. + SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\ + -DPNGLIB_VERSION='@PNGLIB_VERSION@'\ +- -DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\ ++ -DSYMBOL_PREFIX=''\ + -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE + + if DO_PNG_PREFIX +diff --git a/Makefile.in b/Makefile.in +index 975f931..a3e0552 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -747,7 +747,7 @@ SUFFIXES = .chk .out + # interfering with the symbol file format. + SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0' \ + -DPNGLIB_VERSION='@PNGLIB_VERSION@' \ +- -DSYMBOL_PREFIX='$(SYMBOL_PREFIX)' -DPNG_NO_USE_READ_MACROS \ ++ -DSYMBOL_PREFIX='' -DPNG_NO_USE_READ_MACROS \ + -DPNG_BUILDING_SYMBOL_TABLE $(am__append_5) + + # EXT_LIST is a list of the possibly library directory extensions, this exists +-- +1.7.9.5 + diff --git a/package/libseccomp/0002-musl.patch b/package/libseccomp/0002-musl.patch new file mode 100644 index 0000000000..9858d76099 --- /dev/null +++ b/package/libseccomp/0002-musl.patch @@ -0,0 +1,28 @@ +From eb5382287cd25235e760b5da4939510b11bbf2a1 Mon Sep 17 00:00:00 2001 +From: Kylie McClain +Date: Fri, 1 Jan 2016 13:12:59 -0500 +Subject: [PATCH] system.h: Remove conflicting kernel header include + +This fixes building on musl libc, since musl does not include kernel +headers. I've tested this as working on both glibc and musl. + +Signed-off-by: Kylie McClain +[Bernd: downloaded from upstream PR: + https://github.com/seccomp/libseccomp/pull/23] +Signed-off-by: Bernd Kuhls +--- + src/system.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/system.h b/src/system.h +index 4660679..e84b0a0 100644 +--- a/src/system.h ++++ b/src/system.h +@@ -23,7 +23,6 @@ + #define _SYSTEM_H + + #include +-#include + + #include "configure.h" + diff --git a/package/libsemanage/0001-execption-lib-path-fix.patch b/package/libsemanage/0001-execption-lib-path-fix.patch new file mode 100644 index 0000000000..cbcbea5995 --- /dev/null +++ b/package/libsemanage/0001-execption-lib-path-fix.patch @@ -0,0 +1,14 @@ +Patch to correct a missing header file issue. + +Signed-off-by Clayton Shotwell + +--- a/src/exception.sh 2011-12-21 11:46:04.000000000 -0600 ++++ b/src/exception.sh 2012-08-27 11:29:58.000000000 -0500 +@@ -9,6 +9,6 @@ + } + " + } +-gcc -x c -c - -aux-info temp.aux < ../include/semanage/semanage.h ++gcc -x c -c - -aux-info temp.aux -I../include < ../include/semanage/semanage.h + for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done + rm -f -- temp.aux -.o diff --git a/package/libsemanage/0002-workaround-blackfin-issue.patch b/package/libsemanage/0002-workaround-blackfin-issue.patch new file mode 100644 index 0000000000..5d00c6983b --- /dev/null +++ b/package/libsemanage/0002-workaround-blackfin-issue.patch @@ -0,0 +1,24 @@ +Do not make symbols hidden on Blackfin + +The libselinux logic to hide internal symbols from the DSO doesn't +work properly on Blackfin due to the USER_LABEL_PREFIX not being +handled properly. A real fix is not that simple, so this patch simply +disables the internal symbol hiding mechanism. This means that those +symbols are visible in the final DSO, which is not a problem for +proper execution, it just isn't as clean. + +Signed-off-by: Thomas Petazzoni + +Index: b/src/dso.h +=================================================================== +--- a/src/dso.h ++++ b/src/dso.h +@@ -1,7 +1,7 @@ + #ifndef _SELINUX_DSO_H + #define _SELINUX_DSO_H 1 + +-#ifdef SHARED ++#if defined(SHARED) && !defined(__bfin__) + # define hidden __attribute__ ((visibility ("hidden"))) + # define hidden_proto(fct) __hidden_proto (fct, fct##_internal) + # define __hidden_proto(fct, internal) \ diff --git a/package/liburcu/0002-support-aarch64.patch b/package/liburcu/0002-support-aarch64.patch new file mode 100644 index 0000000000..6830e25ebe --- /dev/null +++ b/package/liburcu/0002-support-aarch64.patch @@ -0,0 +1,21 @@ +libucru: recognize aarch64 + +Make the same as "arm" internally. + +Upstream-Status: Pending + +Signed-off-by: joe.slater@windriver.com +[moved to buildroot from openembedded-core] +Signed-off-by: Ben Shelton + + +--- a/configure.ac ++++ b/configure.ac +@@ -77,6 +77,7 @@ AS_CASE([$host_cpu], + [alpha*], [ARCHTYPE="alpha"], + [ia64], [ARCHTYPE="gcc"], + [arm*], [ARCHTYPE="arm"], ++ [aarch64], [ARCHTYPE="arm"], + [mips*], [ARCHTYPE="mips"], + [tile*], [ARCHTYPE="gcc"], + [ARCHTYPE="unknown"] diff --git a/package/libxmlrpc/0002-fix-non-cplusplus-build.patch b/package/libxmlrpc/0002-fix-non-cplusplus-build.patch new file mode 100644 index 0000000000..efeb9cc83f --- /dev/null +++ b/package/libxmlrpc/0002-fix-non-cplusplus-build.patch @@ -0,0 +1,27 @@ +Handle builds without C++ + +libxmlrpc nicely handles the fact of being built without C++ support, +except for one location, fixed by this patch. + +Signed-off-by: Thomas Petazzoni + +Index: b/lib/util/Makefile +=================================================================== +--- a/lib/util/Makefile ++++ b/lib/util/Makefile +@@ -41,11 +41,14 @@ + LIBOBJS = \ + casprintf.o \ + cmdline_parser.o \ +- cmdline_parser_cpp.o \ + getoptx.o \ + string_parser.o \ + stripcaseeq.o \ + ++ifeq ($(ENABLE_CPLUSPLUS),yes) ++LIBOBJS += cmdline_parser_cpp.o ++endif ++ + .PHONY: all + all: $(LIBOBJS) + diff --git a/package/libxmlrpc/0003-non-wchar-build.patch b/package/libxmlrpc/0003-non-wchar-build.patch new file mode 100644 index 0000000000..1f04353061 --- /dev/null +++ b/package/libxmlrpc/0003-non-wchar-build.patch @@ -0,0 +1,24 @@ +Disable wide-char specific code + +The vast majority of the libxmlrpc code nicely handles the absence of +wide char support, except at one location, which is fixed by this +patch. + +Signed-off-by: Thomas Petazzoni + +Index: b/src/xmlrpc_decompose.c +=================================================================== +--- a/src/xmlrpc_decompose.c ++++ b/src/xmlrpc_decompose.c +@@ -217,7 +217,11 @@ + xmlrpc_strfree(*decompRootP->store.Tstring.valueP); + break; + case 'w': ++#if HAVE_UNICODE_WCHAR + free((void*)*decompRootP->store.TwideString.valueP); ++#else ++ XMLRPC_ASSERT(false); ++#endif + break; + case '6': + free((void*)*decompRootP->store.TbitString.valueP); diff --git a/package/libxmlrpc/0005-config.mk.in-fix-shared-libraries-build-for-uClibc.patch b/package/libxmlrpc/0005-config.mk.in-fix-shared-libraries-build-for-uClibc.patch new file mode 100644 index 0000000000..5970df51a9 --- /dev/null +++ b/package/libxmlrpc/0005-config.mk.in-fix-shared-libraries-build-for-uClibc.patch @@ -0,0 +1,27 @@ +From 5d68179a54b0a34d989722dcbe3b6eb962feb27d Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Tue, 23 Dec 2014 16:04:18 +0100 +Subject: [PATCH] config.mk.in: fix shared libraries build for uClibc + +Signed-off-by: Romain Naour +--- + config.mk.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/config.mk.in b/config.mk.in +index c5d4160..45461cf 100644 +--- a/config.mk.in ++++ b/config.mk.in +@@ -166,7 +166,8 @@ shliblefn = $(1:%=%.shlibledummy) + # HOST_OS is usually has a version number suffix, e.g. "aix5.3.0.0", so + # we compare based on prefix. + +-ifeq ($(patsubst linux-gnu%,linux-gnu,$(HOST_OS)),linux-gnu) ++# linux-uclibc is also a linux ++ifeq ($(patsubst linux-%,linux-,$(HOST_OS)),linux-) + # Assume linker is GNU Compiler (gcc) + SHARED_LIB_TYPE = unix + MUST_BUILD_SHLIB = Y +-- +1.9.3 + diff --git a/package/lighttpd/0002-compat-latest-lua.patch b/package/lighttpd/0002-compat-latest-lua.patch new file mode 100644 index 0000000000..ddbbfc2d87 --- /dev/null +++ b/package/lighttpd/0002-compat-latest-lua.patch @@ -0,0 +1,1398 @@ +add handling for lua 5.2 and 5.3 + +Fetch from: https://redmine.lighttpd.net/projects/lighttpd/repository/revisions/3070 + +Signed-off-by: Francois Perrad + +Index: lighttpd-1.4.37/src/mod_magnet_cache.c +=================================================================== +--- lighttpd-1.4.37/src/mod_magnet_cache.c (revision 3069) ++++ lighttpd-1.4.37/src/mod_magnet_cache.c (revision 3070) +@@ -68,6 +68,7 @@ + /* oops, the script failed last time */ + + if (lua_gettop(sc->L) == 0) break; ++ force_assert(lua_gettop(sc->L) == 1); + + if (HANDLER_ERROR == stat_cache_get_entry(srv, con, sc->name, &sce)) { + lua_pop(sc->L, 1); /* pop the old function */ +@@ -81,7 +82,6 @@ + } + + force_assert(lua_isfunction(sc->L, -1)); +- lua_pushvalue(sc->L, -1); /* copy the function-reference */ + + return sc->L; + } +@@ -114,7 +114,6 @@ + + if (0 != luaL_loadfile(sc->L, name->ptr)) { + /* oops, an error, return it */ +- + return sc->L; + } + +@@ -122,14 +121,7 @@ + buffer_copy_buffer(sc->etag, sce->etag); + } + +- /** +- * pcall() needs the function on the stack +- * +- * as pcall() will pop the script from the stack when done, we have to +- * duplicate it here +- */ + force_assert(lua_isfunction(sc->L, -1)); +- lua_pushvalue(sc->L, -1); /* copy the function-reference */ + + return sc->L; + } +Index: lighttpd-1.4.37/src/mod_cml_lua.c +=================================================================== +--- lighttpd-1.4.37/src/mod_cml_lua.c (revision 3069) ++++ lighttpd-1.4.37/src/mod_cml_lua.c (revision 3070) +@@ -28,67 +28,35 @@ + #include + #include + +-typedef struct { +- stream st; +- int done; +-} readme; +- +-static const char * load_file(lua_State *L, void *data, size_t *size) { +- readme *rm = data; +- +- UNUSED(L); +- +- if (rm->done) return 0; +- +- *size = rm->st.size; +- rm->done = 1; +- return rm->st.start; +-} +- + static int lua_to_c_get_string(lua_State *L, const char *varname, buffer *b) { +- int curelem; ++ int curelem = lua_gettop(L); ++ int result; + +- lua_pushstring(L, varname); ++ lua_getglobal(L, varname); + +- curelem = lua_gettop(L); +- lua_gettable(L, LUA_GLOBALSINDEX); +- +- /* it should be a table */ +- if (!lua_isstring(L, curelem)) { +- lua_settop(L, curelem - 1); +- +- return -1; ++ if (lua_isstring(L, curelem)) { ++ buffer_copy_string(b, lua_tostring(L, curelem)); ++ result = 0; ++ } else { ++ result = -1; + } + +- buffer_copy_string(b, lua_tostring(L, curelem)); +- + lua_pop(L, 1); +- +- force_assert(curelem - 1 == lua_gettop(L)); +- +- return 0; ++ force_assert(curelem == lua_gettop(L)); ++ return result; + } + + static int lua_to_c_is_table(lua_State *L, const char *varname) { +- int curelem; ++ int curelem = lua_gettop(L); ++ int result; + +- lua_pushstring(L, varname); ++ lua_getglobal(L, varname); + +- curelem = lua_gettop(L); +- lua_gettable(L, LUA_GLOBALSINDEX); ++ result = lua_istable(L, curelem) ? 1 : 0; + +- /* it should be a table */ +- if (!lua_istable(L, curelem)) { +- lua_settop(L, curelem - 1); +- +- return 0; +- } +- +- lua_settop(L, curelem - 1); +- +- force_assert(curelem - 1 == lua_gettop(L)); +- +- return 1; ++ lua_pop(L, 1); ++ force_assert(curelem == lua_gettop(L)); ++ return result; + } + + static int c_to_lua_push(lua_State *L, int tbl, const char *key, size_t key_len, const char *val, size_t val_len) { +@@ -99,7 +67,6 @@ + return 0; + } + +- + static int cache_export_get_params(lua_State *L, int tbl, buffer *qrystr) { + size_t is_key = 1; + size_t i, len; +@@ -143,83 +110,12 @@ + + return 0; + } +-#if 0 +-int cache_export_cookie_params(server *srv, connection *con, plugin_data *p) { +- data_unset *d; + +- UNUSED(srv); +- +- if (NULL != (d = array_get_element(con->request.headers, "Cookie"))) { +- data_string *ds = (data_string *)d; +- size_t key = 0, value = 0; +- size_t is_key = 1, is_sid = 0; +- size_t i; +- +- /* found COOKIE */ +- if (!DATA_IS_STRING(d)) return -1; +- if (ds->value->used == 0) return -1; +- +- if (ds->value->ptr[0] == '\0' || +- ds->value->ptr[0] == '=' || +- ds->value->ptr[0] == ';') return -1; +- +- buffer_reset(p->session_id); +- for (i = 0; i < ds->value->used; i++) { +- switch(ds->value->ptr[i]) { +- case '=': +- if (is_key) { +- if (0 == strncmp(ds->value->ptr + key, "PHPSESSID", i - key)) { +- /* found PHP-session-id-key */ +- is_sid = 1; +- } +- value = i + 1; +- +- is_key = 0; +- } +- +- break; +- case ';': +- if (is_sid) { +- buffer_copy_string_len(p->session_id, ds->value->ptr + value, i - value); +- } +- +- is_sid = 0; +- key = i + 1; +- value = 0; +- is_key = 1; +- break; +- case ' ': +- if (is_key == 1 && key == i) key = i + 1; +- if (is_key == 0 && value == i) value = i + 1; +- break; +- case '\0': +- if (is_sid) { +- buffer_copy_string_len(p->session_id, ds->value->ptr + value, i - value); +- } +- /* fin */ +- break; +- } +- } +- } +- +- return 0; +-} +-#endif +- + int cache_parse_lua(server *srv, connection *con, plugin_data *p, buffer *fn) { + lua_State *L; +- readme rm; + int ret = -1; + buffer *b; +- int header_tbl = 0; + +- rm.done = 0; +- if (-1 == stream_open(&rm.st, fn)) { +- log_error_write(srv, __FILE__, __LINE__, "sbss", +- "opening lua cml file ", fn, "failed:", strerror(errno)); +- return -1; +- } +- + b = buffer_init(); + /* push the lua file to the interpreter and see what happends */ + L = luaL_newstate(); +@@ -233,73 +129,77 @@ + lua_register(L, "dir_files", f_dir_files); + + #ifdef HAVE_MEMCACHE_H +- lua_pushliteral(L, "memcache_get_long"); + lua_pushlightuserdata(L, p->conf.mc); + lua_pushcclosure(L, f_memcache_get_long, 1); +- lua_settable(L, LUA_GLOBALSINDEX); ++ lua_setglobal(L, "memcache_get_long"); + +- lua_pushliteral(L, "memcache_get_string"); + lua_pushlightuserdata(L, p->conf.mc); + lua_pushcclosure(L, f_memcache_get_string, 1); +- lua_settable(L, LUA_GLOBALSINDEX); ++ lua_setglobal(L, "memcache_get_string"); + +- lua_pushliteral(L, "memcache_exists"); + lua_pushlightuserdata(L, p->conf.mc); + lua_pushcclosure(L, f_memcache_exists, 1); +- lua_settable(L, LUA_GLOBALSINDEX); ++ lua_setglobal(L, "memcache_exists"); + #endif ++ + /* register CGI environment */ +- lua_pushliteral(L, "request"); + lua_newtable(L); +- lua_settable(L, LUA_GLOBALSINDEX); ++ { ++ int header_tbl = lua_gettop(L); + +- lua_pushliteral(L, "request"); +- header_tbl = lua_gettop(L); +- lua_gettable(L, LUA_GLOBALSINDEX); ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("REQUEST_URI"), CONST_BUF_LEN(con->request.orig_uri)); ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("SCRIPT_NAME"), CONST_BUF_LEN(con->uri.path)); ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("SCRIPT_FILENAME"), CONST_BUF_LEN(con->physical.path)); ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.doc_root)); ++ if (!buffer_string_is_empty(con->request.pathinfo)) { ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("PATH_INFO"), CONST_BUF_LEN(con->request.pathinfo)); ++ } + +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("REQUEST_URI"), CONST_BUF_LEN(con->request.orig_uri)); +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("SCRIPT_NAME"), CONST_BUF_LEN(con->uri.path)); +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("SCRIPT_FILENAME"), CONST_BUF_LEN(con->physical.path)); +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.doc_root)); +- if (!buffer_string_is_empty(con->request.pathinfo)) { +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("PATH_INFO"), CONST_BUF_LEN(con->request.pathinfo)); ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("CWD"), CONST_BUF_LEN(p->basedir)); ++ c_to_lua_push(L, header_tbl, CONST_STR_LEN("BASEURL"), CONST_BUF_LEN(p->baseurl)); + } ++ lua_setglobal(L, "request"); + +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("CWD"), CONST_BUF_LEN(p->basedir)); +- c_to_lua_push(L, header_tbl, CONST_STR_LEN("BASEURL"), CONST_BUF_LEN(p->baseurl)); +- + /* register GET parameter */ +- lua_pushliteral(L, "get"); + lua_newtable(L); +- lua_settable(L, LUA_GLOBALSINDEX); ++ { ++ int get_tbl = lua_gettop(L); + +- lua_pushliteral(L, "get"); +- header_tbl = lua_gettop(L); +- lua_gettable(L, LUA_GLOBALSINDEX); ++ buffer_copy_buffer(b, con->uri.query); ++ cache_export_get_params(L, get_tbl, b); ++ buffer_reset(b); ++ } ++ lua_setglobal(L, "get"); + +- buffer_copy_buffer(b, con->uri.query); +- cache_export_get_params(L, header_tbl, b); +- buffer_reset(b); +- + /* 2 default constants */ +- lua_pushliteral(L, "CACHE_HIT"); +- lua_pushnumber(L, 0); +- lua_settable(L, LUA_GLOBALSINDEX); ++ lua_pushinteger(L, 0); ++ lua_setglobal(L, "CACHE_HIT"); + +- lua_pushliteral(L, "CACHE_MISS"); +- lua_pushnumber(L, 1); +- lua_settable(L, LUA_GLOBALSINDEX); ++ lua_pushinteger(L, 1); ++ lua_setglobal(L, "CACHE_MISS"); + + /* load lua program */ +- if (lua_load(L, load_file, &rm, fn->ptr) || lua_pcall(L,0,1,0)) { +- log_error_write(srv, __FILE__, __LINE__, "s", +- lua_tostring(L,-1)); ++ ret = luaL_loadfile(L, fn->ptr); ++ if (0 != ret) { ++ log_error_write(srv, __FILE__, __LINE__, "sbsS", ++ "failed loading cml_lua script", ++ fn, ++ ":", ++ lua_tostring(L, -1)); ++ goto error; ++ } + ++ if (lua_pcall(L, 0, 1, 0)) { ++ log_error_write(srv, __FILE__, __LINE__, "sbsS", ++ "failed running cml_lua script", ++ fn, ++ ":", ++ lua_tostring(L, -1)); + goto error; + } + + /* get return value */ +- ret = (int)lua_tonumber(L, -1); ++ ret = (int)lua_tointeger(L, -1); + lua_pop(L, 1); + + /* fetch the data from lua */ +@@ -323,10 +223,8 @@ + goto error; + } + +- lua_pushstring(L, "output_include"); +- ++ lua_getglobal(L, "output_include"); + curelem = lua_gettop(L); +- lua_gettable(L, LUA_GLOBALSINDEX); + + /* HOW-TO build a etag ? + * as we don't just have one file we have to take the stat() +@@ -441,7 +339,6 @@ + error: + lua_close(L); + +- stream_close(&rm.st); + buffer_free(b); + + return ret /* cache-error */; +Index: lighttpd-1.4.37/src/mod_magnet.c +=================================================================== +--- lighttpd-1.4.37/src/mod_magnet.c (revision 3069) ++++ lighttpd-1.4.37/src/mod_magnet.c (revision 3070) +@@ -20,6 +20,9 @@ + #include + #include + ++#define LUA_RIDX_LIGHTTPD_SERVER "lighty.srv" ++#define LUA_RIDX_LIGHTTPD_CONNECTION "lighty.con" ++ + #define MAGNET_CONFIG_RAW_URL "magnet.attract-raw-url-to" + #define MAGNET_CONFIG_PHYSICAL_PATH "magnet.attract-physical-path-to" + #define MAGNET_RESTART_REQUEST 99 +@@ -159,23 +162,57 @@ + } + #undef PATCH + +-/* See http://lua-users.org/wiki/GeneralizedPairsAndIpairs for implementation details. */ ++static void magnet_get_global_table(lua_State *L) { /* (-0, +1, e) */ ++#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 502 ++ lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); ++#else ++ lua_pushvalue(L, LUA_GLOBALSINDEX); ++#endif ++} + +-/* Override the default pairs() function to allow us to use a __pairs metakey */ ++static void magnet_setfenv_mainfn(lua_State *L, int funcIndex) { /* (-1, 0, -) */ ++#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 502 ++ /* set "_ENV" upvalue, which should be the first upvalue of a "main" lua ++ * function if it uses any global names ++ */ ++ ++ const char* first_upvalue_name = lua_getupvalue(L, funcIndex, 1); ++ if (NULL == first_upvalue_name) return; /* doesn't have any upvalues */ ++ lua_pop(L, 1); /* only need the name of the upvalue, not the value */ ++ ++ if (0 != strcmp(first_upvalue_name, "_ENV")) return; ++ ++ if (NULL == lua_setupvalue(L, funcIndex, 1)) { ++ /* pop value if lua_setupvalue didn't set the (not existing) upvalue */ ++ lua_pop(L, 1); ++ } ++#else ++ lua_setfenv(L, funcIndex); ++#endif ++} ++ ++#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 ++/* lua 5.2 already supports __pairs */ ++ ++/* See http://lua-users.org/wiki/GeneralizedPairsAndIpairs for implementation details. ++ * Override the default pairs() function to allow us to use a __pairs metakey ++ */ + static int magnet_pairs(lua_State *L) { +- luaL_checkany(L, 1); ++ luaL_checkany(L, 1); /* "self" */ + + if (luaL_getmetafield(L, 1, "__pairs")) { +- lua_insert(L, 1); +- lua_call(L, lua_gettop(L) - 1, LUA_MULTRET); +- return lua_gettop(L); ++ /* call __pairs(self) */ ++ lua_pushvalue(L, 1); ++ lua_call(L, 1, 3); + } else { ++ /* call (self) */ + lua_pushvalue(L, lua_upvalueindex(1)); +- lua_insert(L, 1); +- lua_call(L, lua_gettop(L) - 1, LUA_MULTRET); +- return lua_gettop(L); ++ lua_pushvalue(L, 1); ++ lua_call(L, 1, 3); + } ++ return 3; + } ++#endif + + /* Define a function that will iterate over an array* (in upval 1) using current position (upval 2) */ + static int magnet_array_next(lua_State *L) { +@@ -229,40 +266,63 @@ + return 1; + } + +-static int magnet_print(lua_State *L) { +- const char *s = luaL_checkstring(L, 1); ++static server* magnet_get_server(lua_State *L) { + server *srv; + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); ++ lua_getfield(L, LUA_REGISTRYINDEX, LUA_RIDX_LIGHTTPD_SERVER); + srv = lua_touserdata(L, -1); + lua_pop(L, 1); + +- log_error_write(srv, __FILE__, __LINE__, "ss", +- "(lua-print)", s); ++ return srv; ++} + ++static connection* magnet_get_connection(lua_State *L) { ++ connection *con; ++ ++ lua_getfield(L, LUA_REGISTRYINDEX, LUA_RIDX_LIGHTTPD_CONNECTION); ++ con = lua_touserdata(L, -1); ++ lua_pop(L, 1); ++ ++ return con; ++} ++ ++typedef struct { ++ const char *ptr; ++ size_t len; ++} const_buffer; ++ ++static const_buffer magnet_checkconstbuffer(lua_State *L, int index) { ++ const_buffer cb; ++ cb.ptr = luaL_checklstring(L, index, &cb.len); ++ return cb; ++} ++ ++static buffer* magnet_checkbuffer(lua_State *L, int index) { ++ const_buffer cb = magnet_checkconstbuffer(L, index); ++ buffer *b = buffer_init(); ++ buffer_copy_string_len(b, cb.ptr, cb.len); ++ return b; ++} ++ ++static int magnet_print(lua_State *L) { ++ buffer *b = magnet_checkbuffer(L, 1); ++ ++ log_error_write(magnet_get_server(L), __FILE__, __LINE__, "sB", ++ "(lua-print)", ++ b); ++ ++ buffer_free(b); ++ + return 0; + } + + static int magnet_stat(lua_State *L) { +- const char *s = luaL_checkstring(L, 1); +- server *srv; +- connection *con; +- buffer *sb; ++ buffer *sb = magnet_checkbuffer(L, 1); ++ server *srv = magnet_get_server(L); ++ connection *con = magnet_get_connection(L); + stat_cache_entry *sce = NULL; + handler_t res; + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); +- +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- +- sb = buffer_init_string(s); + res = stat_cache_get_entry(srv, con, sb, &sce); + buffer_free(sb); + +@@ -271,7 +331,7 @@ + return 1; + } + +- lua_newtable(L); ++ lua_newtable(L); // return value + + lua_pushboolean(L, S_ISREG(sce->st.st_mode)); + lua_setfield(L, -2, "is_file"); +@@ -315,7 +375,6 @@ + lua_pushinteger(L, sce->st.st_ino); + lua_setfield(L, -2, "st_ino"); + +- + if (!buffer_string_is_empty(sce->etag)) { + /* we have to mutate the etag */ + buffer *b = buffer_init(); +@@ -340,31 +399,24 @@ + + + static int magnet_atpanic(lua_State *L) { +- const char *s = luaL_checkstring(L, 1); +- server *srv; ++ buffer *b = magnet_checkbuffer(L, 1); + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); ++ log_error_write(magnet_get_server(L), __FILE__, __LINE__, "sB", ++ "(lua-atpanic)", ++ b); + +- log_error_write(srv, __FILE__, __LINE__, "ss", +- "(lua-atpanic)", s); ++ buffer_free(b); + + longjmp(exceptionjmp, 1); + } + + static int magnet_reqhdr_get(lua_State *L) { +- connection *con; ++ connection *con = magnet_get_connection(L); + data_string *ds; + ++ /* __index: param 1 is the (empty) table the value was not found in */ + const char *key = luaL_checkstring(L, 2); + +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + if (NULL != (ds = (data_string *)array_get_element(con->request.headers, key))) { + if (!buffer_is_empty(ds->value)) { + lua_pushlstring(L, CONST_BUF_LEN(ds->value)); +@@ -378,60 +430,40 @@ + } + + static int magnet_reqhdr_pairs(lua_State *L) { +- connection *con; ++ connection *con = magnet_get_connection(L); + +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + return magnet_array_pairs(L, con->request.headers); + } + + static int magnet_status_get(lua_State *L) { + data_integer *di; +- server *srv; +- size_t key_len = 0; ++ server *srv = magnet_get_server(L); + +- const char *key = luaL_checklstring(L, 2, &key_len); ++ /* __index: param 1 is the (empty) table the value was not found in */ ++ const_buffer key = magnet_checkconstbuffer(L, 2); + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); ++ di = status_counter_get_counter(srv, key.ptr, key.len); + +- di = status_counter_get_counter(srv, key, key_len); ++ lua_pushinteger(L, (lua_Integer)di->value); + +- lua_pushnumber(L, (double)di->value); +- + return 1; + } + + static int magnet_status_set(lua_State *L) { +- size_t key_len = 0; +- server *srv; ++ server *srv = magnet_get_server(L); + +- const char *key = luaL_checklstring(L, 2, &key_len); +- int counter = luaL_checkint(L, 3); ++ /* __newindex: param 1 is the (empty) table the value is supposed to be set in */ ++ const_buffer key = magnet_checkconstbuffer(L, 2); ++ int counter = (int) luaL_checkinteger(L, 3); + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); ++ status_counter_set(srv, key.ptr, key.len, counter); + +- status_counter_set(srv, key, key_len, counter); +- + return 0; + } + + static int magnet_status_pairs(lua_State *L) { +- server *srv; ++ server *srv = magnet_get_server(L); + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + return magnet_array_pairs(L, srv->status); + } + +@@ -534,22 +566,13 @@ + } + + static int magnet_env_get(lua_State *L) { +- server *srv; +- connection *con; ++ server *srv = magnet_get_server(L); ++ connection *con = magnet_get_connection(L); + ++ /* __index: param 1 is the (empty) table the value was not found in */ + const char *key = luaL_checkstring(L, 2); + buffer *dest = NULL; + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); +- +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + dest = magnet_env_get_buffer(srv, con, key); + + if (!buffer_is_empty(dest)) { +@@ -562,25 +585,22 @@ + } + + static int magnet_env_set(lua_State *L) { +- server *srv; +- connection *con; ++ server *srv = magnet_get_server(L); ++ connection *con = magnet_get_connection(L); + ++ /* __newindex: param 1 is the (empty) table the value is supposed to be set in */ + const char *key = luaL_checkstring(L, 2); +- const char *val = luaL_checkstring(L, 3); + buffer *dest = NULL; + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); ++ luaL_checkany(L, 3); /* nil or a string */ + +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + if (NULL != (dest = magnet_env_get_buffer(srv, con, key))) { +- buffer_copy_string(dest, val); ++ if (lua_isnil(L, 3)) { ++ buffer_reset(dest); ++ } else { ++ const_buffer val = magnet_checkconstbuffer(L, 3); ++ buffer_copy_string_len(dest, val.ptr, val.len); ++ } + } else { + /* couldn't save */ + +@@ -591,28 +611,24 @@ + } + + static int magnet_env_next(lua_State *L) { +- server *srv; +- connection *con; +- int pos = lua_tointeger(L, lua_upvalueindex(1)); ++ server *srv = magnet_get_server(L); ++ connection *con = magnet_get_connection(L); ++ const int pos = lua_tointeger(L, lua_upvalueindex(1)); + + buffer *dest; + +- lua_pushstring(L, "lighty.srv"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- srv = lua_touserdata(L, -1); +- lua_pop(L, 1); +- +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- ++ /* ignore previous key: use upvalue for current pos */ + lua_settop(L, 0); + + if (NULL == magnet_env[pos].name) return 0; /* end of list */ ++ /* Update our positional upval to reflect our new current position */ ++ lua_pushinteger(L, pos + 1); ++ lua_replace(L, lua_upvalueindex(1)); + ++ /* key to return */ + lua_pushstring(L, magnet_env[pos].name); + ++ /* get value */ + dest = magnet_env_get_buffer_by_id(srv, con, magnet_env[pos].type); + if (!buffer_is_empty(dest)) { + lua_pushlstring(L, CONST_BUF_LEN(dest)); +@@ -620,12 +636,7 @@ + lua_pushnil(L); + } + +- /* Update our positional upval to reflect our new current position */ +- pos++; +- lua_pushinteger(L, pos); +- lua_replace(L, lua_upvalueindex(1)); +- +- /* Returning 2 items on the stack (key, value) */ ++ /* return 2 items on the stack (key, value) */ + return 2; + } + +@@ -636,16 +647,12 @@ + } + + static int magnet_cgi_get(lua_State *L) { +- connection *con; ++ connection *con = magnet_get_connection(L); + data_string *ds; + ++ /* __index: param 1 is the (empty) table the value was not found in */ + const char *key = luaL_checkstring(L, 2); + +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + ds = (data_string *)array_get_element(con->environment, key); + if (NULL != ds && !buffer_is_empty(ds->value)) + lua_pushlstring(L, CONST_BUF_LEN(ds->value)); +@@ -656,47 +663,28 @@ + } + + static int magnet_cgi_set(lua_State *L) { +- connection *con; ++ connection *con = magnet_get_connection(L); + +- const char *key = luaL_checkstring(L, 2); +- const char *val = luaL_checkstring(L, 3); ++ /* __newindex: param 1 is the (empty) table the value is supposed to be set in */ ++ const_buffer key = magnet_checkconstbuffer(L, 2); ++ const_buffer val = magnet_checkconstbuffer(L, 2); + +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); ++ array_set_key_value(con->environment, key.ptr, key.len, val.ptr, val.len); + +- array_set_key_value(con->environment, key, strlen(key), val, strlen(val)); +- + return 0; + } + + static int magnet_cgi_pairs(lua_State *L) { +- connection *con; ++ connection *con = magnet_get_connection(L); + +- lua_pushstring(L, "lighty.con"); +- lua_gettable(L, LUA_REGISTRYINDEX); +- con = lua_touserdata(L, -1); +- lua_pop(L, 1); +- + return magnet_array_pairs(L, con->environment); + } + + +-static int magnet_copy_response_header(server *srv, connection *con, plugin_data *p, lua_State *L) { +- UNUSED(p); +- /** +- * get the environment of the function +- */ ++static int magnet_copy_response_header(server *srv, connection *con, lua_State *L, int lighty_table_ndx) { ++ force_assert(lua_istable(L, lighty_table_ndx)); + +- lua_getfenv(L, -1); /* -1 is the function */ +- +- /* lighty.header */ +- +- lua_getfield(L, -1, "lighty"); /* lighty.* from the env */ +- force_assert(lua_istable(L, -1)); +- +- lua_getfield(L, -1, "header"); /* lighty.header */ ++ lua_getfield(L, lighty_table_ndx, "header"); /* lighty.header */ + if (lua_istable(L, -1)) { + /* header is found, and is a table */ + +@@ -703,23 +691,17 @@ + lua_pushnil(L); + while (lua_next(L, -2) != 0) { + if (lua_isstring(L, -1) && lua_isstring(L, -2)) { +- const char *key, *val; +- size_t key_len, val_len; ++ const_buffer key = magnet_checkconstbuffer(L, -2); ++ const_buffer val = magnet_checkconstbuffer(L, -1); + +- key = lua_tolstring(L, -2, &key_len); +- val = lua_tolstring(L, -1, &val_len); +- +- response_header_overwrite(srv, con, key, key_len, val, val_len); ++ response_header_overwrite(srv, con, key.ptr, key.len, val.ptr, val.len); + } + + lua_pop(L, 1); + } + } ++ lua_pop(L, 1); /* pop lighty.header */ + +- lua_pop(L, 1); /* pop the header-table */ +- lua_pop(L, 1); /* pop the lighty-env */ +- lua_pop(L, 1); /* pop the function env */ +- + return 0; + } + +@@ -732,22 +714,13 @@ + * + * return 200 + */ +-static int magnet_attach_content(server *srv, connection *con, plugin_data *p, lua_State *L) { +- UNUSED(p); +- /** +- * get the environment of the function +- */ ++static int magnet_attach_content(server *srv, connection *con, lua_State *L, int lighty_table_ndx) { ++ force_assert(lua_istable(L, lighty_table_ndx)); + +- force_assert(lua_isfunction(L, -1)); +- lua_getfenv(L, -1); /* -1 is the function */ +- +- lua_getfield(L, -1, "lighty"); /* lighty.* from the env */ +- force_assert(lua_istable(L, -1)); +- +- lua_getfield(L, -1, "content"); /* lighty.content */ ++ lua_getfield(L, lighty_table_ndx, "content"); /* lighty.content */ + if (lua_istable(L, -1)) { + int i; +- /* header is found, and is a table */ ++ /* content is found, and is a table */ + + for (i = 1; ; i++) { + lua_rawgeti(L, -1, i); +@@ -754,10 +727,9 @@ + + /* -1 is the value and should be the value ... aka a table */ + if (lua_isstring(L, -1)) { +- size_t s_len = 0; +- const char *s = lua_tolstring(L, -1, &s_len); ++ const_buffer data = magnet_checkconstbuffer(L, -1); + +- chunkqueue_append_mem(con->write_queue, s, s_len); ++ chunkqueue_append_mem(con->write_queue, data.ptr, data.len); + } else if (lua_istable(L, -1)) { + lua_getfield(L, -1, "filename"); + lua_getfield(L, -2, "length"); +@@ -766,36 +738,24 @@ + if (lua_isstring(L, -3)) { /* filename has to be a string */ + buffer *fn; + stat_cache_entry *sce; +- const char *fn_str; + handler_t res; + +- fn_str = lua_tostring(L, -3); +- fn = buffer_init_string(fn_str); ++ fn = magnet_checkbuffer(L, -3); + + res = stat_cache_get_entry(srv, con, fn, &sce); + + if (HANDLER_GO_ON == res) { +- off_t off = 0; +- off_t len = 0; ++ off_t off = (off_t) luaL_optinteger(L, -1, 0); ++ off_t len = (off_t) luaL_optinteger(L, -2, (lua_Integer) sce->st.st_size); + +- if (lua_isnumber(L, -1)) { +- off = lua_tonumber(L, -1); +- } +- +- if (lua_isnumber(L, -2)) { +- len = lua_tonumber(L, -2); +- } else { +- len = sce->st.st_size; +- } +- + if (off < 0) { + buffer_free(fn); +- return luaL_error(L, "offset for '%s' is negative", fn_str); ++ return luaL_error(L, "offset for '%s' is negative", lua_tostring(L, -3)); + } + + if (len < off) { + buffer_free(fn); +- return luaL_error(L, "offset > length for '%s'", fn_str); ++ return luaL_error(L, "offset > length for '%s'", lua_tostring(L, -3)); + } + + chunkqueue_append_file(con->write_queue, fn, off, len - off); +@@ -803,40 +763,34 @@ + + buffer_free(fn); + } else { +- lua_pop(L, 3 + 2); /* correct the stack */ +- + return luaL_error(L, "content[%d] is a table and requires the field \"filename\"", i); + } + + lua_pop(L, 3); + } else if (lua_isnil(L, -1)) { +- /* oops, end of list */ ++ /* end of list */ + + lua_pop(L, 1); + + break; + } else { +- lua_pop(L, 4); +- + return luaL_error(L, "content[%d] is neither a string nor a table: ", i); + } + +- lua_pop(L, 1); /* pop the content[...] table */ ++ lua_pop(L, 1); /* pop the content[...] entry value */ + } + } else { + return luaL_error(L, "lighty.content has to be a table"); + } +- lua_pop(L, 1); /* pop the header-table */ +- lua_pop(L, 1); /* pop the lighty-table */ +- lua_pop(L, 1); /* php the function env */ ++ lua_pop(L, 1); /* pop lighty.content */ + + return 0; + } + +-static int traceback (lua_State *L) { ++static int traceback(lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ +- lua_getfield(L, LUA_GLOBALSINDEX, "debug"); ++ lua_getglobal(L, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; +@@ -852,6 +806,10 @@ + return 1; + } + ++/* push traceback function before calling lua_pcall after narg arguments ++ * have been pushed (inserts it before the arguments). returns index for ++ * traceback function ("msgh" in lua_pcall) ++ */ + static int push_traceback(lua_State *L, int narg) { + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); +@@ -861,11 +819,11 @@ + + static handler_t magnet_attract(server *srv, connection *con, plugin_data *p, buffer *name) { + lua_State *L; +- int lua_return_value = -1; +- int errfunc; ++ int lua_return_value; ++ const int func_ndx = 1; ++ const int lighty_table_ndx = 2; ++ + /* get the script-context */ +- +- + L = script_cache_get_script(srv, con, p->cache, name); + + if (lua_isstring(L, -1)) { +@@ -878,7 +836,7 @@ + + lua_pop(L, 1); + +- force_assert(lua_gettop(L) == 0); /* only the function should be on the stack */ ++ force_assert(lua_gettop(L) == 0); /* only the error should have been on the stack */ + + con->http_status = 500; + con->mode = DIRECT; +@@ -886,13 +844,14 @@ + return HANDLER_FINISHED; + } + +- lua_pushstring(L, "lighty.srv"); ++ force_assert(lua_gettop(L) == 1); ++ force_assert(lua_isfunction(L, func_ndx)); ++ + lua_pushlightuserdata(L, srv); +- lua_settable(L, LUA_REGISTRYINDEX); /* registery[] = srv */ ++ lua_setfield(L, LUA_REGISTRYINDEX, LUA_RIDX_LIGHTTPD_SERVER); + +- lua_pushstring(L, "lighty.con"); + lua_pushlightuserdata(L, con); +- lua_settable(L, LUA_REGISTRYINDEX); /* registery[] = con */ ++ lua_setfield(L, LUA_REGISTRYINDEX, LUA_RIDX_LIGHTTPD_CONNECTION); + + lua_atpanic(L, magnet_atpanic); + +@@ -901,7 +860,7 @@ + * + * setmetatable({}, {__index = _G}) + * +- * if a function, symbol is not defined in our env, __index will lookup ++ * if a function symbol is not defined in our env, __index will lookup + * in the global env. + * + * all variables created in the script-env will be thrown +@@ -914,9 +873,13 @@ + lua_setfield(L, -2, "print"); /* -1 is the env we want to set(sp -= 1) */ + + /** +- * lighty.request[] has the HTTP-request headers +- * lighty.content[] is a table of string/file +- * lighty.header[] is a array to set response headers ++ * lighty.request[] (ro) has the HTTP-request headers ++ * lighty.env[] (rw) has various url/physical file paths and ++ * request meta data; might contain nil values ++ * lighty.req_env[] (ro) has the cgi environment ++ * lighty.status[] (ro) has the status counters ++ * lighty.content[] (rw) is a table of string/file ++ * lighty.header[] (rw) is a array to set response headers + */ + + lua_newtable(L); /* lighty.* (sp += 1) */ +@@ -931,7 +894,7 @@ + lua_setfield(L, -2, "request"); /* content = {} (sp -= 1) */ + + lua_newtable(L); /* {} (sp += 1) */ +- lua_newtable(L); /* the meta-table for the request-table (sp += 1) */ ++ lua_newtable(L); /* the meta-table for the env-table (sp += 1) */ + lua_pushcfunction(L, magnet_env_get); /* (sp += 1) */ + lua_setfield(L, -2, "__index"); /* (sp -= 1) */ + lua_pushcfunction(L, magnet_env_set); /* (sp += 1) */ +@@ -938,11 +901,11 @@ + lua_setfield(L, -2, "__newindex"); /* (sp -= 1) */ + lua_pushcfunction(L, magnet_env_pairs); /* (sp += 1) */ + lua_setfield(L, -2, "__pairs"); /* (sp -= 1) */ +- lua_setmetatable(L, -2); /* tie the metatable to request (sp -= 1) */ ++ lua_setmetatable(L, -2); /* tie the metatable to env (sp -= 1) */ + lua_setfield(L, -2, "env"); /* content = {} (sp -= 1) */ + + lua_newtable(L); /* {} (sp += 1) */ +- lua_newtable(L); /* the meta-table for the request-table (sp += 1) */ ++ lua_newtable(L); /* the meta-table for the req_env-table (sp += 1) */ + lua_pushcfunction(L, magnet_cgi_get); /* (sp += 1) */ + lua_setfield(L, -2, "__index"); /* (sp -= 1) */ + lua_pushcfunction(L, magnet_cgi_set); /* (sp += 1) */ +@@ -953,7 +916,7 @@ + lua_setfield(L, -2, "req_env"); /* content = {} (sp -= 1) */ + + lua_newtable(L); /* {} (sp += 1) */ +- lua_newtable(L); /* the meta-table for the request-table (sp += 1) */ ++ lua_newtable(L); /* the meta-table for the status-table (sp += 1) */ + lua_pushcfunction(L, magnet_status_get); /* (sp += 1) */ + lua_setfield(L, -2, "__index"); /* (sp -= 1) */ + lua_pushcfunction(L, magnet_status_set); /* (sp += 1) */ +@@ -960,7 +923,7 @@ + lua_setfield(L, -2, "__newindex"); /* (sp -= 1) */ + lua_pushcfunction(L, magnet_status_pairs); /* (sp += 1) */ + lua_setfield(L, -2, "__pairs"); /* (sp -= 1) */ +- lua_setmetatable(L, -2); /* tie the metatable to request (sp -= 1) */ ++ lua_setmetatable(L, -2); /* tie the metatable to statzs (sp -= 1) */ + lua_setfield(L, -2, "status"); /* content = {} (sp -= 1) */ + + /* add empty 'content' and 'header' tables */ +@@ -976,78 +939,92 @@ + lua_pushcfunction(L, magnet_stat); /* (sp += 1) */ + lua_setfield(L, -2, "stat"); /* -1 is the env we want to set (sp -= 1) */ + ++ /* insert lighty table at index 2 */ ++ lua_pushvalue(L, -1); ++ lua_insert(L, lighty_table_ndx); ++ + lua_setfield(L, -2, "lighty"); /* lighty.* (sp -= 1) */ + +- /* override the default pairs() function to our __pairs capable version */ ++#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 ++ /* override the default pairs() function to our __pairs capable version; ++ * not needed for lua 5.2+ ++ */ + lua_getglobal(L, "pairs"); /* push original pairs() (sp += 1) */ + lua_pushcclosure(L, magnet_pairs, 1); + lua_setfield(L, -2, "pairs"); /* (sp -= 1) */ ++#endif + + lua_newtable(L); /* the meta-table for the new env (sp += 1) */ +- lua_pushvalue(L, LUA_GLOBALSINDEX); /* (sp += 1) */ ++ magnet_get_global_table(L); /* (sp += 1) */ + lua_setfield(L, -2, "__index"); /* { __index = _G } (sp -= 1) */ + lua_setmetatable(L, -2); /* setmetatable({}, {__index = _G}) (sp -= 1) */ + ++ magnet_setfenv_mainfn(L, 1); /* (sp -= 1) */ + +- lua_setfenv(L, -2); /* on the stack should be a modified env (sp -= 1) */ +- +- errfunc = push_traceback(L, 0); +- if (lua_pcall(L, 0, 1, errfunc)) { ++ /* pcall will destroy the func value, duplicate it */ /* (sp += 1) */ ++ lua_pushvalue(L, func_ndx); ++ { ++ int errfunc = push_traceback(L, 0); ++ int ret = lua_pcall(L, 0, 1, errfunc); + lua_remove(L, errfunc); +- log_error_write(srv, __FILE__, __LINE__, +- "ss", +- "lua_pcall():", +- lua_tostring(L, -1)); +- lua_pop(L, 1); /* remove the error-msg and the function copy from the stack */ + +- force_assert(lua_gettop(L) == 1); /* only the function should be on the stack */ ++ /* reset environment */ ++ magnet_get_global_table(L); /* (sp += 1) */ ++ magnet_setfenv_mainfn(L, 1); /* (sp -= 1) */ + +- con->http_status = 500; +- con->mode = DIRECT; ++ if (0 != ret) { ++ log_error_write(srv, __FILE__, __LINE__, ++ "ss", ++ "lua_pcall():", ++ lua_tostring(L, -1)); ++ lua_pop(L, 2); /* remove the error-msg and the lighty table at index 2 */ + +- return HANDLER_FINISHED; +- } +- lua_remove(L, errfunc); ++ force_assert(lua_gettop(L) == 1); /* only the function should be on the stack */ + +- /* we should have the function-copy and the return value on the stack */ +- force_assert(lua_gettop(L) == 2); ++ con->http_status = 500; ++ con->mode = DIRECT; + +- if (lua_isnumber(L, -1)) { +- /* if the ret-value is a number, take it */ +- lua_return_value = (int)lua_tonumber(L, -1); ++ return HANDLER_FINISHED; ++ } + } +- lua_pop(L, 1); /* pop the ret-value */ + +- magnet_copy_response_header(srv, con, p, L); ++ /* we should have the function, the lighty table and the return value on the stack */ ++ force_assert(lua_gettop(L) == 3); + +- if (lua_return_value > 99) { +- con->http_status = lua_return_value; +- con->file_finished = 1; ++ lua_return_value = (int) luaL_optinteger(L, -1, -1); ++ lua_pop(L, 1); /* pop return value */ + +- /* try { ...*/ +- if (0 == setjmp(exceptionjmp)) { +- magnet_attach_content(srv, con, p, L); +- if (!chunkqueue_is_empty(con->write_queue)) { +- con->mode = p->id; ++ magnet_copy_response_header(srv, con, L, lighty_table_ndx); ++ ++ { ++ handler_t result = HANDLER_GO_ON; ++ ++ if (lua_return_value > 99) { ++ con->http_status = lua_return_value; ++ con->file_finished = 1; ++ ++ /* try { ...*/ ++ if (0 == setjmp(exceptionjmp)) { ++ magnet_attach_content(srv, con, L, lighty_table_ndx); ++ if (!chunkqueue_is_empty(con->write_queue)) { ++ con->mode = p->id; ++ } ++ } else { ++ lua_settop(L, 2); /* remove all but function and lighty table */ ++ /* } catch () { */ ++ con->http_status = 500; ++ con->mode = DIRECT; + } +- } else { +- /* } catch () { */ +- con->http_status = 500; +- con->mode = DIRECT; ++ ++ result = HANDLER_FINISHED; ++ } else if (MAGNET_RESTART_REQUEST == lua_return_value) { ++ result = HANDLER_COMEBACK; + } + +- force_assert(lua_gettop(L) == 1); /* only the function should be on the stack */ ++ lua_pop(L, 1); /* pop the lighty table */ ++ force_assert(lua_gettop(L) == 1); /* only the function should remain on the stack */ + +- /* we are finished */ +- return HANDLER_FINISHED; +- } else if (MAGNET_RESTART_REQUEST == lua_return_value) { +- force_assert(lua_gettop(L) == 1); /* only the function should be on the stack */ +- +- return HANDLER_COMEBACK; +- } else { +- force_assert(lua_gettop(L) == 1); /* only the function should be on the stack */ +- +- return HANDLER_GO_ON; ++ return result; + } + } + +Index: lighttpd-1.4.37/src/mod_cml_funcs.c +=================================================================== +--- lighttpd-1.4.37/src/mod_cml_funcs.c (revision 3069) ++++ lighttpd-1.4.37/src/mod_cml_funcs.c (revision 3070) +@@ -37,6 +37,8 @@ + HASH HA1; + char hex[33]; + int n = lua_gettop(L); ++ size_t s_len; ++ const char *s; + + if (n != 1) { + lua_pushstring(L, "md5: expected one argument"); +@@ -48,8 +50,10 @@ + lua_error(L); + } + ++ s = lua_tolstring(L, 1, &s_len); ++ + li_MD5_Init(&Md5Ctx); +- li_MD5_Update(&Md5Ctx, (unsigned char *)lua_tostring(L, 1), lua_strlen(L, 1)); ++ li_MD5_Update(&Md5Ctx, (unsigned char *) s, (unsigned int) s_len); + li_MD5_Final(HA1, &Md5Ctx); + + li_tohex(hex, (const char*) HA1, 16); +@@ -79,7 +83,7 @@ + return 1; + } + +- lua_pushnumber(L, st.st_mtime); ++ lua_pushinteger(L, st.st_mtime); + + return 1; + } +@@ -121,7 +125,7 @@ + return 1; + } + +- /* push d into registry */ ++ /* push d into userdata */ + lua_pushlightuserdata(L, d); + lua_pushcclosure(L, f_dir_files_iter, 1); + +@@ -147,7 +151,7 @@ + return 1; + } + +- lua_pushnumber(L, S_ISREG(st.st_mode)); ++ lua_pushinteger(L, S_ISREG(st.st_mode)); + + return 1; + } +@@ -171,7 +175,7 @@ + return 1; + } + +- lua_pushnumber(L, S_ISDIR(st.st_mode)); ++ lua_pushinteger(L, S_ISDIR(st.st_mode)); + + return 1; + } +@@ -183,6 +187,8 @@ + char *r; + int n = lua_gettop(L); + struct memcache *mc; ++ size_t s_len; ++ const char *s; + + if (!lua_islightuserdata(L, lua_upvalueindex(1))) { + lua_pushstring(L, "where is my userdata ?"); +@@ -201,9 +207,8 @@ + lua_error(L); + } + +- if (NULL == (r = mc_aget(mc, +- (char*) lua_tostring(L, 1), lua_strlen(L, 1)))) { +- ++ s = lua_tolstring(L, 1, &s_len); ++ if (NULL == (r = mc_aget(mc, (char*) s, s_len))) { + lua_pushboolean(L, 0); + return 1; + } +@@ -217,6 +222,8 @@ + int f_memcache_get_string(lua_State *L) { + char *r; + int n = lua_gettop(L); ++ size_t s_len; ++ const char *s; + + struct memcache *mc; + +@@ -238,8 +245,8 @@ + lua_error(L); + } + +- if (NULL == (r = mc_aget(mc, +- (char*) lua_tostring(L, 1), lua_strlen(L, 1)))) { ++ s = lua_tolstring(L, 1, &s_len); ++ if (NULL == (r = mc_aget(mc, (char*) s, s_len))) { + lua_pushnil(L); + return 1; + } +@@ -254,6 +261,8 @@ + int f_memcache_get_long(lua_State *L) { + char *r; + int n = lua_gettop(L); ++ size_t s_len; ++ const char *s; + + struct memcache *mc; + +@@ -275,13 +284,13 @@ + lua_error(L); + } + +- if (NULL == (r = mc_aget(mc, +- (char*) lua_tostring(L, 1), lua_strlen(L, 1)))) { ++ s = lua_tolstring(L, 1, &s_len); ++ if (NULL == (r = mc_aget(mc, (char*) s, s_len))) { + lua_pushnil(L); + return 1; + } + +- lua_pushnumber(L, strtol(r, NULL, 10)); ++ lua_pushinteger(L, strtol(r, NULL, 10)); + + free(r); + diff --git a/package/linux-pam/0003-Conditionally-compile-per-innetgr-availability.patch b/package/linux-pam/0003-Conditionally-compile-per-innetgr-availability.patch new file mode 100644 index 0000000000..4b516fa986 --- /dev/null +++ b/package/linux-pam/0003-Conditionally-compile-per-innetgr-availability.patch @@ -0,0 +1,84 @@ +innetgr is not available/functional in uclibc, provide conditions for +compilation. + +Patch originally by Dmitry Golubovsky - porting +to linux-pam 1.2.1. + +Signed-off-by: Brendan Heading + +Upstream-status: pending + +--- + modules/pam_group/pam_group.c | 8 +++++++- + modules/pam_succeed_if/pam_succeed_if.c | 4 ++++ + modules/pam_time/pam_time.c | 8 +++++++- + 3 files changed, 18 insertions(+), 2 deletions(-) + +diff --git a/modules/pam_group/pam_group.c b/modules/pam_group/pam_group.c +index be5f20f..0982de8 100644 +--- a/modules/pam_group/pam_group.c ++++ b/modules/pam_group/pam_group.c +@@ -655,8 +655,14 @@ static int check_account(pam_handle_t *pamh, const char *service, + continue; + } + /* If buffer starts with @, we are using netgroups */ +- if (buffer[0] == '@') ++ if (buffer[0] == '@') { ++#ifdef HAVE_INNETGR + good &= innetgr (&buffer[1], NULL, user, NULL); ++#else ++ good = 0; ++ pam_syslog (pamh, LOG_ERR, "pam_group does not have netgroup support"); ++#endif /* HAVE_INNETGR */ ++ } + /* otherwise, if the buffer starts with %, it's a UNIX group */ + else if (buffer[0] == '%') + good &= pam_modutil_user_in_group_nam_nam(pamh, user, &buffer[1]); +diff --git a/modules/pam_succeed_if/pam_succeed_if.c b/modules/pam_succeed_if/pam_succeed_if.c +index aa828fc..c09d669 100644 +--- a/modules/pam_succeed_if/pam_succeed_if.c ++++ b/modules/pam_succeed_if/pam_succeed_if.c +@@ -233,16 +233,20 @@ evaluate_notingroup(pam_handle_t *pamh, const char *user, const char *group) + static int + evaluate_innetgr(const char *host, const char *user, const char *group) + { ++#ifdef HAVE_INNETGR + if (innetgr(group, host, user, NULL) == 1) + return PAM_SUCCESS; ++#endif /* HAVE_INNETGR */ + return PAM_AUTH_ERR; + } + /* Return PAM_SUCCESS if the (host,user) is NOT in the netgroup. */ + static int + evaluate_notinnetgr(const char *host, const char *user, const char *group) + { ++#ifdef HAVE_INNETGR + if (innetgr(group, host, user, NULL) == 0) + return PAM_SUCCESS; ++#endif /* HAVE_INNETGR */ + return PAM_AUTH_ERR; + } + +diff --git a/modules/pam_time/pam_time.c b/modules/pam_time/pam_time.c +index c94737c..4898fd2 100644 +--- a/modules/pam_time/pam_time.c ++++ b/modules/pam_time/pam_time.c +@@ -554,8 +554,14 @@ check_account(pam_handle_t *pamh, const char *service, + continue; + } + /* If buffer starts with @, we are using netgroups */ +- if (buffer[0] == '@') ++ if (buffer[0] == '@') { ++#ifdef HAVE_INNETGR + good &= innetgr (&buffer[1], NULL, user, NULL); ++#else ++ good = 0; ++ pam_syslog (pamh, LOG_ERR, "pam_time does not have netgroup support"); ++#endif /* HAVE_INNETGR */ ++ } + else + good &= logic_field(pamh, user, buffer, count, is_same); + D(("with user: %s", good ? "passes":"fails" )); +-- +2.4.3 + diff --git a/package/liquid-dsp/0001-configure.ac-use-AC_CONFIG_MACRO_DIR.patch b/package/liquid-dsp/0001-configure.ac-use-AC_CONFIG_MACRO_DIR.patch new file mode 100644 index 0000000000..c51f587813 --- /dev/null +++ b/package/liquid-dsp/0001-configure.ac-use-AC_CONFIG_MACRO_DIR.patch @@ -0,0 +1,45 @@ +From c9d239490d47d5dd3d7d7b8b7d9007171c5f60ce Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sun, 11 Oct 2015 15:27:09 +0200 +Subject: [PATCH] configure.ac: use AC_CONFIG_MACRO_DIR + +Instead of having to explicitly pass -I./scripts when running aclocal, +use the AC_CONFIG_MACRO_DIR() macro in configure.ac. This allows to +use "autoreconf" normally, without any hacks. + +Submitted upstream at https://github.com/jgaeddert/liquid-dsp/pull/15. + +Signed-off-by: Thomas Petazzoni +--- + bootstrap.sh | 2 +- + configure.ac | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/bootstrap.sh b/bootstrap.sh +index 640e01d..eb4894e 100755 +--- a/bootstrap.sh ++++ b/bootstrap.sh +@@ -27,7 +27,7 @@ + # + + rm -f config.cache aclocal.m4 +-aclocal -I./scripts ++aclocal + autoconf + autoheader + #automake --foreign --add-missing +diff --git a/configure.ac b/configure.ac +index a9ad1d7..3b1ba68 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -25,6 +25,7 @@ + + AC_INIT([liquid-dsp],[1.2.0],[support@liquidsdr.org]) + AC_CONFIG_SRCDIR([src/libliquid.c]) ++AC_CONFIG_MACRO_DIR([scripts]) + + # permit auxiliary scripts directory (e.g. config.sub, config.guess, install-sh) + AC_CONFIG_AUX_DIR(scripts/) +-- +2.6.1 + diff --git a/package/liquid-dsp/0002-math-poly-wrapping-isnan-in-T_ABS-to-help-compilatio.patch b/package/liquid-dsp/0002-math-poly-wrapping-isnan-in-T_ABS-to-help-compilatio.patch new file mode 100644 index 0000000000..f8dd602ba3 --- /dev/null +++ b/package/liquid-dsp/0002-math-poly-wrapping-isnan-in-T_ABS-to-help-compilatio.patch @@ -0,0 +1,39 @@ +From 3055eb3da9d0a202c1a975f7db0c8370a09a30bc Mon Sep 17 00:00:00 2001 +From: "Joseph D. Gaeddert" +Date: Thu, 25 Feb 2016 17:47:07 -0500 +Subject: [PATCH] math/poly: wrapping isnan in T_ABS to help compilation w/ + certain gcc versions + +This is an upstreamed patch backported from here: + +https://github.com/jgaeddert/liquid-dsp/commit/3055eb3da9d0a202c1a975f7db0c8370a09a30bc + +It fixes the following error: + +src/math/src/poly.findroots.c: In function +'polyc_findroots_bairstow_recursion': +src/math/src/poly.findroots.c:305:9: error: non-floating-point argument +in call to function '__builtin_isnan' + if (isnan(du) || isnan(dv)) { + +Signed-off-by: Vicente Olivert Riera +--- + src/math/src/poly.findroots.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/math/src/poly.findroots.c b/src/math/src/poly.findroots.c +index 21b5756..e000ee8 100644 +--- a/src/math/src/poly.findroots.c ++++ b/src/math/src/poly.findroots.c +@@ -302,7 +302,7 @@ void POLY(_findroots_bairstow_recursion)(T * _p, + #endif + + // adjust u, v +- if (isnan(du) || isnan(dv)) { ++ if (isnan(T_ABS(du)) || isnan(T_ABS(dv))) { + u *= 0.5f; + v *= 0.5f; + } else { +-- +2.7.3 + diff --git a/package/lirc-tools/0001-lib-use-proper-linking-method-to-avoid-parallel-buil.patch b/package/lirc-tools/0001-lib-use-proper-linking-method-to-avoid-parallel-buil.patch new file mode 100644 index 0000000000..5863128551 --- /dev/null +++ b/package/lirc-tools/0001-lib-use-proper-linking-method-to-avoid-parallel-buil.patch @@ -0,0 +1,46 @@ +From f2fc8c48e5e55a91b309225f377b6cb3783fc6f6 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 25 May 2016 15:21:57 +0200 +Subject: [PATCH] lib: use proper linking method to avoid parallel build issue + +Using _LDFLAGS = -l is correct when is an +external library. However, when it is built by the same package, and +especially in the same directory, this is wrong and can cause parallel +build issues. In lib/Makefile.am, there was: + +libirrecord_la_LDFLAGS = -llirc + +But the liblirc library is built in the same directory. Or, due to the +using of _LDFLAGS, make is not aware of the build dependency +between libirrecord and liblirc. + +To solve this, _LIBADD should be used instead, as follows: + +libirrecord_la_LIBADD = liblirc.la + +This fixes parallel build issues seen by automated build tests +conducted by the Buildroot project, such as: + + http://autobuild.buildroot.org/results/eb4/eb47d57de8182d25b1dacbf0ac3726ed20063d04/build-end.log + +Signed-off-by: Thomas Petazzoni +--- + lib/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/Makefile.am b/lib/Makefile.am +index ce5c94c..8780f88 100644 +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -29,7 +29,7 @@ liblirc_la_SOURCES = config_file.c \ + transmit.c \ + util.c + +-libirrecord_la_LDFLAGS = -llirc ++libirrecord_la_LIBADD = liblirc.la + libirrecord_la_SOURCES = irrecord.c + + liblirc_client_la_LDFLAGS = -version-info 4:0:4 +-- +2.7.4 + diff --git a/package/lirc-tools/0002-tools-make_rel_symlink.py-can-also-use-python2.patch b/package/lirc-tools/0002-tools-make_rel_symlink.py-can-also-use-python2.patch new file mode 100644 index 0000000000..070aab941c --- /dev/null +++ b/package/lirc-tools/0002-tools-make_rel_symlink.py-can-also-use-python2.patch @@ -0,0 +1,28 @@ +From c861eae83bae3116d330efb3c6061e2de4fdcbce Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Sun, 5 Apr 2015 22:26:12 +0300 +Subject: [PATCH] tools: make_rel_symlink.py can also use python2 + +The make_rel_symlink.py script is compatible with both python2 and python3. +Don't hard code a requirement for python3. + +Patch status: sent upstream + +Signed-off-by: Baruch Siach +--- + tools/make_rel_symlink.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/make_rel_symlink.py b/tools/make_rel_symlink.py +index 896637ff93e0..ff0403a0397a 100755 +--- a/tools/make_rel_symlink.py ++++ b/tools/make_rel_symlink.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python3 ++#!/usr/bin/env python + + import os + import os.path +-- +2.1.4 + diff --git a/package/logrotate/0001-make-autoreconfable.patch b/package/logrotate/0001-make-autoreconfable.patch new file mode 100644 index 0000000000..89759d07fe --- /dev/null +++ b/package/logrotate/0001-make-autoreconfable.patch @@ -0,0 +1,20 @@ +Make the package autoreconfigurable + +Adjust a minor detail in configure.ac in order to make the package +compatible with the autoconf/automake versions we are using in +Buildroot. + +Signed-off-by: Benoît Thébaudeau + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -1,6 +1,6 @@ + AC_INIT([logrotate],[3.8.9]) + +-AM_INIT_AUTOMAKE ++AM_INIT_AUTOMAKE([foreign]) + AC_DEFINE(_GNU_SOURCE) + + AM_EXTRA_RECURSIVE_TARGETS([test]) diff --git a/package/lshw/0001-add-LIBS.patch b/package/lshw/0001-add-LIBS.patch new file mode 100644 index 0000000000..70b2a5b68f --- /dev/null +++ b/package/lshw/0001-add-LIBS.patch @@ -0,0 +1,30 @@ +We need to be able to pass extra LIBS when our toolchain lacks NLS support, +this way we can build libintl and link to it. +A good example is uClibc with locale support disabled. + +Signed-off-by: Gustavo Zacarias + +diff -Nura lshw-B.02.16.orig/src/gui/Makefile lshw-B.02.16/src/gui/Makefile +--- lshw-B.02.16.orig/src/gui/Makefile 2012-05-28 12:32:49.303885759 -0300 ++++ lshw-B.02.16/src/gui/Makefile 2012-05-28 12:33:33.850206001 -0300 +@@ -11,7 +11,7 @@ + CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) + CFLAGS=$(CXXFLAGS) $(DEFINES) + GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs) +-LIBS=-L../core -llshw -lresolv -lsqlite3 $(GTKLIBS) ++LIBS+=-L../core -llshw -lresolv -lsqlite3 $(GTKLIBS) + LDFLAGS= + ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) + LDFLAGS+= -Wl,--as-needed +diff -Nura lshw-B.02.16.orig/src/Makefile lshw-B.02.16/src/Makefile +--- lshw-B.02.16.orig/src/Makefile 2012-05-28 12:32:49.292885680 -0300 ++++ lshw-B.02.16/src/Makefile 2012-05-28 12:33:24.530139060 -0300 +@@ -30,7 +30,7 @@ + LDFLAGS+= -Wl,--as-needed + endif + LDSTATIC=-static +-LIBS=-llshw -lresolv ++LIBS+=-llshw -lresolv + ifeq ($(SQLITE), 1) + LIBS+= $(shell pkg-config --libs sqlite3) + endif diff --git a/package/ltp-testsuite/0001-fix-uClibc-build.patch b/package/ltp-testsuite/0001-fix-uClibc-build.patch new file mode 100644 index 0000000000..231bc83324 --- /dev/null +++ b/package/ltp-testsuite/0001-fix-uClibc-build.patch @@ -0,0 +1,51 @@ +O_DIRECTORY is only available if _GNU_SOURCE is defined + +https://github.com/linux-test-project/ltp/pull/58 + +Signed-off-by: Waldemar Brodkorb + +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify01.c ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify01.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify01.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify01.c 2016-03-05 00:55:02.977264913 +0100 +@@ -25,6 +25,7 @@ + * DESCRIPTION + * Check that fanotify work for a file + */ ++#define _GNU_SOURCE + #include "config.h" + + #include +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify02.c ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify02.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify02.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify02.c 2016-03-05 00:54:44.600558612 +0100 +@@ -25,6 +25,7 @@ + * DESCRIPTION + * Check that fanotify work for children of a directory + */ ++#define _GNU_SOURCE + #include "config.h" + + #include +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify03.c ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify03.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify03.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify03.c 2016-03-05 00:55:13.917685403 +0100 +@@ -25,6 +25,7 @@ + * DESCRIPTION + * Check that fanotify permission events work + */ ++#define _GNU_SOURCE + #include "config.h" + + #include +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify04.c ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify04.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/fanotify/fanotify04.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/fanotify/fanotify04.c 2016-03-05 00:55:24.530093286 +0100 +@@ -25,6 +25,8 @@ + * DESCRIPTION + * Check various fanotify special flags + */ ++ ++#define _GNU_SOURCE + #include "config.h" + + #include diff --git a/package/ltp-testsuite/0002-rpc-tirpc-disable-tirpc_auth_authdes_seccreate-tests.patch b/package/ltp-testsuite/0002-rpc-tirpc-disable-tirpc_auth_authdes_seccreate-tests.patch new file mode 100644 index 0000000000..f69b364efe --- /dev/null +++ b/package/ltp-testsuite/0002-rpc-tirpc-disable-tirpc_auth_authdes_seccreate-tests.patch @@ -0,0 +1,31 @@ +rpc-tirpc: disable tirpc_auth_authdes_*create tests + +Due to Buildroot patch 0007-Disable-DES-authentification-support.patch on +libtirpc, this library is built without method authdes_create. Any code +that uses this library, like the rpc-tirpc testsuite, thus fails to link. + +In the context of Buildroot, instead of disabling ltp-testsuite entirely, +just disable the problematic tests. + +Upstream-status: not applicable +Signed-off-by: Thomas De Schampheleire +--- + testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/Makefile +index 45bc8a6..c04a088 100644 +--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/Makefile ++++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/Makefile +@@ -19,4 +19,8 @@ + top_srcdir ?= ../../../../../../.. + + include $(top_srcdir)/include/mk/env_pre.mk ++ ++FILTER_OUT_DIRS += tirpc_auth_authdes_seccreate \ ++ tirpc_auth_authdes_create ++ + include $(top_srcdir)/include/mk/generic_trunk_target.mk +-- +1.9.5 + diff --git a/package/ltp-testsuite/0003-disable-profil-on-uClibc.patch b/package/ltp-testsuite/0003-disable-profil-on-uClibc.patch new file mode 100644 index 0000000000..d33b6771a7 --- /dev/null +++ b/package/ltp-testsuite/0003-disable-profil-on-uClibc.patch @@ -0,0 +1,27 @@ +uClibc-ng has no profil() support + +Signed-off-by: Waldemar Brodkorb + +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/profil/profil01.c ltp-full-20160126/testcases/kernel/syscalls/profil/profil01.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/profil/profil01.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/profil/profil01.c 2016-03-05 01:00:07.328962536 +0100 +@@ -37,6 +37,9 @@ + #define PROFIL_BUFLEN (32*1024) + + char *TCID = "profil01"; ++ ++#if !defined(__UCLIBC__) ++ + int TST_TOTAL = 1; + + static volatile sig_atomic_t profil_done; +@@ -124,3 +127,9 @@ + + tst_exit(); + } ++#else /* systems that dont support profil */ ++int main(void) ++{ ++ tst_brkm(TCONF, NULL, "system doesn't have profil support"); ++} ++#endif diff --git a/package/ltp-testsuite/0004-disable-ustat-on-uClibc.patch b/package/ltp-testsuite/0004-disable-ustat-on-uClibc.patch new file mode 100644 index 0000000000..7a1f017169 --- /dev/null +++ b/package/ltp-testsuite/0004-disable-ustat-on-uClibc.patch @@ -0,0 +1,70 @@ +uClibc-ng need __UCLIBC_SV4_DEPRECATED__ enabled for ustat + +Signed-off-by: Waldemar Brodkorb + +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/ustat/ustat01.c ltp-full-20160126/testcases/kernel/syscalls/ustat/ustat01.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/ustat/ustat01.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/ustat/ustat01.c 2016-03-05 01:15:39.492789841 +0100 +@@ -20,7 +20,9 @@ + */ + + #include ++#if !defined(__UCLIBC__) || defined(__UCLIBC_SV4_DEPRECATED__) + #include ++#endif + #include + #include + #include +@@ -30,6 +32,9 @@ + static void setup(void); + + char *TCID = "ustat01"; ++ ++#if !defined(__UCLIBC__) || defined(__UCLIBC_SV4_DEPRECATED__) ++ + int TST_TOTAL = 1; + + static dev_t dev_num; +@@ -79,3 +84,10 @@ + + dev_num = buf.st_dev; + } ++#else /* systems that dont support ustat */ ++int main(void) ++{ ++ tst_brkm(TCONF, NULL, "system doesn't have ustat support"); ++} ++#endif ++ +diff -Nur ltp-full-20160126.orig/testcases/kernel/syscalls/ustat/ustat02.c ltp-full-20160126/testcases/kernel/syscalls/ustat/ustat02.c +--- ltp-full-20160126.orig/testcases/kernel/syscalls/ustat/ustat02.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/kernel/syscalls/ustat/ustat02.c 2016-03-05 01:15:55.677411889 +0100 +@@ -21,7 +21,9 @@ + */ + + #include ++#if !defined(__UCLIBC__) || defined(__UCLIBC_SV4_DEPRECATED__) + #include ++#endif + #include + #include + #include +@@ -32,6 +34,8 @@ + + char *TCID = "ustat02"; + ++#if !defined(__UCLIBC__) || defined(__UCLIBC_SV4_DEPRECATED__) ++ + static dev_t invalid_dev = -1; + static dev_t root_dev; + struct ustat ubuf; +@@ -101,3 +105,9 @@ + + root_dev = buf.st_dev; + } ++#else /* systems that dont support ustat */ ++int main(void) ++{ ++ tst_brkm(TCONF, NULL, "system doesn't have ustat support"); ++} ++#endif diff --git a/package/ltp-testsuite/0005-rpc-fix-uClibc.patch b/package/ltp-testsuite/0005-rpc-fix-uClibc.patch new file mode 100644 index 0000000000..1d9152b061 --- /dev/null +++ b/package/ltp-testsuite/0005-rpc-fix-uClibc.patch @@ -0,0 +1,125 @@ +rusers.h is unused and not available for uClibc-ng / libtirpc + +Signed-off-by: Waldemar Brodkorb + +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_auth_destroy/rpc_auth_destroy.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_auth_destroy/rpc_auth_destroy.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_auth_destroy/rpc_auth_destroy.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_auth_destroy/rpc_auth_destroy.c 2016-03-05 02:16:56.274105305 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authnone_create/rpc_authnone_create.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authnone_create/rpc_authnone_create.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authnone_create/rpc_authnone_create.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authnone_create/rpc_authnone_create.c 2016-03-05 02:16:32.641196984 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create/rpc_authunix_create.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create/rpc_authunix_create.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create/rpc_authunix_create.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create/rpc_authunix_create.c 2016-03-05 02:21:09.831850681 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create_default/rpc_authunix_create_default.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create_default/rpc_authunix_create_default.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create_default/rpc_authunix_create_default.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_auth_authunix_create_default/rpc_authunix_create_default.c 2016-03-05 02:18:57.370759601 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c 2016-03-05 02:23:32.113319210 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c 2016-03-05 02:23:39.221592413 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c 2016-03-05 02:23:48.565951560 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c 2016-03-05 02:23:56.706264429 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c 2016-03-05 02:24:03.818537786 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c 2016-03-05 02:24:10.518795308 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -Nur ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c +--- ltp-full-20160126.orig/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c 2016-01-26 13:35:25.000000000 +0100 ++++ ltp-full-20160126/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c 2016-03-05 02:24:20.095163371 +0100 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include diff --git a/package/lttng-babeltrace/0001-no-posix-fallocate-in-uclibc.patch b/package/lttng-babeltrace/0001-no-posix-fallocate-in-uclibc.patch new file mode 100644 index 0000000000..d77825fab6 --- /dev/null +++ b/package/lttng-babeltrace/0001-no-posix-fallocate-in-uclibc.patch @@ -0,0 +1,37 @@ +Do not call posix_fallocate() on uClibc + +uClibc does not implement posix_fallocate(), and posix_fallocate() is +mostly only an hint to the kernel that we will need such or such +amount of space inside a file. So we just don't call posix_fallocate() +when building against uClibc. + +Signed-off-by: Thomas Petazzoni +[Peter: add #include +--- + formats/ctf/ctf.c | 3 +++ + 1 file changed, 3 insertions(+) + +Index: lttng-babeltrace-0.8/formats/ctf/ctf.c +=================================================================== +--- lttng-babeltrace-0.8.orig/formats/ctf/ctf.c ++++ lttng-babeltrace-0.8/formats/ctf/ctf.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -384,9 +385,11 @@ + } + pos->content_size = -1U; /* Unknown at this point */ + pos->packet_size = WRITE_PACKET_LEN; ++#ifndef __UCLIBC__ + off = posix_fallocate(pos->fd, pos->mmap_offset, + pos->packet_size / CHAR_BIT); + assert(off >= 0); ++#endif + pos->offset = 0; + } else { + read_next_packet: diff --git a/package/lttng-babeltrace/0002-configure-fix-uuid-support-detection-on-static-build.patch b/package/lttng-babeltrace/0002-configure-fix-uuid-support-detection-on-static-build.patch new file mode 100644 index 0000000000..849c0a3d26 --- /dev/null +++ b/package/lttng-babeltrace/0002-configure-fix-uuid-support-detection-on-static-build.patch @@ -0,0 +1,63 @@ +From 670d0961a823df0db28f39a354430f3dc2519418 Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Sat, 28 May 2016 12:53:33 +0200 +Subject: [PATCH] configure: fix uuid support detection on static build + +This change adds uuid support detection using pkg-config, before falling +back on default AC_CHECK_LIB calls. + +Using flags from pkg-config is useful for static build, because they +also include dependency flags; whereas + +AC_CHECK_LIB function achieves its test by trying to link against the +requested library, without taking care of its dependency +requirements/flags. Therefore, in case of static build, it can fail on +the uuid detection like [1], because the uuid's dependency flags +(regarding gettext) are missing. +Instead, using pkg-config to do the check will take care of getting and +setting all required flags. + +This change adds uuid detection using pkg-config helper before falling +back on the standard AC_CHECK_LIB detection for platforms missing +pkg-config. + +This issue [1] has been triggered on Buildroot farms. + +[1] http://autobuild.buildroot.net/results/43b/43b98ddf9eb44152ed9ac4a98d887af14831d8da/build-end.log + +Signed-off-by: Samuel Martin +--- + configure.ac | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 632fe39..b344fa8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -65,6 +65,15 @@ esac + AM_CONDITIONAL([BABELTRACE_BUILD_WITH_MINGW], [test "x$MINGW32" = "xyes"]) + + # Check for libuuid ++PKG_CHECK_MODULES([UUID], [uuid], ++[ ++ LIBS="${UUID_LIBS} ${LIBS}" ++ CFLAGS="${CFLAGS} ${UUID_CFLAGS}" ++ AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) ++ have_libuuid=yes ++], ++[ ++# try detecting libuuid without pkg-config + AC_CHECK_LIB([uuid], [uuid_generate], + [ + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) +@@ -83,6 +92,7 @@ AC_CHECK_LIB([uuid], [uuid_generate], + AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.]) + fi + ]) ++]) + ] + ) + AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"]) +-- +2.8.3 + diff --git a/package/lttng-tools/0001-Fix-build-failure-when-__GLIBC_PREREQ-is-missing.patch b/package/lttng-tools/0001-Fix-build-failure-when-__GLIBC_PREREQ-is-missing.patch new file mode 100644 index 0000000000..2c01dea6ae --- /dev/null +++ b/package/lttng-tools/0001-Fix-build-failure-when-__GLIBC_PREREQ-is-missing.patch @@ -0,0 +1,55 @@ +From: Baruch Siach +Date: Tue, 8 Mar 2016 14:25:34 +0200 +Subject: [PATCH] Fix: build failure when __GLIBC_PREREQ is missing + +The musl C library does not provide the __GLIBC_PREREQ macro. Instead of +relying on glibc version test, check directly for the availability of +epoll_create1(). + +Signed-off-by: Baruch Siach +--- +Patch status: sent upstream rebased on master branch +(http://lists.lttng.org/pipermail/lttng-dev/2016-March/025593.html) + + configure.ac | 2 +- + src/common/compat/poll.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 66d83b60b017..4fc1160c9a08 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -70,7 +70,7 @@ AC_CHECK_FUNCS([ \ + gethostbyname gethostname getpagesize localtime_r memchr memset \ + mkdir munmap putenv realpath rmdir socket strchr strcspn strdup \ + strncasecmp strndup strpbrk strrchr strstr strtol strtoul \ +- strtoull \ ++ strtoull epoll_create1 \ + ]) + + # Babeltrace viewer check +diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h +index 699901848dc1..84f25d5c85aa 100644 +--- a/src/common/compat/poll.h ++++ b/src/common/compat/poll.h +@@ -73,7 +73,7 @@ enum { + LPOLLNVAL = EPOLLHUP, + LPOLLRDHUP = EPOLLRDHUP, + /* Close on exec feature of epoll */ +-#if __GLIBC_PREREQ(2, 9) ++#if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC) + LTTNG_CLOEXEC = EPOLL_CLOEXEC, + #else + /* +@@ -127,7 +127,7 @@ extern int compat_epoll_create(struct lttng_poll_event *events, + #define lttng_poll_create(events, size, flags) \ + compat_epoll_create(events, size, flags) + +-#if __GLIBC_PREREQ(2, 9) ++#if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC) + static inline int compat_glibc_epoll_create(int size __attribute__((unused)), + int flags) + { +-- +2.7.0 + diff --git a/package/lttng-tools/0002-Fix-add-missing-sys-types.h-header.patch b/package/lttng-tools/0002-Fix-add-missing-sys-types.h-header.patch new file mode 100644 index 0000000000..5ce2da52dc --- /dev/null +++ b/package/lttng-tools/0002-Fix-add-missing-sys-types.h-header.patch @@ -0,0 +1,29 @@ +From: Baruch Siach +Date: Tue, 8 Mar 2016 14:40:49 +0200 +Subject: [PATCH] Fix: add missing sys/types.h header + +The musl C library requires inclusion of sys/types.h for mode_t. + +Signed-off-by: Baruch Siach +--- +Patch status: sent upstream +(http://lists.lttng.org/pipermail/lttng-dev/2016-March/025594.html) + + src/common/runas.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/common/runas.h b/src/common/runas.h +index 2c5565af3646..ac1143eecf84 100644 +--- a/src/common/runas.h ++++ b/src/common/runas.h +@@ -19,6 +19,7 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + ++#include + #include + #include + +-- +2.7.0 + diff --git a/package/lua/5.3.2/0001-root-path.patch b/package/lua/5.3.2/0001-root-path.patch new file mode 100644 index 0000000000..d8ef8d070d --- /dev/null +++ b/package/lua/5.3.2/0001-root-path.patch @@ -0,0 +1,17 @@ +Adjust installation location to /usr. + +Signed-off-by: Francois Perrad + +Index: b/src/luaconf.h +=================================================================== +--- a/src/luaconf.h ++++ b/src/luaconf.h +@@ -188,7 +188,7 @@ + + #else /* }{ */ + +-#define LUA_ROOT "/usr/local/" ++#define LUA_ROOT "/usr/" + #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" + #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" + #define LUA_PATH_DEFAULT \ diff --git a/package/lua/5.3.2/0002-shared-libs-for-lua.patch b/package/lua/5.3.2/0002-shared-libs-for-lua.patch new file mode 100644 index 0000000000..493828c9da --- /dev/null +++ b/package/lua/5.3.2/0002-shared-libs-for-lua.patch @@ -0,0 +1,78 @@ +Add the compilation of a shared library. +Compile the lua binary with the shared library. +And install the shared library. +The variable BUILDMODE allows to switch between static and dynamic mode. + +Signed-off-by: Francois Perrad + +Index: b/Makefile +=================================================================== +--- a/Makefile ++++ b/Makefile +@@ -42,6 +42,7 @@ + TO_BIN= lua luac + TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp + TO_LIB= liblua.a ++TO_SOLIB = liblua.so.$(R) + TO_MAN= lua.1 luac.1 + + # Lua version and release. +@@ -60,6 +61,8 @@ + install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) + cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) ++ test -f src/$(TO_SOLIB) && cd src && $(INSTALL_EXEC) $(TO_SOLIB) $(INSTALL_LIB) || : ++ test -f src/$(TO_SOLIB) && ln -sf $(TO_SOLIB) $(INSTALL_LIB)/liblua.so || : + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) +Index: b/src/Makefile +=================================================================== +--- a/src/Makefile ++++ b/src/Makefile +@@ -29,6 +29,7 @@ + PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris + + LUA_A= liblua.a ++LUA_SO= liblua.so + CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ + lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ + ltm.o lundump.o lvm.o lzio.o +@@ -43,8 +44,13 @@ + LUAC_O= luac.o + + ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) ++ifneq (dynamic,$(BUILDMODE)) + ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) ++else ++ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T) ++endif + ALL_A= $(LUA_A) ++ALL_SO= $(LUA_SO) + + # Targets start here. + default: $(PLAT) +@@ -55,12 +61,23 @@ + + a: $(ALL_A) + ++so: $(ALL_SO) ++ + $(LUA_A): $(BASE_O) + $(AR) $@ $(BASE_O) + $(RANLIB) $@ + ++$(LUA_SO): $(CORE_O) $(LIB_O) ++ $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? ++ ln -fs $@.$(PKG_VERSION) $@ ++ ++ifneq (dynamic,$(BUILDMODE)) + $(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) ++else ++$(LUA_T): $(LUA_O) $(LUA_SO) ++ $(CC) -o $@ -L. $(LDFLAGS) $(LUA_O) -llua $(LIBS) ++endif + + $(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) diff --git a/package/lua/5.3.2/0004-lua-pc.patch b/package/lua/5.3.2/0004-lua-pc.patch new file mode 100644 index 0000000000..811d9313b4 --- /dev/null +++ b/package/lua/5.3.2/0004-lua-pc.patch @@ -0,0 +1,40 @@ +add lua.pc + +Signed-off-by: Francois Perrad + +Index: b/etc/lua.pc +=================================================================== +--- /dev/null ++++ b/etc/lua.pc +@@ -0,0 +1,31 @@ ++# lua.pc -- pkg-config data for Lua ++ ++# vars from install Makefile ++ ++# grep '^V=' ../Makefile ++V= 5.3 ++# grep '^R=' ../Makefile ++R= 5.3.2 ++ ++# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' ++prefix= /usr ++INSTALL_BIN= ${prefix}/bin ++INSTALL_INC= ${prefix}/include ++INSTALL_LIB= ${prefix}/lib ++INSTALL_MAN= ${prefix}/man/man1 ++INSTALL_LMOD= ${prefix}/share/lua/${V} ++INSTALL_CMOD= ${prefix}/lib/lua/${V} ++ ++# canonical vars ++exec_prefix=${prefix} ++libdir=${exec_prefix}/lib ++includedir=${prefix}/include ++ ++Name: Lua ++Description: An Extensible Extension Language ++Version: ${R} ++Requires: ++Libs: -L${libdir} -llua -lm ++Cflags: -I${includedir} ++ ++# (end of lua.pc) diff --git a/package/lua/5.3.2/0011-linenoise.patch b/package/lua/5.3.2/0011-linenoise.patch new file mode 100644 index 0000000000..f3ced2b22e --- /dev/null +++ b/package/lua/5.3.2/0011-linenoise.patch @@ -0,0 +1,24 @@ +Add support of linenoise (replace readline) + +see discussion, http://lua-users.org/lists/lua-l/2010-03/msg00879.html + +Signed-off-by: Francois Perrad + +Index: b/src/lua.c +=================================================================== +--- a/src/lua.c ++++ b/src/lua.c +@@ -83,6 +83,13 @@ + #define lua_saveline(L,line) ((void)L, add_history(line)) + #define lua_freeline(L,b) ((void)L, free(b)) + ++#elif defined(LUA_USE_LINENOISE) ++ ++#include ++#define lua_readline(L,b,p) ((void)L, ((b)=linenoise(p)) != NULL) ++#define lua_saveline(L,line) ((void)L, linenoiseHistoryAdd(line)) ++#define lua_freeline(L,b) ((void)L, free(b)) ++ + #else /* }{ */ + + #define lua_readline(L,b,p) \ diff --git a/package/lxc/0001-drop-werror.patch b/package/lxc/0001-drop-werror.patch new file mode 100644 index 0000000000..d2a8673a86 --- /dev/null +++ b/package/lxc/0001-drop-werror.patch @@ -0,0 +1,16 @@ +Don't do -Werror it breaks builds on some scenarios with trivialities. + +Signed-off-by: Gustavo Zacarias + +diff -Nura lxc-lxc-1.0.4/configure.ac lxc-lxc-1.0.4.orig/configure.ac +--- lxc-lxc-1.0.4.orig/configure.ac 2014-07-04 10:31:19.821029891 -0300 ++++ lxc-lxc-1.0.4/configure.ac 2014-06-13 14:07:45.000000000 -0300 +@@ -560,7 +560,7 @@ + LXC_CHECK_TLS + + if test "x$GCC" = "xyes"; then +- CFLAGS="$CFLAGS -Wall -Werror" ++ CFLAGS="$CFLAGS -Wall" + fi + + # Files requiring some variable expansion diff --git a/package/lxc/0002-Fix-redefinition-of-struct-in6_addr.patch b/package/lxc/0002-Fix-redefinition-of-struct-in6_addr.patch new file mode 100644 index 0000000000..b48ece38f6 --- /dev/null +++ b/package/lxc/0002-Fix-redefinition-of-struct-in6_addr.patch @@ -0,0 +1,43 @@ +From 245bba9aadf8e7aea487b6fbd851f86c75524552 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Thu, 19 May 2016 21:51:27 +0200 +Subject: [PATCH] Fix redefinition of struct in6_addr +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +struct in6_addr is both defined in the C library header +and the Linux kernel header . + +lxc_user_nic.c includes both and . The +later one includes . + +This breaks build with the musl libc: + error: redefinition of ‘struct in6_addr’ + +As lxc_user_nic.c does not use any references from it +is safe to remove this header. + +Upstream status: Pending +https://github.com/lxc/lxc/pull/1029 + +Signed-off-by: Jörg Krause +--- + src/lxc/lxc_user_nic.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c +index 87780ca..0cb38ba 100644 +--- a/src/lxc/lxc_user_nic.c ++++ b/src/lxc/lxc_user_nic.c +@@ -41,7 +41,6 @@ + #include + #include + #include +-#include + #include + #include + #include +-- +2.8.2 + diff --git a/package/makedevs/Config.in b/package/makedevs/Config.in new file mode 100644 index 0000000000..923150dd6d --- /dev/null +++ b/package/makedevs/Config.in @@ -0,0 +1,5 @@ +config BR2_PACKAGE_MAKEDEVS + bool "makedevs" + help + The makedevs utility allows to create a set of device files + according to a configuration file. diff --git a/package/memcached/0001-fix-build-with-musl-libc.patch b/package/memcached/0001-fix-build-with-musl-libc.patch new file mode 100644 index 0000000000..068382051c --- /dev/null +++ b/package/memcached/0001-fix-build-with-musl-libc.patch @@ -0,0 +1,78 @@ +From 2137a608c77c467200d73469f723ba97ff6b3511 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Mon, 18 Jan 2016 12:11:48 +0100 +Subject: [PATCH] fix build with musl libc + +musl libc will warn if you include sys/signal.h instead of signal.h as +specified by posix. Build will fail due to -Werror explicitly beeing +set. + +Fix it by use the posix location. + +fixes #138 + +Signed-off-by: Baruch Siach +--- +Patch status: pending (https://github.com/memcached/memcached/pull/139) + + assoc.c | 2 +- + items.c | 2 +- + slabs.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/assoc.c b/assoc.c +index e6cf09b64e8c..9fff38fe01d6 100644 +--- a/assoc.c ++++ b/assoc.c +@@ -14,8 +14,8 @@ + #include "memcached.h" + #include + #include +-#include + #include ++#include + #include + #include + #include +diff --git a/items.c b/items.c +index 199dc9fa6e6b..7040777ab0fb 100644 +--- a/items.c ++++ b/items.c +@@ -2,13 +2,13 @@ + #include "memcached.h" + #include + #include +-#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +diff --git a/slabs.c b/slabs.c +index 31e85f6ec21d..bfafe5d0fdde 100644 +--- a/slabs.c ++++ b/slabs.c +@@ -10,7 +10,6 @@ + #include "memcached.h" + #include + #include +-#include + #include + #include + #include +@@ -18,6 +17,7 @@ + #include + #include + #include ++#include + #include + #include + +-- +2.8.0.rc3 + diff --git a/package/mono/0005-eglib-checking-for-locale_charset-function.patch b/package/mono/0005-eglib-checking-for-locale_charset-function.patch new file mode 100644 index 0000000000..52d5638451 --- /dev/null +++ b/package/mono/0005-eglib-checking-for-locale_charset-function.patch @@ -0,0 +1,28 @@ +From 026a8c44d332b3595814ce0aceba255467cd7b6d Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci +Date: Sat, 5 Sep 2015 08:57:21 +0200 +Subject: [PATCH] eglib: checking for locale_charset function + +This patch checks if locale_charset function is availabe in +libiconv or libcharset and changes the linking options accordingly. + +Signed-off-by: Angelo Compagnucci +--- + eglib/configure.ac | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/eglib/configure.ac b/eglib/configure.ac +index 9d094ea..5ea220e 100644 +--- a/eglib/configure.ac ++++ b/eglib/configure.ac +@@ -182,6 +182,7 @@ fi + AC_SUBST(G_HAVE_ISO_VARARGS) + + AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h) ++AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])]) + AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0]) + AC_SUBST(HAVE_ALLOCA_H) + +-- +1.9.1 + diff --git a/package/mono/0007-config.in-fixing-wrong-MonoPosixHelper-location.patch b/package/mono/0007-config.in-fixing-wrong-MonoPosixHelper-location.patch new file mode 100644 index 0000000000..6ebb802adf --- /dev/null +++ b/package/mono/0007-config.in-fixing-wrong-MonoPosixHelper-location.patch @@ -0,0 +1,28 @@ +From 76aa4fb62a433e61dc35eefcc3077f0463182d2f Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci +Date: Tue, 23 Feb 2016 22:43:39 +0100 +Subject: [PATCH] config.in: fixing wrong MonoPosixHelper location + +This patch remove a wrong prefix for libMonoPosixHelper + +Signed-off-by: Angelo Compagnucci +--- + data/config.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/config.in b/data/config.in +index b760176..41495b9 100644 +--- a/data/config.in ++++ b/data/config.in +@@ -10,7 +10,7 @@ + + + +- ++ + + + +-- +1.9.1 + diff --git a/package/mpd/0002-thread-Name-include-stdio.h-for-prctl-as-well.patch b/package/mpd/0002-thread-Name-include-stdio.h-for-prctl-as-well.patch new file mode 100644 index 0000000000..1943623edb --- /dev/null +++ b/package/mpd/0002-thread-Name-include-stdio.h-for-prctl-as-well.patch @@ -0,0 +1,28 @@ +From a0a9fed68126eb24e04af924c0d46351ff5eeb0f Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Mon, 26 Jan 2015 09:55:04 -0300 +Subject: [PATCH] thread/Name: include stdio.h for prctl as well + +We're still using snprintf so we need it, otherwise it leads to build +failure. + +Signed-off-by: Gustavo Zacarias +--- + src/thread/Name.hxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/thread/Name.hxx b/src/thread/Name.hxx +index a99208d..8f9d7d3 100644 +--- a/src/thread/Name.hxx ++++ b/src/thread/Name.hxx +@@ -25,6 +25,7 @@ + # include + #elif defined(HAVE_PRCTL) + # include ++# include + # ifdef PR_SET_NAME + # define HAVE_THREAD_NAME + # endif +-- +2.6.4 + diff --git a/package/mpg123/0001-Makefile.am-don-t-override-LIBS.patch b/package/mpg123/0001-Makefile.am-don-t-override-LIBS.patch new file mode 100644 index 0000000000..a5bfe80094 --- /dev/null +++ b/package/mpg123/0001-Makefile.am-don-t-override-LIBS.patch @@ -0,0 +1,46 @@ +From 25c2e71c9ce762561eeacd35bf432c6692c0fb44 Mon Sep 17 00:00:00 2001 +From: Peter Korsgaard +Date: Tue, 24 May 2016 17:34:32 +0200 +Subject: [PATCH] Makefile.am: don't override LIBS + +Patch status: posted upstream +https://sourceforge.net/p/mpg123/mailman/message/35111696/ + +The recent build system change broke custom LIBS handling. As opposed to the +other internal variables, LIBS can be provided by the user when running +configure, E.G.: + +LIBS="-lfoo -lbar" ./configure .. + +This is correctly used by the configure checks, but doesn't end up in the +Makefile any more because of this override - Breaking static builds where +the configure script needs a bit of help to link with -lpthread when +alsa/portaudio is used (as those use pthreads internally). + +Fixes the following build issues from the Buildroot autobuilders: + +http://autobuild.buildroot.net/?reason=mpg123-1.23.3 + +(see https://git.buildroot.net/buildroot/tree/package/mpg123/mpg123.mk for +the build logic) + +Signed-off-by: Peter Korsgaard +--- + Makefile.am | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index d695a3b..863f59f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -9,7 +9,6 @@ + ACLOCAL_AMFLAGS = -I m4 + bin_PROGRAMS = + EXTRA_PROGRAMS = +-LIBS = + EXTRA_DIST = + pkglib_LTLIBRARIES = + lib_LTLIBRARIES = +-- +2.7.0 + diff --git a/package/mysql/0000-ac_cache_check.patch b/package/mysql/0000-ac_cache_check.patch new file mode 100644 index 0000000000..c3b55ba8d3 --- /dev/null +++ b/package/mysql/0000-ac_cache_check.patch @@ -0,0 +1,156 @@ +Patch borrowed from +http://code.google.com/p/minimyth/source/browse/trunk/gar-minimyth/script/db/mysql/files/mysql-5.1.47-ac_cache_check.patch?r=6493. + +It allows to override through ac_cv_* variables various checks that +cannot be performed when cross-compiling. + +Signed-off-by: Thomas Petazzoni + +--- + storage/innodb_plugin/plug.in | 59 ++++++++++++++++++++++++++++-------------- + 1 file changed, 40 insertions(+), 19 deletions(-) + +Index: mysql-5.1.53/storage/innodb_plugin/plug.in +=================================================================== +--- mysql-5.1.53.orig/storage/innodb_plugin/plug.in ++++ mysql-5.1.53/storage/innodb_plugin/plug.in +@@ -53,9 +53,10 @@ + esac + AC_SUBST(INNODB_DYNAMIC_CFLAGS) + +- AC_MSG_CHECKING(whether GCC atomic builtins are available) ++ AC_CACHE_CHECK([whether GCC atomic builtins are available], ++ [ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS], + # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not +- AC_TRY_RUN( ++ [AC_TRY_RUN( + [ + int main() + { +@@ -95,18 +96,23 @@ + } + ], + [ +- AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1], +- [GCC atomic builtins are available]) + AC_MSG_RESULT(yes) ++ ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS=yes + ], + [ + AC_MSG_RESULT(no) ++ ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS=no + ] +- ) ++ )]) ++ if test "x$ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS"= "xyes" ; then ++ AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1], ++ [GCC atomic builtins are available]) ++ fi + +- AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins) ++ AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins], ++ [ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC], + # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not +- AC_TRY_RUN( ++ [AC_TRY_RUN( + [ + #include + #include +@@ -126,14 +132,18 @@ + } + ], + [ +- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1], +- [pthread_t can be used by GCC atomic builtins]) + AC_MSG_RESULT(yes) ++ ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC=yes + ], + [ + AC_MSG_RESULT(no) ++ ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC=no + ] +- ) ++ )]) ++ if test "x$ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC"= "xyes" ; then ++ AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1], ++ [pthread_t can be used by GCC atomic builtins]) ++ fi + + AC_MSG_CHECKING(whether Solaris libc atomic functions are available) + # either define HAVE_IB_SOLARIS_ATOMICS or not +@@ -148,9 +158,10 @@ + are available]) + ) + +- AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions) ++ AC_CACHE_CHECK([whether pthread_t can be used by Solaris libc atomic functions], ++ [ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], + # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not +- AC_TRY_RUN( ++ [AC_TRY_RUN( + [ + #include + #include +@@ -181,28 +192,33 @@ + } + ], + [ +- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1], +- [pthread_t can be used by solaris atomics]) + AC_MSG_RESULT(yes) ++ ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS=yes + ], + [ + AC_MSG_RESULT(no) ++ ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS=no + ] +- ) ++ )]) ++ if test "x$ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS"= "xyes" ; then ++ AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1], ++ [pthread_t can be used by solaris atomics]) ++ fi + + # this is needed to know which one of atomic_cas_32() or atomic_cas_64() + # to use in the source + AC_CHECK_SIZEOF([pthread_t], [], [#include ]) + + # Check for x86 PAUSE instruction +- AC_MSG_CHECKING(for x86 PAUSE instruction) ++ AC_CACHE_CHECK([for x86 PAUSE instruction], ++ [ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION], + # We have to actually try running the test program, because of a bug + # in Solaris on x86_64, where it wrongly reports that PAUSE is not + # supported when trying to run an application. See + # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684 + # We use ib_ prefix to avoid collisoins if this code is added to + # mysql's configure.in. +- AC_TRY_RUN( ++ [AC_TRY_RUN( + [ + int main() { + __asm__ __volatile__ ("pause"); +@@ -210,16 +226,21 @@ + } + ], + [ +- AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist]) + AC_MSG_RESULT(yes) ++ ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION=yes + ], + [ + AC_MSG_RESULT(no) ++ ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION=no + ], + [ + AC_MSG_RESULT(no) ++ ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION=no + ] +- ) ++ )]) ++ if test "x$ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION"= "xyes" ; then ++ AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist]) ++ fi + ]) + + # vim: set ft=config: diff --git a/package/mysql/0001-configure-ps-cache-check.patch b/package/mysql/0001-configure-ps-cache-check.patch new file mode 100644 index 0000000000..336e80e0b7 --- /dev/null +++ b/package/mysql/0001-configure-ps-cache-check.patch @@ -0,0 +1,39 @@ +Patch borrowed from +http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/mysql/files/configure-ps-cache-check.patch + +It allows to specify through ac_cv_FIND_PROC how ps should be used on +the target to find the PID of a program. + +Signed-off-by: Thomas Petazzoni + +--- + configure.in | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +Index: mysql-5.1.53/configure.in +=================================================================== +--- mysql-5.1.53.orig/configure.in ++++ mysql-5.1.53/configure.in +@@ -462,8 +462,8 @@ + # then Make, then shell. The autoconf substitution uses single quotes, so + # no unprotected single quotes should appear in the expression. + AC_PATH_PROG(PS, ps, ps) +-AC_MSG_CHECKING("how to check if pid exists") +-PS=$ac_cv_path_PS ++AC_CACHE_CHECK([how to check if pid exists], [ac_cv_FIND_PROC], ++[ + # Linux style + if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null + then +@@ -502,8 +502,9 @@ + AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.]) + esac + fi +-AC_SUBST(FIND_PROC) +-AC_MSG_RESULT("$FIND_PROC") ++ac_cv_FIND_PROC="$FIND_PROC" ++]) ++AC_SUBST([FIND_PROC], [$ac_cv_FIND_PROC]) + + # Check if a pid is valid + AC_PATH_PROG(KILL, kill, kill) diff --git a/package/mysql/0002-use-new-readline-iface.patch b/package/mysql/0002-use-new-readline-iface.patch new file mode 100644 index 0000000000..c5906563ce --- /dev/null +++ b/package/mysql/0002-use-new-readline-iface.patch @@ -0,0 +1,21 @@ +Tell MySQL to use the new readline interface even when an external +readline is being used. + +Signed-off-by: Thomas Petazzoni + +--- + configure.in | 1 + + 1 file changed, 1 insertion(+) + +Index: mysql-5.1.53/configure.in +=================================================================== +--- mysql-5.1.53.orig/configure.in ++++ mysql-5.1.53/configure.in +@@ -2689,6 +2689,7 @@ + # this way we avoid linking commercial source with GPL readline + readline_link="-lreadline" + want_to_use_readline="yes" ++ AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) + elif [test "$mysql_cv_libedit_interface" = "yes"] + then + # Use libedit diff --git a/package/mysql/0003-ac_stack_direction-is-unset.patch b/package/mysql/0003-ac_stack_direction-is-unset.patch new file mode 100644 index 0000000000..6fef0a9acf --- /dev/null +++ b/package/mysql/0003-ac_stack_direction-is-unset.patch @@ -0,0 +1,15 @@ +misc.m4: ac_cv_c_stack_direction is unset. + +Signed-off-by: Marcelo Gutierrez (UTN/FRH) + +--- mysql-5.1.70.orig/config/ac-macros/misc.m4 ++++ mysql-5.1.70/config/ac-macros/misc.m4 +@@ -477,7 +477,7 @@ + exit(ptr_f(&a) < 0); + } + ], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, +- ac_cv_c_stack_direction=)]) ++ ac_cv_c_stack_direction=0)]) + AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) + ])dnl + diff --git a/package/mysql/0004-Fix-gen_lex_hash-execution.patch b/package/mysql/0004-Fix-gen_lex_hash-execution.patch new file mode 100644 index 0000000000..b91ed4fef9 --- /dev/null +++ b/package/mysql/0004-Fix-gen_lex_hash-execution.patch @@ -0,0 +1,32 @@ +Makefile: fix cross-compiling the server + +MySQL Makefile believes it can run code it just compiled, to +generate a header. This does not work for cross-compilation. + +Instead, use a pre-installed host-version of the required tool. + +Signed-off-by: Marcelo Gutierrez (UTN/FRH) + +--- mysql-5.1.70/sql/Makefile.am ++++ mysql-5.1.70.patch/sql/Makefile.am +@@ -177,7 +177,7 @@ + # this avoid the rebuild of the built files in a source dist + lex_hash.h: gen_lex_hash.cc lex.h + $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT) +- ./gen_lex_hash$(EXEEXT) > $@-t ++ gen_lex_hash$(EXEEXT) > $@-t + $(MV) $@-t $@ + + # For testing of udf_example.so + +--- mysql-5.1.70/sql/Makefile.in ++++ mysql-5.1.70.patch/sql/Makefile.in +@@ -1310,7 +1310,7 @@ + # this avoid the rebuild of the built files in a source dist + lex_hash.h: gen_lex_hash.cc lex.h + $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT) +- ./gen_lex_hash$(EXEEXT) > $@-t ++ gen_lex_hash$(EXEEXT) > $@-t + $(MV) $@-t $@ + + # We might have some stuff not built in this build, but that we want to install diff --git a/package/mysql/0005-bison_3_breaks_mysql_server_build.patch b/package/mysql/0005-bison_3_breaks_mysql_server_build.patch new file mode 100644 index 0000000000..918fe2456a --- /dev/null +++ b/package/mysql/0005-bison_3_breaks_mysql_server_build.patch @@ -0,0 +1,3310 @@ +fix the yacc code in mysql + +Signed-off-by: Marcelo Gutierrez (UTN/FRH) +--- +diff -uNr mysql-5.1.73.orig/sql/sql_lex.cc mysql-5.1.73/sql/sql_lex.cc +--- mysql-5.1.73.orig/sql/sql_lex.cc 2013-11-04 18:52:27.000000000 +0000 ++++ mysql-5.1.73/sql/sql_lex.cc 2014-02-12 14:12:04.244111625 +0000 +@@ -775,14 +775,13 @@ + (which can't be followed by a signed number) + */ + +-int MYSQLlex(void *arg, void *yythd) ++int MYSQLlex(void *arg, THD *thd) + { + reg1 uchar c= 0; + bool comment_closed; + int tokval, result_state; + uint length; + enum my_lex_states state; +- THD *thd= (THD *)yythd; + Lex_input_stream *lip= & thd->m_parser_state->m_lip; + LEX *lex= thd->lex; + YYSTYPE *yylval=(YYSTYPE*) arg; +diff -uNr mysql-5.1.73.orig/sql/sql_lex.h mysql-5.1.73/sql/sql_lex.h +--- mysql-5.1.73.orig/sql/sql_lex.h 2013-11-04 18:52:27.000000000 +0000 ++++ mysql-5.1.73/sql/sql_lex.h 2014-02-12 14:17:19.424106423 +0000 +@@ -2072,7 +2072,7 @@ + extern void lex_free(void); + extern void lex_start(THD *thd); + extern void lex_end(LEX *lex); +-extern int MYSQLlex(void *arg, void *yythd); ++extern int MYSQLlex(void *arg, THD *thd); + + extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str); + +diff -uNr mysql-5.1.73.orig/sql/sql_parse.cc mysql-5.1.73/sql/sql_parse.cc +--- mysql-5.1.73.orig/sql/sql_parse.cc 2013-11-04 18:52:27.000000000 +0000 ++++ mysql-5.1.73/sql/sql_parse.cc 2014-02-12 14:19:20.424104427 +0000 +@@ -8012,7 +8012,7 @@ + } + + +-extern int MYSQLparse(void *thd); // from sql_yacc.cc ++extern int MYSQLparse(THD *thd); // from sql_yacc.cc + + + /** +diff -uNr mysql-5.1.73.orig/sql/sql_yacc.yy mysql-5.1.73/sql/sql_yacc.yy +--- mysql-5.1.73.orig/sql/sql_yacc.yy 2013-11-04 18:52:27.000000000 +0000 ++++ mysql-5.1.73/sql/sql_yacc.yy 2014-02-12 20:17:06.707750140 +0000 +@@ -23,19 +23,13 @@ + */ + + %{ +-/* thd is passed as an argument to yyparse(), and subsequently to yylex(). +-** The type will be void*, so it must be cast to (THD*) when used. +-** Use the YYTHD macro for this. +-*/ +-#define YYPARSE_PARAM yythd +-#define YYLEX_PARAM yythd +-#define YYTHD ((THD *)yythd) +-#define YYLIP (& YYTHD->m_parser_state->m_lip) ++ ++#define YYLIP (& thd->m_parser_state->m_lip) + + #define MYSQL_YACC + #define YYINITDEPTH 100 + #define YYMAXDEPTH 3200 /* Because of 64K stack */ +-#define Lex (YYTHD->lex) ++#define Lex (thd->lex) + #define Select Lex->current_select + #include "mysql_priv.h" + #include "slave.h" +@@ -55,7 +49,7 @@ + #pragma warning (disable : 4065) + #endif + +-int yylex(void *yylval, void *yythd); ++int yylex(void *yylval, THD *thd); + + const LEX_STRING null_lex_str= {0,0}; + +@@ -64,7 +58,7 @@ + ulong val= *(F); \ + if (my_yyoverflow((B), (D), &val)) \ + { \ +- yyerror((char*) (A)); \ ++ yyerror(current_thd, (char*) (A)); \ + return 2; \ + } \ + else \ +@@ -76,7 +70,7 @@ + #define MYSQL_YYABORT \ + do \ + { \ +- LEX::cleanup_lex_after_parse_error(YYTHD);\ ++ LEX::cleanup_lex_after_parse_error(thd);\ + YYABORT; \ + } while (0) + +@@ -159,9 +153,8 @@ + to abort from the parser. + */ + +-void MYSQLerror(const char *s) ++void MYSQLerror(THD *thd, const char *s) + { +- THD *thd= current_thd; + + /* + Restore the original LEX if it was replaced when parsing +@@ -675,7 +668,10 @@ + bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); + %} + +-%pure_parser /* We have threads */ ++/* We have threads */ ++%define api.pure ++%parse-param { THD *thd } ++%lex-param { THD *thd } + /* + Currently there are 169 shift/reduce conflicts. + We should not introduce new conflicts any more. +@@ -1516,7 +1512,6 @@ + query: + END_OF_INPUT + { +- THD *thd= YYTHD; + if (!thd->bootstrap && + (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) + { +@@ -1530,7 +1525,7 @@ + { + Lex_input_stream *lip = YYLIP; + +- if ((YYTHD->client_capabilities & CLIENT_MULTI_QUERIES) && ++ if ((thd->client_capabilities & CLIENT_MULTI_QUERIES) && + ! lip->stmt_prepare_mode && + ! lip->eof()) + { +@@ -1626,7 +1621,6 @@ + deallocate: + deallocate_or_drop PREPARE_SYM ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_DEALLOCATE_PREPARE; + lex->prepared_stmt_name= $3; +@@ -1641,7 +1635,6 @@ + prepare: + PREPARE_SYM ident FROM prepare_src + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_PREPARE; + lex->prepared_stmt_name= $2; +@@ -1651,14 +1644,12 @@ + prepare_src: + TEXT_STRING_sys + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->prepared_stmt_code= $1; + lex->prepared_stmt_code_is_varref= FALSE; + } + | '@' ident_or_text + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->prepared_stmt_code= $2; + lex->prepared_stmt_code_is_varref= TRUE; +@@ -1668,7 +1659,6 @@ + execute: + EXECUTE_SYM ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_EXECUTE; + lex->prepared_stmt_name= $2; +@@ -1826,7 +1816,6 @@ + create: + CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_CREATE_TABLE; + if (!lex->select_lex.add_table_to_list(thd, $5, NULL, +@@ -1844,13 +1833,13 @@ + } + create2 + { +- LEX *lex= YYTHD->lex; ++ LEX *lex= thd->lex; + lex->current_select= &lex->select_lex; + if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) && + !lex->create_info.db_type) + { +- lex->create_info.db_type= ha_default_handlerton(YYTHD); +- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, ++ lex->create_info.db_type= ha_default_handlerton(thd); ++ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_USING_OTHER_HANDLER, + ER(ER_WARN_USING_OTHER_HANDLER), + ha_resolve_storage_engine_name(lex->create_info.db_type), +@@ -1979,7 +1968,7 @@ + event_tail: + remember_name EVENT_SYM opt_if_not_exists sp_name + { +- THD *thd= YYTHD; ++ THD *thd= thd; + LEX *lex=Lex; + + lex->stmt_definition_begin= $1; +@@ -2046,7 +2035,7 @@ + ev_starts: + /* empty */ + { +- Item *item= new (YYTHD->mem_root) Item_func_now_local(); ++ Item *item= new (thd->mem_root) Item_func_now_local(); + if (item == NULL) + MYSQL_YYABORT; + Lex->event_parse_data->item_starts= item; +@@ -2096,7 +2085,6 @@ + + ev_sql_stmt: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -2139,7 +2127,6 @@ + } + ev_sql_stmt_inner + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + /* return back to the original memory root ASAP */ +@@ -2198,11 +2185,10 @@ + $$= new sp_name($1, $3, true); + if ($$ == NULL) + MYSQL_YYABORT; +- $$->init_qname(YYTHD); ++ $$->init_qname(thd); + } + | ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + LEX_STRING db; + if (check_routine_name(&$1)) +@@ -2272,7 +2258,7 @@ + lex->sql_command= SQLCOM_CALL; + lex->spname= $2; + lex->value_list.empty(); +- sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE); ++ sp_add_used_routine(lex, thd, $2, TYPE_ENUM_PROCEDURE); + } + opt_sp_cparam_list {} + ; +@@ -2345,7 +2331,7 @@ + (enum enum_field_types)$3, + sp_param_in); + +- if (lex->sphead->fill_field_definition(YYTHD, lex, ++ if (lex->sphead->fill_field_definition(thd, lex, + (enum enum_field_types) $3, + &spvar->field_def)) + { +@@ -2382,7 +2368,7 @@ + (enum enum_field_types)$4, + (sp_param_mode_t)$1); + +- if (lex->sphead->fill_field_definition(YYTHD, lex, ++ if (lex->sphead->fill_field_definition(thd, lex, + (enum enum_field_types) $4, + &spvar->field_def)) + { +@@ -2445,13 +2431,12 @@ + { + LEX *lex= Lex; + +- lex->sphead->reset_lex(YYTHD); ++ lex->sphead->reset_lex(thd); + lex->spcont->declare_var_boundary($2); + } + type + sp_opt_default + { +- THD *thd= YYTHD; + LEX *lex= Lex; + sp_pcontext *pctx= lex->spcont; + uint num_vars= pctx->context_var_count(); +@@ -2477,7 +2462,7 @@ + spvar->type= var_type; + spvar->dflt= dflt_value_item; + +- if (lex->sphead->fill_field_definition(YYTHD, lex, var_type, ++ if (lex->sphead->fill_field_definition(thd, lex, var_type, + &spvar->field_def)) + { + MYSQL_YYABORT; +@@ -2501,7 +2486,7 @@ + } + + pctx->declare_var_boundary(0); +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + $$.vars= $2; + $$.conds= $$.hndlrs= $$.curs= 0; +@@ -2516,7 +2501,7 @@ + my_error(ER_SP_DUP_COND, MYF(0), $2.str); + MYSQL_YYABORT; + } +- if(YYTHD->lex->spcont->push_cond(&$2, $5)) ++ if(thd->lex->spcont->push_cond(&$2, $5)) + MYSQL_YYABORT; + $$.vars= $$.hndlrs= $$.curs= 0; + $$.conds= 1; +@@ -2602,7 +2587,7 @@ + + sp_cursor_stmt: + { +- Lex->sphead->reset_lex(YYTHD); ++ Lex->sphead->reset_lex(thd); + } + select + { +@@ -2618,7 +2603,7 @@ + } + lex->sp_lex_in_use= TRUE; + $$= lex; +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + ; +@@ -2662,7 +2647,7 @@ + sp_cond: + ulong_num + { /* mysql errno */ +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::number; +@@ -2675,7 +2660,7 @@ + my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str); + MYSQL_YYABORT; + } +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::state; +@@ -2705,21 +2690,21 @@ + } + | SQLWARNING_SYM /* SQLSTATEs 01??? */ + { +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::warning; + } + | not FOUND_SYM /* SQLSTATEs 02??? */ + { +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::notfound; + } + | SQLEXCEPTION_SYM /* All other SQLSTATEs */ + { +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::exception; +@@ -2789,7 +2774,6 @@ + + sp_proc_stmt_statement: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -2798,7 +2782,6 @@ + } + statement + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp= lex->sphead; +@@ -2845,7 +2828,7 @@ + + sp_proc_stmt_return: + RETURN_SYM +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr + { + LEX *lex= Lex; +@@ -2867,7 +2850,7 @@ + MYSQL_YYABORT; + sp->m_flags|= sp_head::HAS_RETURN; + } +- if (sp->restore_lex(YYTHD)) ++ if (sp->restore_lex(thd)) + MYSQL_YYABORT; + } + ; +@@ -3094,7 +3077,7 @@ + ; + + sp_if: +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr THEN_SYM + { + LEX *lex= Lex; +@@ -3108,7 +3091,7 @@ + sp->add_cont_backpatch(i) || + sp->add_instr(i)) + MYSQL_YYABORT; +- if (sp->restore_lex(YYTHD)) ++ if (sp->restore_lex(thd)) + MYSQL_YYABORT; + } + sp_proc_stmts1 +@@ -3147,7 +3130,7 @@ + { + LEX *lex= Lex; + case_stmt_action_case(lex); +- lex->sphead->reset_lex(YYTHD); /* For expr $3 */ ++ lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { +@@ -3156,7 +3139,7 @@ + MYSQL_YYABORT; + + /* For expr $3 */ +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + simple_when_clause_list +@@ -3198,7 +3181,7 @@ + simple_when_clause: + WHEN_SYM + { +- Lex->sphead->reset_lex(YYTHD); /* For expr $3 */ ++ Lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { +@@ -3208,7 +3191,7 @@ + if (case_stmt_action_when(lex, $3, true)) + MYSQL_YYABORT; + /* For expr $3 */ +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + THEN_SYM +@@ -3223,7 +3206,7 @@ + searched_when_clause: + WHEN_SYM + { +- Lex->sphead->reset_lex(YYTHD); /* For expr $3 */ ++ Lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { +@@ -3231,7 +3214,7 @@ + if (case_stmt_action_when(lex, $3, false)) + MYSQL_YYABORT; + /* For expr $3 */ +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + THEN_SYM +@@ -3395,7 +3378,7 @@ + MYSQL_YYABORT; + } + | WHILE_SYM +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr DO_SYM + { + LEX *lex= Lex; +@@ -3409,7 +3392,7 @@ + sp->new_cont_backpatch(i) || + sp->add_instr(i)) + MYSQL_YYABORT; +- if (sp->restore_lex(YYTHD)) ++ if (sp->restore_lex(thd)) + MYSQL_YYABORT; + } + sp_proc_stmts1 END WHILE_SYM +@@ -3424,7 +3407,7 @@ + lex->sphead->do_cont_backpatch(); + } + | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr END REPEAT_SYM + { + LEX *lex= Lex; +@@ -3436,7 +3419,7 @@ + if (i == NULL || + lex->sphead->add_instr(i)) + MYSQL_YYABORT; +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + /* We can shortcut the cont_backpatch here */ + i->m_cont_dest= ip+1; +@@ -3859,7 +3842,6 @@ + create3 {} + | LIKE table_ident + { +- THD *thd= YYTHD; + TABLE_LIST *src_table; + LEX *lex= thd->lex; + +@@ -3873,7 +3855,6 @@ + } + | '(' LIKE table_ident ')' + { +- THD *thd= YYTHD; + TABLE_LIST *src_table; + LEX *lex= thd->lex; + +@@ -4342,7 +4323,6 @@ + bit_expr + { + Item *part_expr= $1; +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Name_resolution_context *context= &lex->current_select->context; + TABLE_LIST *save_list= context->table_list; +@@ -4364,7 +4344,7 @@ + my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0)); + MYSQL_YYABORT; + } +- if (part_expr->fix_fields(YYTHD, (Item**)0) || ++ if (part_expr->fix_fields(thd, (Item**)0) || + ((context->table_list= save_list), FALSE) || + (!part_expr->const_item()) || + (!lex->safe_to_cache_query)) +@@ -4629,7 +4609,7 @@ + | TYPE_SYM opt_equal storage_engines + { + Lex->create_info.db_type= $3; +- WARN_DEPRECATED(yythd, "6.0", "TYPE=storage_engine", ++ WARN_DEPRECATED(thd, "6.0", "TYPE=storage_engine", + "'ENGINE=storage_engine'"); + Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; + } +@@ -4791,19 +4771,19 @@ + storage_engines: + ident_or_text + { +- plugin_ref plugin= ha_resolve_by_name(YYTHD, &$1); ++ plugin_ref plugin= ha_resolve_by_name(thd, &$1); + + if (plugin) + $$= plugin_data(plugin, handlerton*); + else + { +- if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) ++ if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str); + MYSQL_YYABORT; + } + $$= 0; +- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, ++ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_UNKNOWN_STORAGE_ENGINE, + ER(ER_UNKNOWN_STORAGE_ENGINE), + $1.str); +@@ -4815,7 +4795,7 @@ + ident_or_text + { + plugin_ref plugin; +- if ((plugin= ha_resolve_by_name(YYTHD, &$1))) ++ if ((plugin= ha_resolve_by_name(thd, &$1))) + $$= plugin_data(plugin, handlerton*); + else + { +@@ -5043,7 +5023,7 @@ + { + char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1]; + my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length); +- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE, ++ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_WARN_DEPRECATED_SYNTAX, + ER(ER_WARN_DEPRECATED_SYNTAX), + buff, "YEAR(4)"); +@@ -5057,7 +5037,7 @@ + { $$=MYSQL_TYPE_TIME; } + | TIMESTAMP opt_field_length + { +- if (YYTHD->variables.sql_mode & MODE_MAXDB) ++ if (thd->variables.sql_mode & MODE_MAXDB) + $$=MYSQL_TYPE_DATETIME; + else + { +@@ -5189,7 +5169,7 @@ + real_type: + REAL + { +- $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ? ++ $$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ? + MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE; + } + | DOUBLE_SYM +@@ -5263,7 +5243,7 @@ + | DEFAULT now_or_signed_literal { Lex->default_value=$2; } + | ON UPDATE_SYM NOW_SYM optional_braces + { +- Item *item= new (YYTHD->mem_root) Item_func_now_local(); ++ Item *item= new (thd->mem_root) Item_func_now_local(); + if (item == NULL) + MYSQL_YYABORT; + Lex->on_update_value= item; +@@ -5312,7 +5292,7 @@ + now_or_signed_literal: + NOW_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_now_local(); ++ $$= new (thd->mem_root) Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -5673,7 +5653,6 @@ + alter: + ALTER opt_ignore TABLE_SYM table_ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->name.str= 0; + lex->name.length= 0; +@@ -5799,7 +5778,7 @@ + Event_parse_data. + */ + +- if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD))) ++ if (!(Lex->event_parse_data= Event_parse_data::new_instance(thd))) + MYSQL_YYABORT; + Lex->event_parse_data->identifier= $4; + +@@ -6192,7 +6171,6 @@ + { + if (!$4) + { +- THD *thd= YYTHD; + $4= thd->variables.collation_database; + } + $5= $5 ? $5 : $4; +@@ -6556,7 +6534,7 @@ + assign_to_keycache: + table_ident cache_keys_spec + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ, ++ if (!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ, + Select->pop_index_hints())) + MYSQL_YYABORT; + } +@@ -6585,7 +6563,7 @@ + preload_keys: + table_ident cache_keys_spec opt_ignore_leaves + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ, ++ if (!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ, + Select->pop_index_hints())) + MYSQL_YYABORT; + } +@@ -6593,7 +6571,7 @@ + + cache_keys_spec: + { +- Lex->select_lex.alloc_index_hints(YYTHD); ++ Lex->select_lex.alloc_index_hints(thd); + Select->set_index_hint_type(INDEX_HINT_USE, + global_system_variables.old_mode ? + INDEX_HINT_MASK_JOIN : +@@ -6813,7 +6791,6 @@ + | select_item + | '*' + { +- THD *thd= YYTHD; + Item *item= new (thd->mem_root) + Item_field(&thd->lex->current_select->context, + NULL, NULL, "*"); +@@ -6828,7 +6805,6 @@ + select_item: + remember_name select_item2 remember_end select_alias + { +- THD *thd= YYTHD; + DBUG_ASSERT($1 < $3); + + if (add_item_to_list(thd, $2)) +@@ -6929,7 +6905,7 @@ + else + { + /* X OR Y */ +- $$ = new (YYTHD->mem_root) Item_cond_or($1, $3); ++ $$ = new (thd->mem_root) Item_cond_or($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -6937,7 +6913,7 @@ + | expr XOR expr %prec XOR + { + /* XOR is a proprietary extension */ +- $$ = new (YYTHD->mem_root) Item_cond_xor($1, $3); ++ $$ = new (thd->mem_root) Item_cond_xor($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -6979,50 +6955,50 @@ + else + { + /* X AND Y */ +- $$ = new (YYTHD->mem_root) Item_cond_and($1, $3); ++ $$ = new (thd->mem_root) Item_cond_and($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + } + | NOT_SYM expr %prec NOT_SYM + { +- $$= negate_expression(YYTHD, $2); ++ $$= negate_expression(thd, $2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS TRUE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_istrue($1); ++ $$= new (thd->mem_root) Item_func_istrue($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not TRUE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnottrue($1); ++ $$= new (thd->mem_root) Item_func_isnottrue($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS FALSE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isfalse($1); ++ $$= new (thd->mem_root) Item_func_isfalse($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not FALSE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); ++ $$= new (thd->mem_root) Item_func_isnotfalse($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS UNKNOWN_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnull($1); ++ $$= new (thd->mem_root) Item_func_isnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not UNKNOWN_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnotnull($1); ++ $$= new (thd->mem_root) Item_func_isnotnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7032,19 +7008,19 @@ + bool_pri: + bool_pri IS NULL_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnull($1); ++ $$= new (thd->mem_root) Item_func_isnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not NULL_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnotnull($1); ++ $$= new (thd->mem_root) Item_func_isnotnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM + { +- $$= new (YYTHD->mem_root) Item_func_equal($1,$3); ++ $$= new (thd->mem_root) Item_func_equal($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7066,13 +7042,12 @@ + predicate: + bit_expr IN_SYM '(' subselect ')' + { +- $$= new (YYTHD->mem_root) Item_in_subselect($1, $4); ++ $$= new (thd->mem_root) Item_in_subselect($1, $4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' subselect ')' + { +- THD *thd= YYTHD; + Item *item= new (thd->mem_root) Item_in_subselect($1, $5); + if (item == NULL) + MYSQL_YYABORT; +@@ -7082,7 +7057,7 @@ + } + | bit_expr IN_SYM '(' expr ')' + { +- $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4); ++ $$= handle_sql2003_note184_exception(thd, $1, true, $4); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7090,13 +7065,13 @@ + { + $6->push_front($4); + $6->push_front($1); +- $$= new (YYTHD->mem_root) Item_func_in(*$6); ++ $$= new (thd->mem_root) Item_func_in(*$6); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' expr ')' + { +- $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5); ++ $$= handle_sql2003_note184_exception(thd, $1, false, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7104,7 +7079,7 @@ + { + $7->push_front($5); + $7->push_front($1); +- Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7); ++ Item_func_in *item = new (thd->mem_root) Item_func_in(*$7); + if (item == NULL) + MYSQL_YYABORT; + item->negate(); +@@ -7112,14 +7087,14 @@ + } + | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate + { +- $$= new (YYTHD->mem_root) Item_func_between($1,$3,$5); ++ $$= new (thd->mem_root) Item_func_between($1,$3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate + { + Item_func_between *item; +- item= new (YYTHD->mem_root) Item_func_between($1,$4,$6); ++ item= new (thd->mem_root) Item_func_between($1,$4,$6); + if (item == NULL) + MYSQL_YYABORT; + item->negate(); +@@ -7127,42 +7102,42 @@ + } + | bit_expr SOUNDS_SYM LIKE bit_expr + { +- Item *item1= new (YYTHD->mem_root) Item_func_soundex($1); +- Item *item4= new (YYTHD->mem_root) Item_func_soundex($4); ++ Item *item1= new (thd->mem_root) Item_func_soundex($1); ++ Item *item4= new (thd->mem_root) Item_func_soundex($4); + if ((item1 == NULL) || (item4 == NULL)) + MYSQL_YYABORT; +- $$= new (YYTHD->mem_root) Item_func_eq(item1, item4); ++ $$= new (thd->mem_root) Item_func_eq(item1, item4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr LIKE simple_expr opt_escape + { +- $$= new (YYTHD->mem_root) Item_func_like($1,$3,$4,Lex->escape_used); ++ $$= new (thd->mem_root) Item_func_like($1,$3,$4,Lex->escape_used); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not LIKE simple_expr opt_escape + { +- Item *item= new (YYTHD->mem_root) Item_func_like($1,$4,$5, ++ Item *item= new (thd->mem_root) Item_func_like($1,$4,$5, + Lex->escape_used); + if (item == NULL) + MYSQL_YYABORT; +- $$= new (YYTHD->mem_root) Item_func_not(item); ++ $$= new (thd->mem_root) Item_func_not(item); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr REGEXP bit_expr + { +- $$= new (YYTHD->mem_root) Item_func_regex($1,$3); ++ $$= new (thd->mem_root) Item_func_regex($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not REGEXP bit_expr + { +- Item *item= new (YYTHD->mem_root) Item_func_regex($1,$4); ++ Item *item= new (thd->mem_root) Item_func_regex($1,$4); + if (item == NULL) + MYSQL_YYABORT; +- $$= negate_expression(YYTHD, item); ++ $$= negate_expression(thd, item); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7172,85 +7147,85 @@ + bit_expr: + bit_expr '|' bit_expr %prec '|' + { +- $$= new (YYTHD->mem_root) Item_func_bit_or($1,$3); ++ $$= new (thd->mem_root) Item_func_bit_or($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '&' bit_expr %prec '&' + { +- $$= new (YYTHD->mem_root) Item_func_bit_and($1,$3); ++ $$= new (thd->mem_root) Item_func_bit_and($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT + { +- $$= new (YYTHD->mem_root) Item_func_shift_left($1,$3); ++ $$= new (thd->mem_root) Item_func_shift_left($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT + { +- $$= new (YYTHD->mem_root) Item_func_shift_right($1,$3); ++ $$= new (thd->mem_root) Item_func_shift_right($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '+' bit_expr %prec '+' + { +- $$= new (YYTHD->mem_root) Item_func_plus($1,$3); ++ $$= new (thd->mem_root) Item_func_plus($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '-' bit_expr %prec '-' + { +- $$= new (YYTHD->mem_root) Item_func_minus($1,$3); ++ $$= new (thd->mem_root) Item_func_minus($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '+' INTERVAL_SYM expr interval %prec '+' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,0); ++ $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '-' INTERVAL_SYM expr interval %prec '-' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,1); ++ $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '*' bit_expr %prec '*' + { +- $$= new (YYTHD->mem_root) Item_func_mul($1,$3); ++ $$= new (thd->mem_root) Item_func_mul($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '/' bit_expr %prec '/' + { +- $$= new (YYTHD->mem_root) Item_func_div($1,$3); ++ $$= new (thd->mem_root) Item_func_div($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '%' bit_expr %prec '%' + { +- $$= new (YYTHD->mem_root) Item_func_mod($1,$3); ++ $$= new (thd->mem_root) Item_func_mod($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr DIV_SYM bit_expr %prec DIV_SYM + { +- $$= new (YYTHD->mem_root) Item_func_int_div($1,$3); ++ $$= new (thd->mem_root) Item_func_int_div($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr MOD_SYM bit_expr %prec MOD_SYM + { +- $$= new (YYTHD->mem_root) Item_func_mod($1,$3); ++ $$= new (thd->mem_root) Item_func_mod($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '^' bit_expr + { +- $$= new (YYTHD->mem_root) Item_func_bit_xor($1,$3); ++ $$= new (thd->mem_root) Item_func_bit_xor($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7299,7 +7274,6 @@ + | function_call_conflict + | simple_expr COLLATE_SYM ident_or_text %prec NEG + { +- THD *thd= YYTHD; + Item *i1= new (thd->mem_root) Item_string($3.str, + $3.length, + thd->charset()); +@@ -7315,7 +7289,7 @@ + | sum_expr + | simple_expr OR_OR_SYM simple_expr + { +- $$= new (YYTHD->mem_root) Item_func_concat($1, $3); ++ $$= new (thd->mem_root) Item_func_concat($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7325,25 +7299,25 @@ + } + | '-' simple_expr %prec NEG + { +- $$= new (YYTHD->mem_root) Item_func_neg($2); ++ $$= new (thd->mem_root) Item_func_neg($2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '~' simple_expr %prec NEG + { +- $$= new (YYTHD->mem_root) Item_func_bit_neg($2); ++ $$= new (thd->mem_root) Item_func_bit_neg($2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | not2 simple_expr %prec NEG + { +- $$= negate_expression(YYTHD, $2); ++ $$= negate_expression(thd, $2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '(' subselect ')' + { +- $$= new (YYTHD->mem_root) Item_singlerow_subselect($2); ++ $$= new (thd->mem_root) Item_singlerow_subselect($2); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7352,20 +7326,20 @@ + | '(' expr ',' expr_list ')' + { + $4->push_front($2); +- $$= new (YYTHD->mem_root) Item_row(*$4); ++ $$= new (thd->mem_root) Item_row(*$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ROW_SYM '(' expr ',' expr_list ')' + { + $5->push_front($3); +- $$= new (YYTHD->mem_root) Item_row(*$5); ++ $$= new (thd->mem_root) Item_row(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | EXISTS '(' subselect ')' + { +- $$= new (YYTHD->mem_root) Item_exists_subselect($3); ++ $$= new (thd->mem_root) Item_exists_subselect($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7374,7 +7348,7 @@ + | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')' + { + $2->push_front($5); +- Item_func_match *i1= new (YYTHD->mem_root) Item_func_match(*$2, $6); ++ Item_func_match *i1= new (thd->mem_root) Item_func_match(*$2, $6); + if (i1 == NULL) + MYSQL_YYABORT; + Select->add_ftfunc_to_list(i1); +@@ -7382,7 +7356,7 @@ + } + | BINARY simple_expr %prec NEG + { +- $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL, ++ $$= create_func_cast(thd, $2, ITEM_CAST_CHAR, NULL, NULL, + &my_charset_bin); + if ($$ == NULL) + MYSQL_YYABORT; +@@ -7390,27 +7364,27 @@ + | CAST_SYM '(' expr AS cast_type ')' + { + LEX *lex= Lex; +- $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec, ++ $$= create_func_cast(thd, $3, $5, lex->length, lex->dec, + lex->charset); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CASE_SYM opt_expr when_list opt_else END + { +- $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); ++ $$= new (thd->mem_root) Item_func_case(* $3, $2, $4 ); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CONVERT_SYM '(' expr ',' cast_type ')' + { +- $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec, ++ $$= create_func_cast(thd, $3, $5, Lex->length, Lex->dec, + Lex->charset); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CONVERT_SYM '(' expr USING charset_name ')' + { +- $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5); ++ $$= new (thd->mem_root) Item_func_conv_charset($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7423,14 +7397,14 @@ + my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str); + MYSQL_YYABORT; + } +- $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(), ++ $$= new (thd->mem_root) Item_default_value(Lex->current_context(), + $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | VALUES '(' simple_ident_nospvar ')' + { +- $$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(), ++ $$= new (thd->mem_root) Item_insert_value(Lex->current_context(), + $3); + if ($$ == NULL) + MYSQL_YYABORT; +@@ -7438,7 +7412,7 @@ + | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM + /* we cannot put interval before - */ + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0); ++ $$= new (thd->mem_root) Item_date_add_interval($5,$2,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7453,19 +7427,19 @@ + function_call_keyword: + CHAR_SYM '(' expr_list ')' + { +- $$= new (YYTHD->mem_root) Item_func_char(*$3); ++ $$= new (thd->mem_root) Item_func_char(*$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CHAR_SYM '(' expr_list USING charset_name ')' + { +- $$= new (YYTHD->mem_root) Item_func_char(*$3, $5); ++ $$= new (thd->mem_root) Item_func_char(*$3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CURRENT_USER optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context()); ++ $$= new (thd->mem_root) Item_func_current_user(Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(); +@@ -7473,31 +7447,30 @@ + } + | DATE_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_typecast($3); ++ $$= new (thd->mem_root) Item_date_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DAY_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_dayofmonth($3); ++ $$= new (thd->mem_root) Item_func_dayofmonth($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HOUR_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_hour($3); ++ $$= new (thd->mem_root) Item_func_hour($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | INSERT '(' expr ',' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9); ++ $$= new (thd->mem_root) Item_func_insert($3,$5,$7,$9); + if ($$ == NULL) + MYSQL_YYABORT; + } + | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM + { +- THD *thd= YYTHD; + List *list= new (thd->mem_root) List; + if (list == NULL) + MYSQL_YYABORT; +@@ -7512,7 +7485,6 @@ + } + | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM + { +- THD *thd= YYTHD; + $7->push_front($5); + $7->push_front($3); + Item_row *item= new (thd->mem_root) Item_row(*$7); +@@ -7524,103 +7496,103 @@ + } + | LEFT '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_left($3,$5); ++ $$= new (thd->mem_root) Item_func_left($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MINUTE_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_minute($3); ++ $$= new (thd->mem_root) Item_func_minute($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MONTH_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_month($3); ++ $$= new (thd->mem_root) Item_func_month($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | RIGHT '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_right($3,$5); ++ $$= new (thd->mem_root) Item_func_right($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SECOND_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_second($3); ++ $$= new (thd->mem_root) Item_func_second($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIME_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_time_typecast($3); ++ $$= new (thd->mem_root) Item_time_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIMESTAMP '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_datetime_typecast($3); ++ $$= new (thd->mem_root) Item_datetime_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIMESTAMP '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0); ++ $$= new (thd->mem_root) Item_func_add_time($3, $5, 1, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($3); ++ $$= new (thd->mem_root) Item_func_trim($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' LEADING expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4); ++ $$= new (thd->mem_root) Item_func_ltrim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' TRAILING expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4); ++ $$= new (thd->mem_root) Item_func_rtrim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' BOTH expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($6,$4); ++ $$= new (thd->mem_root) Item_func_trim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' LEADING FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_ltrim($5); ++ $$= new (thd->mem_root) Item_func_ltrim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' TRAILING FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_rtrim($5); ++ $$= new (thd->mem_root) Item_func_rtrim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' BOTH FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($5); ++ $$= new (thd->mem_root) Item_func_trim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($5,$3); ++ $$= new (thd->mem_root) Item_func_trim($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | USER '(' ')' + { +- $$= new (YYTHD->mem_root) Item_func_user(); ++ $$= new (thd->mem_root) Item_func_user(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(); +@@ -7628,7 +7600,7 @@ + } + | YEAR_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_year($3); ++ $$= new (thd->mem_root) Item_func_year($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7649,34 +7621,34 @@ + function_call_nonkeyword: + ADDDATE_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5, ++ $$= new (thd->mem_root) Item_date_add_interval($3, $5, + INTERVAL_DAY, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0); ++ $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CURDATE optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curdate_local(); ++ $$= new (thd->mem_root) Item_func_curdate_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | CURTIME optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curtime_local(); ++ $$= new (thd->mem_root) Item_func_curtime_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | CURTIME '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_curtime_local($3); ++ $$= new (thd->mem_root) Item_func_curtime_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; +@@ -7684,83 +7656,83 @@ + | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' + %prec INTERVAL_SYM + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0); ++ $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' + %prec INTERVAL_SYM + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1); ++ $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | EXTRACT_SYM '(' interval FROM expr ')' + { +- $$=new (YYTHD->mem_root) Item_extract( $3, $5); ++ $$=new (thd->mem_root) Item_extract( $3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | GET_FORMAT '(' date_time_type ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_get_format($3, $5); ++ $$= new (thd->mem_root) Item_func_get_format($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | NOW_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_now_local(); ++ $$= new (thd->mem_root) Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | NOW_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_now_local($3); ++ $$= new (thd->mem_root) Item_func_now_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | POSITION_SYM '(' bit_expr IN_SYM expr ')' + { +- $$ = new (YYTHD->mem_root) Item_func_locate($5,$3); ++ $$ = new (thd->mem_root) Item_func_locate($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBDATE_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5, ++ $$= new (thd->mem_root) Item_date_add_interval($3, $5, + INTERVAL_DAY, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1); ++ $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_substr($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5); ++ $$= new (thd->mem_root) Item_func_substr($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr FROM expr FOR_SYM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_substr($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5); ++ $$= new (thd->mem_root) Item_func_substr($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7775,9 +7747,9 @@ + */ + Lex->set_stmt_unsafe(); + if (global_system_variables.sysdate_is_now == 0) +- $$= new (YYTHD->mem_root) Item_func_sysdate_local(); ++ $$= new (thd->mem_root) Item_func_sysdate_local(); + else +- $$= new (YYTHD->mem_root) Item_func_now_local(); ++ $$= new (thd->mem_root) Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; +@@ -7785,42 +7757,42 @@ + | SYSDATE '(' expr ')' + { + if (global_system_variables.sysdate_is_now == 0) +- $$= new (YYTHD->mem_root) Item_func_sysdate_local($3); ++ $$= new (thd->mem_root) Item_func_sysdate_local($3); + else +- $$= new (YYTHD->mem_root) Item_func_now_local($3); ++ $$= new (thd->mem_root) Item_func_now_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0); ++ $$= new (thd->mem_root) Item_date_add_interval($7,$5,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3); ++ $$= new (thd->mem_root) Item_func_timestamp_diff($5,$7,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | UTC_DATE_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curdate_utc(); ++ $$= new (thd->mem_root) Item_func_curdate_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | UTC_TIME_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curtime_utc(); ++ $$= new (thd->mem_root) Item_func_curtime_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | UTC_TIMESTAMP_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_now_utc(); ++ $$= new (thd->mem_root) Item_func_now_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; +@@ -7835,62 +7807,61 @@ + function_call_conflict: + ASCII_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_ascii($3); ++ $$= new (thd->mem_root) Item_func_ascii($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CHARSET '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_charset($3); ++ $$= new (thd->mem_root) Item_func_charset($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COALESCE '(' expr_list ')' + { +- $$= new (YYTHD->mem_root) Item_func_coalesce(* $3); ++ $$= new (thd->mem_root) Item_func_coalesce(* $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COLLATION_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_collation($3); ++ $$= new (thd->mem_root) Item_func_collation($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DATABASE '(' ')' + { +- $$= new (YYTHD->mem_root) Item_func_database(); ++ $$= new (thd->mem_root) Item_func_database(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | IF '(' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_if($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MICROSECOND_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_microsecond($3); ++ $$= new (thd->mem_root) Item_func_microsecond($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MOD_SYM '(' expr ',' expr ')' + { +- $$ = new (YYTHD->mem_root) Item_func_mod($3, $5); ++ $$ = new (thd->mem_root) Item_func_mod($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | OLD_PASSWORD '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_old_password($3); ++ $$= new (thd->mem_root) Item_func_old_password($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | PASSWORD '(' expr ')' + { +- THD *thd= YYTHD; + Item* i1; + if (thd->variables.old_passwords) + i1= new (thd->mem_root) Item_func_old_password($3); +@@ -7902,31 +7873,30 @@ + } + | QUARTER_SYM '(' expr ')' + { +- $$ = new (YYTHD->mem_root) Item_func_quarter($3); ++ $$ = new (thd->mem_root) Item_func_quarter($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | REPEAT_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_repeat($3,$5); ++ $$= new (thd->mem_root) Item_func_repeat($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | REPLACE '(' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_replace($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRUNCATE_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_round($3,$5,1); ++ $$= new (thd->mem_root) Item_func_round($3,$5,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | WEEK_SYM '(' expr ')' + { +- THD *thd= YYTHD; + Item *i1= new (thd->mem_root) Item_int((char*) "0", + thd->variables.default_week_format, + 1); +@@ -7938,7 +7908,7 @@ + } + | WEEK_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_week($3,$5); ++ $$= new (thd->mem_root) Item_func_week($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7960,52 +7930,52 @@ + geometry_function: + CONTAINS_SYM '(' expr ',' expr ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_rel($3, $5, + Item_func::SP_CONTAINS_FUNC)); + } + | GEOMETRYCOLLECTION '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_geometrycollection, + Geometry::wkb_point)); + } + | LINESTRING '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_linestring, + Geometry::wkb_point)); + } + | MULTILINESTRING '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_multilinestring, + Geometry::wkb_linestring)); + } + | MULTIPOINT '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_multipoint, + Geometry::wkb_point)); + } + | MULTIPOLYGON '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_multipolygon, + Geometry::wkb_polygon)); + } + | POINT_SYM '(' expr ',' expr ')' + { +- $$= GEOM_NEW(YYTHD, Item_func_point($3,$5)); ++ $$= GEOM_NEW(thd, Item_func_point($3,$5)); + } + | POLYGON '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_polygon, + Geometry::wkb_linestring)); +@@ -8043,7 +8013,6 @@ + } + opt_udf_expr_list ')' + { +- THD *thd= YYTHD; + Create_func *builder; + Item *item= NULL; + +@@ -8097,7 +8066,6 @@ + } + | ident '.' ident '(' opt_expr_list ')' + { +- THD *thd= YYTHD; + Create_qfunc *builder; + Item *item= NULL; + +@@ -8161,7 +8129,7 @@ + udf_expr_list: + udf_expr + { +- $$= new (YYTHD->mem_root) List; ++ $$= new (thd->mem_root) List; + if ($$ == NULL) + MYSQL_YYABORT; + $$->push_back($1); +@@ -8194,7 +8162,7 @@ + remember_name we may get quoted or escaped names. + */ + else if ($2->type() != Item::FIELD_ITEM) +- $2->set_name($1, (uint) ($3 - $1), YYTHD->charset()); ++ $2->set_name($1, (uint) ($3 - $1), thd->charset()); + $$= $2; + } + ; +@@ -8202,46 +8170,46 @@ + sum_expr: + AVG_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_avg($3); ++ $$= new (thd->mem_root) Item_sum_avg($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | AVG_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_avg_distinct($4); ++ $$= new (thd->mem_root) Item_sum_avg_distinct($4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIT_AND '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_and($3); ++ $$= new (thd->mem_root) Item_sum_and($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIT_OR '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_or($3); ++ $$= new (thd->mem_root) Item_sum_or($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIT_XOR '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_xor($3); ++ $$= new (thd->mem_root) Item_sum_xor($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COUNT_SYM '(' opt_all '*' ')' + { +- Item *item= new (YYTHD->mem_root) Item_int((int32) 0L,1); ++ Item *item= new (thd->mem_root) Item_int((int32) 0L,1); + if (item == NULL) + MYSQL_YYABORT; +- $$= new (YYTHD->mem_root) Item_sum_count(item); ++ $$= new (thd->mem_root) Item_sum_count(item); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COUNT_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_count($3); ++ $$= new (thd->mem_root) Item_sum_count($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8251,13 +8219,13 @@ + { Select->in_sum_expr--; } + ')' + { +- $$= new (YYTHD->mem_root) Item_sum_count_distinct(* $5); ++ $$= new (thd->mem_root) Item_sum_count_distinct(* $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MIN_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_min($3); ++ $$= new (thd->mem_root) Item_sum_min($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8268,55 +8236,55 @@ + */ + | MIN_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_min($4); ++ $$= new (thd->mem_root) Item_sum_min($4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MAX_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_max($3); ++ $$= new (thd->mem_root) Item_sum_max($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MAX_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_max($4); ++ $$= new (thd->mem_root) Item_sum_max($4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | STD_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_std($3, 0); ++ $$= new (thd->mem_root) Item_sum_std($3, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | VARIANCE_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_variance($3, 0); ++ $$= new (thd->mem_root) Item_sum_variance($3, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | STDDEV_SAMP_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_std($3, 1); ++ $$= new (thd->mem_root) Item_sum_std($3, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | VAR_SAMP_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_variance($3, 1); ++ $$= new (thd->mem_root) Item_sum_variance($3, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUM_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_sum($3); ++ $$= new (thd->mem_root) Item_sum_sum($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUM_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_sum_distinct($4); ++ $$= new (thd->mem_root) Item_sum_sum_distinct($4); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8328,7 +8296,7 @@ + { + SELECT_LEX *sel= Select; + sel->in_sum_expr--; +- $$= new (YYTHD->mem_root) ++ $$= new (thd->mem_root) + Item_func_group_concat(Lex->current_context(), $3, $5, + sel->gorder_list, $7); + if ($$ == NULL) +@@ -8357,7 +8325,7 @@ + ident_or_text SET_VAR expr + { + Item_func_set_user_var *item; +- $$= item= new (YYTHD->mem_root) Item_func_set_user_var($1, $3); ++ $$= item= new (thd->mem_root) Item_func_set_user_var($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + LEX *lex= Lex; +@@ -8366,7 +8334,7 @@ + } + | ident_or_text + { +- $$= new (YYTHD->mem_root) Item_func_get_user_var($1); ++ $$= new (thd->mem_root) Item_func_get_user_var($1); + if ($$ == NULL) + MYSQL_YYABORT; + LEX *lex= Lex; +@@ -8380,7 +8348,7 @@ + my_parse_error(ER(ER_SYNTAX_ERROR)); + MYSQL_YYABORT; + } +- if (!($$= get_system_var(YYTHD, $2, $3, $4))) ++ if (!($$= get_system_var(thd, $2, $3, $4))) + MYSQL_YYABORT; + if (!((Item_func_get_system_var*) $$)->is_written_to_binlog()) + Lex->set_stmt_unsafe(); +@@ -8395,7 +8363,7 @@ + opt_gconcat_separator: + /* empty */ + { +- $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1); ++ $$= new (thd->mem_root) String(",", 1, &my_charset_latin1); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8422,9 +8390,9 @@ + + gorder_list: + gorder_list ',' order_ident order_dir +- { if (add_gorder_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; } ++ { if (add_gorder_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; } + | order_ident order_dir +- { if (add_gorder_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; } ++ { if (add_gorder_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } + ; + + in_sum_expr: +@@ -8477,7 +8445,7 @@ + expr_list: + expr + { +- $$= new (YYTHD->mem_root) List; ++ $$= new (thd->mem_root) List; + if ($$ == NULL) + MYSQL_YYABORT; + $$->push_back($1); +@@ -8497,7 +8465,7 @@ + ident_list: + simple_ident + { +- $$= new (YYTHD->mem_root) List; ++ $$= new (thd->mem_root) List; + if ($$ == NULL) + MYSQL_YYABORT; + $$->push_back($1); +@@ -8595,7 +8563,7 @@ + { + MYSQL_YYABORT_UNLESS($1 && $3); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $3)) ++ if (push_new_name_resolution_context(thd, $1, $3)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8610,7 +8578,7 @@ + { + MYSQL_YYABORT_UNLESS($1 && $3); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $3)) ++ if (push_new_name_resolution_context(thd, $1, $3)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8640,7 +8608,7 @@ + { + MYSQL_YYABORT_UNLESS($1 && $5); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $5)) ++ if (push_new_name_resolution_context(thd, $1, $5)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8676,7 +8644,7 @@ + { + MYSQL_YYABORT_UNLESS($1 && $5); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $5)) ++ if (push_new_name_resolution_context(thd, $1, $5)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8724,7 +8692,7 @@ + } + table_ident opt_table_alias opt_key_definition + { +- if (!($$= Select->add_table_to_list(YYTHD, $2, $3, ++ if (!($$= Select->add_table_to_list(thd, $2, $3, + Select->get_table_join_options(), + Lex->lock_option, + Select->pop_index_hints()))) +@@ -8922,7 +8890,7 @@ + + opt_index_hints_list: + /* empty */ +- | { Select->alloc_index_hints(YYTHD); } index_hints_list ++ | { Select->alloc_index_hints(thd); } index_hints_list + ; + + opt_key_definition: +@@ -8931,15 +8899,15 @@ + ; + + opt_key_usage_list: +- /* empty */ { Select->add_index_hint(YYTHD, NULL, 0); } ++ /* empty */ { Select->add_index_hint(thd, NULL, 0); } + | key_usage_list {} + ; + + key_usage_element: + ident +- { Select->add_index_hint(YYTHD, $1.str, $1.length); } ++ { Select->add_index_hint(thd, $1.str, $1.length); } + | PRIMARY_SYM +- { Select->add_index_hint(YYTHD, (char *)"PRIMARY", 7); } ++ { Select->add_index_hint(thd, (char *)"PRIMARY", 7); } + ; + + key_usage_list: +@@ -8952,7 +8920,7 @@ + { + if (!($$= new List)) + MYSQL_YYABORT; +- String *s= new (YYTHD->mem_root) String((const char *) $1.str, ++ String *s= new (thd->mem_root) String((const char *) $1.str, + $1.length, + system_charset_info); + if (s == NULL) +@@ -8961,7 +8929,7 @@ + } + | using_list ',' ident + { +- String *s= new (YYTHD->mem_root) String((const char *) $3.str, ++ String *s= new (thd->mem_root) String((const char *) $3.str, + $3.length, + system_charset_info); + if (s == NULL) +@@ -9002,7 +8970,7 @@ + implementation without changing its + resolution. + */ +- WARN_DEPRECATED(yythd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND"); ++ WARN_DEPRECATED(thd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND"); + } + ; + +@@ -9086,7 +9054,6 @@ + } + | /* empty */ + { +- THD *thd= YYTHD; + Lex->escape_used= FALSE; + $$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ? + new (thd->mem_root) Item_string("", 0, &my_charset_latin1) : +@@ -9107,9 +9074,9 @@ + + group_list: + group_list ',' order_ident order_dir +- { if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; } ++ { if (add_group_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; } + | order_ident order_dir +- { if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; } ++ { if (add_group_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } + ; + + olap_opt: +@@ -9156,7 +9123,6 @@ + alter_order_item: + simple_ident_nospvar order_dir + { +- THD *thd= YYTHD; + bool ascending= ($2 == 1) ? true : false; + if (add_order_to_list(thd, $1, ascending)) + MYSQL_YYABORT; +@@ -9209,9 +9175,9 @@ + + order_list: + order_list ',' order_ident order_dir +- { if (add_order_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; } ++ { if (add_order_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; } + | order_ident order_dir +- { if (add_order_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; } ++ { if (add_order_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } + ; + + order_dir: +@@ -9271,19 +9237,19 @@ + } + | ULONGLONG_NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | LONG_NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -9365,7 +9331,7 @@ + lex->proc_list.elements=0; + lex->proc_list.first=0; + lex->proc_list.next= &lex->proc_list.first; +- Item_field *item= new (YYTHD->mem_root) ++ Item_field *item= new (thd->mem_root) + Item_field(&lex->current_select->context, + NULL, NULL, $2.str); + if (item == NULL) +@@ -9390,8 +9356,7 @@ + procedure_item: + remember_name expr remember_end + { +- THD *thd= YYTHD; +- ++ + if (add_proc_to_list(thd, $2)) + MYSQL_YYABORT; + if (!$2->name) +@@ -9560,7 +9525,6 @@ + } + | DROP FUNCTION_SYM if_exists ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + sp_name *spname; + if ($4.str && check_db_name(&$4)) +@@ -9583,7 +9547,6 @@ + } + | DROP FUNCTION_SYM if_exists ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + LEX_STRING db= {0, 0}; + sp_name *spname; +@@ -9664,7 +9627,7 @@ + table_name: + table_ident + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING)) ++ if (!Select->add_table_to_list(thd, $1, NULL, TL_OPTION_UPDATING)) + MYSQL_YYABORT; + } + ; +@@ -9677,7 +9640,7 @@ + table_alias_ref: + table_ident_opt_wild + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, ++ if (!Select->add_table_to_list(thd, $1, NULL, + TL_OPTION_UPDATING | TL_OPTION_ALIAS, + Lex->lock_option )) + MYSQL_YYABORT; +@@ -9868,7 +9831,7 @@ + expr { $$= $1;} + | DEFAULT + { +- $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context()); ++ $$= new (thd->mem_root) Item_default_value(Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -9922,7 +9885,7 @@ + update_elem: + simple_ident_nospvar equal expr_or_default + { +- if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3)) ++ if (add_item_to_list(thd, $1) || add_value_to_list(thd, $3)) + MYSQL_YYABORT; + } + ; +@@ -9965,7 +9928,7 @@ + single_multi: + FROM table_ident + { +- if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING, ++ if (!Select->add_table_to_list(thd, $2, NULL, TL_OPTION_UPDATING, + Lex->lock_option)) + MYSQL_YYABORT; + } +@@ -9998,7 +9961,7 @@ + Table_ident *ti= new Table_ident($1); + if (ti == NULL) + MYSQL_YYABORT; +- if (!Select->add_table_to_list(YYTHD, ++ if (!Select->add_table_to_list(thd, + ti, + $3, + TL_OPTION_UPDATING | TL_OPTION_ALIAS, +@@ -10007,10 +9970,10 @@ + } + | ident '.' ident opt_wild opt_table_alias + { +- Table_ident *ti= new Table_ident(YYTHD, $1, $3, 0); ++ Table_ident *ti= new Table_ident(thd, $1, $3, 0); + if (ti == NULL) + MYSQL_YYABORT; +- if (!Select->add_table_to_list(YYTHD, ++ if (!Select->add_table_to_list(thd, + ti, + $5, + TL_OPTION_UPDATING | TL_OPTION_ALIAS, +@@ -10130,7 +10093,7 @@ + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_DATABASES; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA)) ++ if (prepare_schema_table(thd, lex, 0, SCH_SCHEMATA)) + MYSQL_YYABORT; + } + | opt_full TABLES opt_db wild_and_where +@@ -10138,7 +10101,7 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TABLES; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES)) + MYSQL_YYABORT; + } + | opt_full TRIGGERS_SYM opt_db wild_and_where +@@ -10146,7 +10109,7 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TRIGGERS; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_TRIGGERS)) + MYSQL_YYABORT; + } + | EVENTS_SYM opt_db wild_and_where +@@ -10154,7 +10117,7 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_EVENTS; + lex->select_lex.db= $2; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_EVENTS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_EVENTS)) + MYSQL_YYABORT; + } + | TABLE_SYM STATUS_SYM opt_db wild_and_where +@@ -10162,7 +10125,7 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TABLE_STATUS; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_TABLES)) + MYSQL_YYABORT; + } + | OPEN_SYM TABLES opt_db wild_and_where +@@ -10170,22 +10133,22 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_OPEN_TABLES; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES)) + MYSQL_YYABORT; + } + | opt_full PLUGIN_SYM + { + LEX *lex= Lex; +- WARN_DEPRECATED(yythd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'"); ++ WARN_DEPRECATED(thd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'"); + lex->sql_command= SQLCOM_SHOW_PLUGINS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS)) + MYSQL_YYABORT; + } + | PLUGINS_SYM + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_PLUGINS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS)) + MYSQL_YYABORT; + } + | ENGINE_SYM known_storage_engines show_engine_param +@@ -10198,7 +10161,7 @@ + lex->sql_command= SQLCOM_SHOW_FIELDS; + if ($5) + $4->change_db($5); +- if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS)) ++ if (prepare_schema_table(thd, lex, $4, SCH_COLUMNS)) + MYSQL_YYABORT; + } + | NEW_SYM MASTER_SYM FOR_SYM SLAVE +@@ -10233,7 +10196,7 @@ + lex->sql_command= SQLCOM_SHOW_KEYS; + if ($4) + $3->change_db($4); +- if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS)) ++ if (prepare_schema_table(thd, lex, $3, SCH_STATISTICS)) + MYSQL_YYABORT; + } + | COLUMN_SYM TYPES_SYM +@@ -10245,15 +10208,15 @@ + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; +- WARN_DEPRECATED(yythd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'"); +- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES)) ++ WARN_DEPRECATED(thd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'"); ++ if (prepare_schema_table(thd, lex, 0, SCH_ENGINES)) + MYSQL_YYABORT; + } + | opt_storage ENGINES_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_ENGINES)) + MYSQL_YYABORT; + } + | AUTHORS_SYM +@@ -10285,7 +10248,7 @@ + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_PROFILE; +- if (prepare_schema_table(YYTHD, lex, NULL, SCH_PROFILES) != 0) ++ if (prepare_schema_table(thd, lex, NULL, SCH_PROFILES) != 0) + YYABORT; + } + | opt_var_type STATUS_SYM wild_and_where +@@ -10293,7 +10256,7 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS; + lex->option_type= $1; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_STATUS)) + MYSQL_YYABORT; + } + | INNOBASE_SYM STATUS_SYM +@@ -10301,24 +10264,24 @@ + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_ENGINE_STATUS; + if (!(lex->create_info.db_type= +- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB))) ++ ha_resolve_by_legacy_type(thd, DB_TYPE_INNODB))) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB"); + MYSQL_YYABORT; + } +- WARN_DEPRECATED(yythd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'"); ++ WARN_DEPRECATED(thd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'"); + } + | MUTEX_SYM STATUS_SYM + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX; + if (!(lex->create_info.db_type= +- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB))) ++ ha_resolve_by_legacy_type(thd, DB_TYPE_INNODB))) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB"); + MYSQL_YYABORT; + } +- WARN_DEPRECATED(yythd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'"); ++ WARN_DEPRECATED(thd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'"); + } + | opt_full PROCESSLIST_SYM + { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;} +@@ -10327,21 +10290,21 @@ + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_VARIABLES; + lex->option_type= $1; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_VARIABLES)) + MYSQL_YYABORT; + } + | charset wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_CHARSETS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_CHARSETS)) + MYSQL_YYABORT; + } + | COLLATION_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_COLLATIONS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_COLLATIONS)) + MYSQL_YYABORT; + } + | GRANTS +@@ -10371,7 +10334,7 @@ + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; +- if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0)) ++ if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0)) + MYSQL_YYABORT; + lex->only_view= 0; + lex->create_info.storage_media= HA_SM_DEFAULT; +@@ -10380,7 +10343,7 @@ + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; +- if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0)) ++ if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0)) + MYSQL_YYABORT; + lex->only_view= 1; + } +@@ -10416,14 +10379,14 @@ + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_PROC; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)) + MYSQL_YYABORT; + } + | FUNCTION_SYM STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_FUNC; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)) + MYSQL_YYABORT; + } + | PROCEDURE CODE_SYM sp_name +@@ -10501,7 +10464,7 @@ + /* empty */ + | LIKE TEXT_STRING_sys + { +- Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length, ++ Lex->wild= new (thd->mem_root) String($2.str, $2.length, + system_charset_info); + if (Lex->wild == NULL) + MYSQL_YYABORT; +@@ -10525,7 +10488,7 @@ + lex->sql_command= SQLCOM_SHOW_FIELDS; + lex->select_lex.db= 0; + lex->verbose= 0; +- if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS)) ++ if (prepare_schema_table(thd, lex, $2, SCH_COLUMNS)) + MYSQL_YYABORT; + } + opt_describe_column {} +@@ -10554,7 +10517,7 @@ + | text_string { Lex->wild= $1; } + | ident + { +- Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str, ++ Lex->wild= new (thd->mem_root) String((const char*) $1.str, + $1.length, + system_charset_info); + if (Lex->wild == NULL) +@@ -10697,7 +10660,6 @@ + load: + LOAD DATA_SYM + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + if (lex->sphead) +@@ -10711,7 +10673,7 @@ + | LOAD TABLE_SYM table_ident FROM MASTER_SYM + { + LEX *lex=Lex; +- WARN_DEPRECATED(yythd, "6.0", "LOAD TABLE FROM MASTER", ++ WARN_DEPRECATED(thd, "6.0", "LOAD TABLE FROM MASTER", + "MySQL Administrator (mysqldump, mysql)"); + if (lex->sphead) + { +@@ -10719,7 +10681,7 @@ + MYSQL_YYABORT; + } + lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; +- if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) ++ if (!Select->add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING)) + MYSQL_YYABORT; + } + ; +@@ -10739,7 +10701,7 @@ + opt_duplicate INTO TABLE_SYM table_ident + { + LEX *lex=Lex; +- if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING, ++ if (!Select->add_table_to_list(thd, $9, NULL, TL_OPTION_UPDATING, + lex->lock_option)) + MYSQL_YYABORT; + lex->field_list.empty(); +@@ -10754,7 +10716,7 @@ + | FROM MASTER_SYM + { + Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; +- WARN_DEPRECATED(yythd, "6.0", "LOAD DATA FROM MASTER", ++ WARN_DEPRECATED(thd, "6.0", "LOAD DATA FROM MASTER", + "mysqldump or future " + "BACKUP/RESTORE DATABASE facility"); + } +@@ -10872,7 +10834,7 @@ + simple_ident_nospvar {$$= $1;} + | '@' ident_or_text + { +- $$= new (YYTHD->mem_root) Item_user_var_as_out_param($2); ++ $$= new (thd->mem_root) Item_user_var_as_out_param($2); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -10889,7 +10851,6 @@ + TEXT_STRING + { + LEX_STRING tmp; +- THD *thd= YYTHD; + CHARSET_INFO *cs_con= thd->variables.collation_connection; + CHARSET_INFO *cs_cli= thd->variables.character_set_client; + uint repertoire= thd->lex->text_string_is_7bit && +@@ -10915,7 +10876,7 @@ + uint repertoire= Lex->text_string_is_7bit ? + MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; + DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info)); +- $$= new (YYTHD->mem_root) Item_string($1.str, $1.length, ++ $$= new (thd->mem_root) Item_string($1.str, $1.length, + national_charset_info, + DERIVATION_COERCIBLE, + repertoire); +@@ -10924,7 +10885,7 @@ + } + | UNDERSCORE_CHARSET TEXT_STRING + { +- Item_string *str= new (YYTHD->mem_root) Item_string($2.str, ++ Item_string *str= new (thd->mem_root) Item_string($2.str, + $2.length, $1); + if (str == NULL) + MYSQL_YYABORT; +@@ -10943,7 +10904,7 @@ + If the string has been pure ASCII so far, + check the new part. + */ +- CHARSET_INFO *cs= YYTHD->variables.collation_connection; ++ CHARSET_INFO *cs= thd->variables.collation_connection; + item->collation.repertoire|= my_string_repertoire(cs, + $2.str, + $2.length); +@@ -10954,15 +10915,15 @@ + text_string: + TEXT_STRING_literal + { +- $$= new (YYTHD->mem_root) String($1.str, ++ $$= new (thd->mem_root) String($1.str, + $1.length, +- YYTHD->variables.collation_connection); ++ thd->variables.collation_connection); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HEX_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_hex_string($1.str, $1.length); ++ Item *tmp= new (thd->mem_root) Item_hex_string($1.str, $1.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -10974,7 +10935,7 @@ + } + | BIN_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length); ++ Item *tmp= new (thd->mem_root) Item_bin_string($1.str, $1.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -10989,7 +10950,6 @@ + param_marker: + PARAM_MARKER + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + Item_param *item; +@@ -11022,38 +10982,38 @@ + | NUM_literal { $$ = $1; } + | NULL_SYM + { +- $$ = new (YYTHD->mem_root) Item_null(); ++ $$ = new (thd->mem_root) Item_null(); + if ($$ == NULL) + MYSQL_YYABORT; + YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT; + } + | FALSE_SYM + { +- $$= new (YYTHD->mem_root) Item_int((char*) "FALSE",0,1); ++ $$= new (thd->mem_root) Item_int((char*) "FALSE",0,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRUE_SYM + { +- $$= new (YYTHD->mem_root) Item_int((char*) "TRUE",1,1); ++ $$= new (thd->mem_root) Item_int((char*) "TRUE",1,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HEX_NUM + { +- $$ = new (YYTHD->mem_root) Item_hex_string($1.str, $1.length); ++ $$ = new (thd->mem_root) Item_hex_string($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIN_NUM + { +- $$= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length); ++ $$= new (thd->mem_root) Item_bin_string($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | UNDERSCORE_CHARSET HEX_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_hex_string($2.str, $2.length); ++ Item *tmp= new (thd->mem_root) Item_hex_string($2.str, $2.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -11064,7 +11024,7 @@ + String *str= tmp->val_str((String*) 0); + + Item_string *item_str; +- item_str= new (YYTHD->mem_root) ++ item_str= new (thd->mem_root) + Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, +@@ -11082,7 +11042,7 @@ + } + | UNDERSCORE_CHARSET BIN_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_bin_string($2.str, $2.length); ++ Item *tmp= new (thd->mem_root) Item_bin_string($2.str, $2.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -11093,7 +11053,7 @@ + String *str= tmp->val_str((String*) 0); + + Item_string *item_str; +- item_str= new (YYTHD->mem_root) ++ item_str= new (thd->mem_root) + Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, +@@ -11117,7 +11077,7 @@ + NUM + { + int error; +- $$= new (YYTHD->mem_root) ++ $$= new (thd->mem_root) + Item_int($1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); +@@ -11127,7 +11087,7 @@ + | LONG_NUM + { + int error; +- $$= new (YYTHD->mem_root) ++ $$= new (thd->mem_root) + Item_int($1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); +@@ -11136,23 +11096,23 @@ + } + | ULONGLONG_NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DECIMAL_NUM + { +- $$= new (YYTHD->mem_root) Item_decimal($1.str, $1.length, +- YYTHD->charset()); +- if (($$ == NULL) || (YYTHD->is_error())) ++ $$= new (thd->mem_root) Item_decimal($1.str, $1.length, ++ thd->charset()); ++ if (($$ == NULL) || (thd->is_error())) + { + MYSQL_YYABORT; + } + } + | FLOAT_NUM + { +- $$= new (YYTHD->mem_root) Item_float($1.str, $1.length); +- if (($$ == NULL) || (YYTHD->is_error())) ++ $$= new (thd->mem_root) Item_float($1.str, $1.length); ++ if (($$ == NULL) || (thd->is_error())) + { + MYSQL_YYABORT; + } +@@ -11172,7 +11132,7 @@ + ident '.' '*' + { + SELECT_LEX *sel= Select; +- $$= new (YYTHD->mem_root) Item_field(Lex->current_context(), ++ $$= new (thd->mem_root) Item_field(Lex->current_context(), + NullS, $1.str, "*"); + if ($$ == NULL) + MYSQL_YYABORT; +@@ -11180,7 +11140,6 @@ + } + | ident '.' ident '.' '*' + { +- THD *thd= YYTHD; + SELECT_LEX *sel= Select; + const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ? + NullS : $1.str; +@@ -11200,7 +11159,6 @@ + simple_ident: + ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_variable_t *spv; +@@ -11251,7 +11209,6 @@ + simple_ident_nospvar: + ident + { +- THD *thd= YYTHD; + SELECT_LEX *sel=Select; + if ((sel->parsing_place != IN_HAVING) || + (sel->get_in_sum_expr() > 0)) +@@ -11273,7 +11230,6 @@ + simple_ident_q: + ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + /* +@@ -11352,7 +11308,6 @@ + } + | '.' ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + SELECT_LEX *sel= lex->current_select; + if (sel->no_table_names_allowed) +@@ -11377,7 +11332,6 @@ + } + | ident '.' ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + SELECT_LEX *sel= lex->current_select; + const char* schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ? +@@ -11445,7 +11399,7 @@ + } + | ident '.' ident + { +- $$= new Table_ident(YYTHD, $1,$3,0); ++ $$= new Table_ident(thd, $1,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -11467,7 +11421,7 @@ + } + | ident '.' ident opt_wild + { +- $$= new Table_ident(YYTHD, $1,$3,0); ++ $$= new Table_ident(thd, $1,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -11477,7 +11431,7 @@ + ident + { + LEX_STRING db={(char*) any_db,3}; +- $$= new Table_ident(YYTHD, db,$1,0); ++ $$= new Table_ident(thd, db,$1,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -11487,8 +11441,7 @@ + IDENT { $$= $1; } + | IDENT_QUOTED + { +- THD *thd= YYTHD; +- ++ + if (thd->charset_is_system_charset) + { + CHARSET_INFO *cs= system_charset_info; +@@ -11516,8 +11469,6 @@ + TEXT_STRING_sys: + TEXT_STRING + { +- THD *thd= YYTHD; +- + if (thd->charset_is_system_charset) + $$= $1; + else +@@ -11532,8 +11483,6 @@ + TEXT_STRING_literal: + TEXT_STRING + { +- THD *thd= YYTHD; +- + if (thd->charset_is_collation_connection) + $$= $1; + else +@@ -11548,8 +11497,6 @@ + TEXT_STRING_filesystem: + TEXT_STRING + { +- THD *thd= YYTHD; +- + if (thd->charset_is_character_set_filesystem) + $$= $1; + else +@@ -11566,7 +11513,6 @@ + IDENT_sys { $$=$1; } + | keyword + { +- THD *thd= YYTHD; + $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; +@@ -11578,7 +11524,6 @@ + IDENT_sys { $$=$1; } + | keyword_sp + { +- THD *thd= YYTHD; + $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; +@@ -11595,7 +11540,6 @@ + user: + ident_or_text + { +- THD *thd= YYTHD; + if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + MYSQL_YYABORT; + $$->user = $1; +@@ -11609,7 +11553,6 @@ + } + | ident_or_text '@' ident_or_text + { +- THD *thd= YYTHD; + if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + MYSQL_YYABORT; + $$->user = $1; $$->host=$3; +@@ -11628,7 +11571,7 @@ + } + | CURRENT_USER optional_braces + { +- if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user)))) ++ if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + MYSQL_YYABORT; + /* + empty LEX_USER means current_user and +@@ -11991,7 +11934,6 @@ + + option_type_value: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -12022,7 +11964,6 @@ + } + ext_option_value + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -12105,7 +12046,6 @@ + sys_option_value: + option_type internal_variable_name equal set_expr_or_default + { +- THD *thd= YYTHD; + LEX *lex= Lex; + LEX_STRING *name= &$2.base_name; + +@@ -12117,7 +12057,7 @@ + my_parse_error(ER(ER_SYNTAX_ERROR)); + MYSQL_YYABORT; + } +- if (set_trigger_new_row(YYTHD, name, $4)) ++ if (set_trigger_new_row(thd, name, $4)) + MYSQL_YYABORT; + } + else if ($2.var) +@@ -12147,7 +12087,6 @@ + } + | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types + { +- THD *thd= YYTHD; + LEX *lex=Lex; + lex->option_type= $1; + Item *item= new (thd->mem_root) Item_int((int32) $5); +@@ -12167,7 +12106,7 @@ + '@' ident_or_text equal expr + { + Item_func_set_user_var *item; +- item= new (YYTHD->mem_root) Item_func_set_user_var($2, $4); ++ item= new (thd->mem_root) Item_func_set_user_var($2, $4); + if (item == NULL) + MYSQL_YYABORT; + set_var_user *var= new set_var_user(item); +@@ -12177,7 +12116,6 @@ + } + | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default + { +- THD *thd= YYTHD; + struct sys_var_with_base tmp= $4; + /* Lookup if necessary: must be a system variable. */ + if (tmp.var == NULL) +@@ -12190,7 +12128,6 @@ + } + | charset old_or_new_charset_name_or_default + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + CHARSET_INFO *cs2; + cs2= $2 ? $2: global_system_variables.character_set_client; +@@ -12238,7 +12175,6 @@ + } + | PASSWORD equal text_or_password + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + LEX_USER *user; + sp_pcontext *spc= lex->spcont; +@@ -12278,7 +12214,6 @@ + internal_variable_name: + ident + { +- THD *thd= YYTHD; + sp_pcontext *spc= thd->lex->spcont; + sp_variable_t *spv; + +@@ -12337,7 +12272,7 @@ + } + else + { +- sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length); ++ sys_var *tmp=find_sys_var(thd, $3.str, $3.length); + if (!tmp) + MYSQL_YYABORT; + if (!tmp->is_struct()) +@@ -12348,7 +12283,7 @@ + } + | DEFAULT '.' ident + { +- sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length); ++ sys_var *tmp=find_sys_var(thd, $3.str, $3.length); + if (!tmp) + MYSQL_YYABORT; + if (!tmp->is_struct()) +@@ -12370,16 +12305,16 @@ + TEXT_STRING { $$=$1.str;} + | PASSWORD '(' TEXT_STRING ')' + { +- $$= $3.length ? YYTHD->variables.old_passwords ? +- Item_func_old_password::alloc(YYTHD, $3.str, $3.length) : +- Item_func_password::alloc(YYTHD, $3.str, $3.length) : ++ $$= $3.length ? thd->variables.old_passwords ? ++ Item_func_old_password::alloc(thd, $3.str, $3.length) : ++ Item_func_password::alloc(thd, $3.str, $3.length) : + $3.str; + if ($$ == NULL) + MYSQL_YYABORT; + } + | OLD_PASSWORD '(' TEXT_STRING ')' + { +- $$= $3.length ? Item_func_old_password::alloc(YYTHD, $3.str, ++ $$= $3.length ? Item_func_old_password::alloc(thd, $3.str, + $3.length) : + $3.str; + if ($$ == NULL) +@@ -12393,19 +12328,19 @@ + | DEFAULT { $$=0; } + | ON + { +- $$=new (YYTHD->mem_root) Item_string("ON", 2, system_charset_info); ++ $$=new (thd->mem_root) Item_string("ON", 2, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ALL + { +- $$=new (YYTHD->mem_root) Item_string("ALL", 3, system_charset_info); ++ $$=new (thd->mem_root) Item_string("ALL", 3, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BINARY + { +- $$=new (YYTHD->mem_root) Item_string("binary", 6, system_charset_info); ++ $$=new (thd->mem_root) Item_string("binary", 6, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -12443,7 +12378,7 @@ + table_ident opt_table_alias lock_option + { + thr_lock_type lock_type= (thr_lock_type) $3; +- if (!Select->add_table_to_list(YYTHD, $1, $2, 0, lock_type)) ++ if (!Select->add_table_to_list(thd, $1, $2, 0, lock_type)) + MYSQL_YYABORT; + /* If table is to be write locked, protect from a impending GRL. */ + if (lock_type >= TL_WRITE_ALLOW_WRITE) +@@ -12514,7 +12449,7 @@ + lex->expr_allows_subselect= FALSE; + lex->sql_command = SQLCOM_HA_READ; + lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */ +- Item *one= new (YYTHD->mem_root) Item_int((int32) 1); ++ Item *one= new (thd->mem_root) Item_int((int32) 1); + if (one == NULL) + MYSQL_YYABORT; + lex->current_select->select_limit= one; +@@ -12836,10 +12771,10 @@ + $$=$1; $1->password=$4; + if ($4.length) + { +- if (YYTHD->variables.old_passwords) ++ if (thd->variables.old_passwords) + { + char *buff= +- (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); ++ (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); + if (buff == NULL) + MYSQL_YYABORT; + my_make_scrambled_password_323(buff, $4.str, $4.length); +@@ -12849,7 +12784,7 @@ + else + { + char *buff= +- (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); ++ (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); + if (buff == NULL) + MYSQL_YYABORT; + my_make_scrambled_password(buff, $4.str, $4.length); +@@ -12881,7 +12816,7 @@ + column_list_id: + ident + { +- String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); ++ String *new_str = new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info); + if (new_str == NULL) + MYSQL_YYABORT; + List_iterator iter(Lex->columns); +@@ -12981,14 +12916,14 @@ + + opt_chain: + /* empty */ +- { $$= (YYTHD->variables.completion_type == 1); } ++ { $$= (thd->variables.completion_type == 1); } + | AND_SYM NO_SYM CHAIN_SYM { $$=0; } + | AND_SYM CHAIN_SYM { $$=1; } + ; + + opt_release: + /* empty */ +- { $$= (YYTHD->variables.completion_type == 2); } ++ { $$= (thd->variables.completion_type == 2); } + | RELEASE_SYM { $$=1; } + | NO_SYM RELEASE_SYM { $$=0; } + ; +@@ -13102,7 +13037,6 @@ + + union_order_or_limit: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE); + SELECT_LEX *sel= lex->current_select; +@@ -13118,7 +13052,6 @@ + } + order_or_limit + { +- THD *thd= YYTHD; + thd->lex->current_select->no_table_names_allowed= 0; + thd->where= ""; + } +@@ -13255,14 +13188,14 @@ + from older master servers (i.e. to create non-suid trigger in this + case). + */ +- YYTHD->lex->definer= 0; ++ thd->lex->definer= 0; + } + ; + + definer: + DEFINER_SYM EQ user + { +- YYTHD->lex->definer= get_current_user(YYTHD, $3); ++ thd->lex->definer= get_current_user(thd, $3); + } + ; + +@@ -13307,7 +13240,6 @@ + view_tail: + view_suid VIEW_SYM table_ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_CREATE_VIEW; + /* first table in list is target VIEW name */ +@@ -13347,7 +13279,6 @@ + } + view_select_aux view_check_option + { +- THD *thd= YYTHD; + LEX *lex= Lex; + uint len= YYLIP->get_cpp_ptr() - lex->create_view_select.str; + void *create_view_select= thd->memdup(lex->create_view_select.str, len); +@@ -13403,7 +13334,6 @@ + EACH_SYM + ROW_SYM + { /* $15 */ +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp; +@@ -13437,8 +13367,8 @@ + sp_head *sp= lex->sphead; + + lex->sql_command= SQLCOM_CREATE_TRIGGER; +- sp->set_stmt_end(YYTHD); +- sp->restore_thd_mem_root(YYTHD); ++ sp->set_stmt_end(thd); ++ sp->restore_thd_mem_root(thd); + + if (sp->is_not_allowed_in_function("trigger")) + MYSQL_YYABORT; +@@ -13448,7 +13378,7 @@ + sp_proc_stmt alternatives are not saving/restoring LEX, so + lex->query_tables can be wiped out. + */ +- if (!lex->select_lex.add_table_to_list(YYTHD, $9, ++ if (!lex->select_lex.add_table_to_list(thd, $9, + (LEX_STRING*) 0, + TL_OPTION_UPDATING, + TL_IGNORE)) +@@ -13466,7 +13396,6 @@ + AGGREGATE_SYM remember_name FUNCTION_SYM ident + RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + if (is_native_function(thd, & $4)) + { +@@ -13484,7 +13413,6 @@ + | remember_name FUNCTION_SYM ident + RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + if (is_native_function(thd, & $3)) + { +@@ -13507,7 +13435,6 @@ + sp_name /* $3 */ + '(' /* $4 */ + { /* $5 */ +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp; +@@ -13565,7 +13492,7 @@ + MYSQL_YYABORT; + } + +- if (sp->fill_field_definition(YYTHD, lex, ++ if (sp->fill_field_definition(thd, lex, + (enum enum_field_types) $11, + &sp->m_return_field_def)) + MYSQL_YYABORT; +@@ -13574,7 +13501,6 @@ + } + sp_c_chistics /* $13 */ + { /* $14 */ +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -13583,7 +13509,6 @@ + } + sp_proc_stmt /* $15 */ + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + sp_head *sp= lex->sphead; + +@@ -13654,10 +13579,10 @@ + sp= new sp_head(); + if (sp == NULL) + MYSQL_YYABORT; +- sp->reset_thd_mem_root(YYTHD); ++ sp->reset_thd_mem_root(thd); + sp->init(lex); + sp->m_type= TYPE_ENUM_PROCEDURE; +- sp->init_sp_name(YYTHD, $3); ++ sp->init_sp_name(thd, $3); + + lex->sphead= sp; + } +@@ -13672,7 +13597,6 @@ + sp_pdparam_list + ')' + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + lex->sphead->m_param_end= YYLIP->get_cpp_tok_start(); +@@ -13680,7 +13604,6 @@ + } + sp_c_chistics + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + lex->sphead->m_chistics= &lex->sp_chistics; +@@ -13691,9 +13614,9 @@ + LEX *lex= Lex; + sp_head *sp= lex->sphead; + +- sp->set_stmt_end(YYTHD); ++ sp->set_stmt_end(thd); + lex->sql_command= SQLCOM_CREATE_PROCEDURE; +- sp->restore_thd_mem_root(YYTHD); ++ sp->restore_thd_mem_root(thd); + } + ; + +@@ -13730,21 +13653,21 @@ + text_string + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE); +- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) ++ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))) + MYSQL_YYABORT; + Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0); + } + | text_string ',' text_string + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); +- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) ++ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))) + MYSQL_YYABORT; + Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length()); + } + | text_string ',' text_string ',' ulong_num + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); +- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) ++ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))) + MYSQL_YYABORT; + Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length()); + } diff --git a/package/mysql/0006-no-force-static-build.patch b/package/mysql/0006-no-force-static-build.patch new file mode 100644 index 0000000000..8172a9848e --- /dev/null +++ b/package/mysql/0006-no-force-static-build.patch @@ -0,0 +1,18 @@ +configure: do not force a static link for non-installed programs + +Otherwise, it tries to link against a static libz, which may not exist +in a shared-only system. + +Signed-off-by: "Yann E. MORIN" + +diff -durN mysql-5.1.73.orig/configure.in mysql-5.1.73/configure.in +--- mysql-5.1.73.orig/configure.in 2014-12-22 00:04:46.550508208 +0100 ++++ mysql-5.1.73/configure.in 2014-12-22 00:05:56.415307480 +0100 +@@ -562,7 +562,6 @@ + AC_MSG_ERROR([MySQL requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.]) + fi + +-NOINST_LDFLAGS="-static" + + static_nss="" + STATIC_NSS_FLAGS="" diff --git a/package/mysql/0007-dont-install-in-mysql-directory.patch b/package/mysql/0007-dont-install-in-mysql-directory.patch new file mode 100644 index 0000000000..971b9ceeb5 --- /dev/null +++ b/package/mysql/0007-dont-install-in-mysql-directory.patch @@ -0,0 +1,182 @@ +Don't install in mysql directory + +Installing libraries in a subdirectory of /usr/lib leads to no end of +trouble. It requires either setting a RUN_PATH in the ELF files linked +with it or adding the path to ld.so.conf and calling ldconfig on the +target. + +So to simplify things, put everything in /usr/lib instead of +/usr/lib/mysql + +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) + +diff -Nrup mysql-5.1.73.orig/dbug/Makefile.am mysql-5.1.73/dbug/Makefile.am +--- mysql-5.1.73.orig/dbug/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/dbug/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -17,7 +17,7 @@ + + INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include + LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a +-pkglib_LIBRARIES = libdbug.a ++lib_LIBRARIES = libdbug.a + noinst_HEADERS = dbug_long.h + libdbug_a_SOURCES = dbug.c sanity.c + EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \ +diff -Nrup mysql-5.1.73.orig/libmysql/Makefile.shared mysql-5.1.73/libmysql/Makefile.shared +--- mysql-5.1.73.orig/libmysql/Makefile.shared 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/libmysql/Makefile.shared 2015-12-14 00:34:58.567937603 +0100 +@@ -25,7 +25,7 @@ MYSQLBASEdir= $(prefix) + ## We'll use CLIENT_EXTRA_LDFLAGS for threaded and non-threaded + ## until someone complains that they need separate options. + LDADD = @CLIENT_EXTRA_LDFLAGS@ $(target) +-pkglib_LTLIBRARIES = $(target) ++lib_LTLIBRARIES = $(target) + + noinst_PROGRAMS = conf_to_src + +diff -Nrup mysql-5.1.73.orig/libmysqld/Makefile.am mysql-5.1.73/libmysqld/Makefile.am +--- mysql-5.1.73.orig/libmysqld/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/libmysqld/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -38,7 +38,7 @@ INCLUDES= -I$(top_builddir)/include -I$ + @condition_dependent_plugin_includes@ + + noinst_LIBRARIES = libmysqld_int.a +-pkglib_LIBRARIES = libmysqld.a ++lib_LIBRARIES = libmysqld.a + SUBDIRS = . examples + libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc + libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ +diff -Nrup mysql-5.1.73.orig/mysys/Makefile.am mysql-5.1.73/mysys/Makefile.am +--- mysql-5.1.73.orig/mysys/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/mysys/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -18,7 +18,7 @@ MYSQLSHAREdir = $(pkgdatadir) + MYSQLBASEdir= $(prefix) + INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \ + -I$(top_srcdir)/include -I$(srcdir) +-pkglib_LIBRARIES = libmysys.a ++lib_LIBRARIES = libmysys.a + LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a + noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h + libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ +diff -Nrup mysql-5.1.73.orig/storage/csv/Makefile.am mysql-5.1.73/storage/csv/Makefile.am +--- mysql-5.1.73.orig/storage/csv/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/storage/csv/Makefile.am 2015-12-14 00:34:58.563937596 +0100 +@@ -30,7 +30,7 @@ DEFS = @DEFS@ + noinst_HEADERS = ha_tina.h transparent_file.h + + EXTRA_LTLIBRARIES = ha_csv.la +-pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ++lib_LTLIBRARIES = @plugin_csv_shared_target@ + ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) + ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN + ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc +diff -Nrup mysql-5.1.73.orig/storage/heap/Makefile.am mysql-5.1.73/storage/heap/Makefile.am +--- mysql-5.1.73.orig/storage/heap/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/storage/heap/Makefile.am 2015-12-14 00:34:58.563937596 +0100 +@@ -26,7 +26,7 @@ WRAPLIBS= + LDADD = + + DEFS = @DEFS@ +-pkglib_LIBRARIES = libheap.a ++lib_LIBRARIES = libheap.a + noinst_PROGRAMS = hp_test1 hp_test2 + noinst_LIBRARIES = libheap.a + hp_test1_LDFLAGS = @NOINST_LDFLAGS@ +diff -Nrup mysql-5.1.73.orig/storage/myisam/Makefile.am mysql-5.1.73/storage/myisam/Makefile.am +--- mysql-5.1.73.orig/storage/myisam/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/storage/myisam/Makefile.am 2015-12-14 00:34:58.563937596 +0100 +@@ -30,7 +30,7 @@ DEFS = @DEFS@ + EXTRA_DIST = mi_test_all.sh mi_test_all.res ft_stem.c CMakeLists.txt plug.in + pkgdata_DATA = mi_test_all mi_test_all.res + +-pkglib_LIBRARIES = libmyisam.a ++lib_LIBRARIES = libmyisam.a + bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump + myisamchk_DEPENDENCIES= $(LIBRARIES) + myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ +diff -Nrup mysql-5.1.73.orig/storage/myisammrg/Makefile.am mysql-5.1.73/storage/myisammrg/Makefile.am +--- mysql-5.1.73.orig/storage/myisammrg/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/storage/myisammrg/Makefile.am 2015-12-14 00:34:58.563937596 +0100 +@@ -26,7 +26,7 @@ WRAPLIBS= + LDADD = + + DEFS = @DEFS@ +-pkglib_LIBRARIES = libmyisammrg.a ++lib_LIBRARIES = libmyisammrg.a + noinst_HEADERS = myrg_def.h ha_myisammrg.h + noinst_LIBRARIES = libmyisammrg.a + libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ +diff -Nrup mysql-5.1.73.orig/strings/Makefile.am mysql-5.1.73/strings/Makefile.am +--- mysql-5.1.73.orig/strings/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/strings/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -16,7 +16,7 @@ + # This file is public domain and comes with NO WARRANTY of any kind + + INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include +-pkglib_LIBRARIES = libmystrings.a ++lib_LIBRARIES = libmystrings.a + + # Exact one of ASSEMBLER_X + if ASSEMBLER_x86 +@@ -69,15 +69,15 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ + + FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ + +-str_test: str_test.c $(pkglib_LIBRARIES) +- $(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(pkglib_LIBRARIES) ++str_test: str_test.c $(lib_LIBRARIES) ++ $(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(lib_LIBRARIES) + + uctypedump: uctypedump.c + $(LINK) $(INCLUDES) $(srcdir)/uctypedump.c + +-test_decimal$(EXEEXT): decimal.c $(pkglib_LIBRARIES) ++test_decimal$(EXEEXT): decimal.c $(lib_LIBRARIES) + $(CP) $(srcdir)/decimal.c ./test_decimal.c +- $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES) ++ $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(lib_LIBRARIES) + $(RM) -f ./test_decimal.c + + # Don't update the files from bitkeeper +diff -Nrup mysql-5.1.73.orig/tests/Makefile.am mysql-5.1.73/tests/Makefile.am +--- mysql-5.1.73.orig/tests/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/tests/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -51,11 +51,11 @@ mysql_client_test.o: mysql_client_fw.c + + insert_test_SOURCES= insert_test.c + select_test_SOURCES= select_test.c +-insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) +-select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) ++insert_test_DEPENDENCIES= $(LIBRARIES) $(lib_LTLIBRARIES) ++select_test_DEPENDENCIES= $(LIBRARIES) $(lib_LTLIBRARIES) + + bug25714_SOURCES= bug25714.c +-bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) ++bug25714_DEPENDENCIES= $(LIBRARIES) $(lib_LTLIBRARIES) + + # Fix for mit-threads + DEFS = -DMYSQL_CLIENT_NO_THREADS +diff -Nrup mysql-5.1.73.orig/vio/Makefile.am mysql-5.1.73/vio/Makefile.am +--- mysql-5.1.73.orig/vio/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/vio/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -16,7 +16,7 @@ + INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ + $(openssl_includes) + LDADD = @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs) +-pkglib_LIBRARIES = libvio.a ++lib_LIBRARIES = libvio.a + + noinst_HEADERS = vio_priv.h + +diff -Nrup mysql-5.1.73.orig/zlib/Makefile.am mysql-5.1.73/zlib/Makefile.am +--- mysql-5.1.73.orig/zlib/Makefile.am 2013-11-04 19:52:27.000000000 +0100 ++++ mysql-5.1.73/zlib/Makefile.am 2015-12-14 00:34:58.567937603 +0100 +@@ -19,7 +19,7 @@ INCLUDES= -I$(top_builddir)/include -I$ + + LIBS= $(NON_THREADED_LIBS) + +-pkglib_LTLIBRARIES = libz.la ++lib_LTLIBRARIES = libz.la + noinst_LTLIBRARIES = libzlt.la + + libz_la_LDFLAGS = -static diff --git a/package/mysql/S97mysqld b/package/mysql/S97mysqld new file mode 100644 index 0000000000..1d87e68d96 --- /dev/null +++ b/package/mysql/S97mysqld @@ -0,0 +1,34 @@ +#!/bin/sh + +case "$1" in + start) + if [ ! -d /var/mysql/mysql ] ; then + echo "Creating MySQL system tables..." + mysql_install_db --user=mysql --ldata=/var/mysql + fi + + # mysqld runs as user mysql, but /run is only writable by root + # so create a subdirectory for mysql. + install -d -o mysql -g root -m 0700 /run/mysql + + # We don't use start-stop-daemon because mysqld has + # its own wrapper script. + printf "Starting mysql..." + /usr/bin/mysqld_safe --pid-file=/run/mysql/mysqld.pid & + echo "done." + ;; + stop) + printf "Stopping mysql..." + if test -f /run/mysql/mysqld.pid ; then + kill `cat /run/mysql/mysqld.pid` + fi + echo "done." + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: /etc/init.d/mysqld {start|stop|restart}" + ;; +esac diff --git a/package/mysql/mysql.hash b/package/mysql/mysql.hash new file mode 100644 index 0000000000..84f3361502 --- /dev/null +++ b/package/mysql/mysql.hash @@ -0,0 +1,2 @@ +# From https://downloads.mariadb.com/archives/mysql-5.1/mysql-5.1.73.tar.gz.md5 +md5 887f869bcc757957067b9198f707f32f mysql-5.1.73.tar.gz diff --git a/package/mysql/mysqld.service b/package/mysql/mysqld.service new file mode 100644 index 0000000000..2ded9c2728 --- /dev/null +++ b/package/mysql/mysqld.service @@ -0,0 +1,10 @@ +[Unit] +Description=MySQL database server + +[Service] +ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql' +ExecStart=/usr/bin/mysqld_safe +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/package/netbsd-queue/Config.in b/package/netbsd-queue/Config.in new file mode 100644 index 0000000000..7837f4cd7f --- /dev/null +++ b/package/netbsd-queue/Config.in @@ -0,0 +1,2 @@ +config BR2_PACKAGE_NETBSD_QUEUE + bool diff --git a/package/netbsd-queue/netbsd-queue.hash b/package/netbsd-queue/netbsd-queue.hash new file mode 100644 index 0000000000..f8e2a6c598 --- /dev/null +++ b/package/netbsd-queue/netbsd-queue.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 c13407edd0e33be73cae72514cb234f8612e1c0e54401c9448daffd3a240158b queue.h?rev=1.70 diff --git a/package/netbsd-queue/netbsd-queue.mk b/package/netbsd-queue/netbsd-queue.mk new file mode 100644 index 0000000000..5fd926bba1 --- /dev/null +++ b/package/netbsd-queue/netbsd-queue.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# netbsd-queue +# +################################################################################ + +NETBSD_QUEUE_VERSION = 1.70 +NETBSD_QUEUE_SITE = http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys +NETBSD_QUEUE_SOURCE = queue.h?rev=$(NETBSD_QUEUE_VERSION) +NETBSD_QUEUE_LICENSE = BSD-3c + +NETBSD_QUEUE_ADD_TOOLCHAIN_DEPENDENCY = NO +NETBSD_QUEUE_INSTALL_STAGING = YES + +define NETBSD_QUEUE_EXTRACT_CMDS + cp $(DL_DIR)/$(NETBSD_QUEUE_SOURCE) $(@D)/queue.h +endef + +define NETBSD_QUEUE_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0644 $(@D)/queue.h \ + $(STAGING_DIR)/usr/include/sys/queue.h +endef + +$(eval $(generic-package)) diff --git a/package/network-manager/0001-platform-move-link_get_user_ipv6ll_enabled-to-nm-platform-linux.patch b/package/network-manager/0001-platform-move-link_get_user_ipv6ll_enabled-to-nm-platform-linux.patch new file mode 100644 index 0000000000..4aebaef820 --- /dev/null +++ b/package/network-manager/0001-platform-move-link_get_user_ipv6ll_enabled-to-nm-platform-linux.patch @@ -0,0 +1,87 @@ +From: Lubomir Rintel +Date: Mon, 20 Jul 2015 11:01:04 +0200 +Subject: [PATCH] platform: move link_get_user_ipv6ll_enabled() to nm-platform-linux +Source: https://mail.gnome.org/archives/networkmanager-list/2015-July/msg00028.html + +This fixes build error kernels headers < 3.17. + +Reported-by: Petr Vorel +Signed-off-by: Lubomir Rintel +Signed-off-by: Petr Vorel +--- + src/platform/nm-linux-platform.c | 16 ++++++++++++++++ + src/platform/nm-platform.c | 11 ++--------- + src/platform/nm-platform.h | 1 + + 3 files changed, 19 insertions(+), 9 deletions(-) + +diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c +index f3a9254..b6b8e33 100644 +--- a/src/platform/nm-linux-platform.c ++++ b/src/platform/nm-linux-platform.c +@@ -2987,6 +2987,21 @@ link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enable + } + + static gboolean ++link_get_user_ipv6ll_enabled (NMPlatform *platform, int ifindex) ++{ ++#if HAVE_LIBNL_INET6_ADDR_GEN_MODE ++ { ++ const NMPlatformLink *pllink; ++ ++ pllink = nm_platform_link_get (platform, ifindex); ++ if (pllink && pllink->inet6_addr_gen_mode_inv) ++ return _nm_platform_uint8_inv (pllink->inet6_addr_gen_mode_inv) == IN6_ADDR_GEN_MODE_NONE; ++ } ++#endif ++ return FALSE; ++} ++ ++static gboolean + link_supports_carrier_detect (NMPlatform *platform, int ifindex) + { + const char *name = nm_platform_link_get_name (platform, ifindex); +@@ -4968,6 +4968,7 @@ + platform_class->link_get_udev_device = link_get_udev_device; + + platform_class->link_set_user_ipv6ll_enabled = link_set_user_ipv6ll_enabled; ++ platform_class->link_get_user_ipv6ll_enabled = link_get_user_ipv6ll_enabled; + + platform_class->link_set_address = link_set_address; + platform_class->link_get_permanent_address = link_get_permanent_address; + +diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c +index 8803377..ee4b1a1 100644 +--- a/src/platform/nm-platform.c ++++ b/src/platform/nm-platform.c +@@ -965,15 +965,8 @@ + + g_return_val_if_fail (ifindex >= 0, FALSE); + +-#if HAVE_LIBNL_INET6_ADDR_GEN_MODE +- { +- const NMPlatformLink *pllink; +- +- pllink = nm_platform_link_get (self, ifindex); +- if (pllink && pllink->inet6_addr_gen_mode_inv) +- return _nm_platform_uint8_inv (pllink->inet6_addr_gen_mode_inv) == IN6_ADDR_GEN_MODE_NONE; +- } +-#endif ++ if (klass->link_get_user_ipv6ll_enabled) ++ return klass->link_get_user_ipv6ll_enabled (self, ifindex); + return FALSE; + } + +diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h +index 16eb351..9ef4080 100644 +--- a/src/platform/nm-platform.h ++++ b/src/platform/nm-platform.h +@@ -446,6 +446,7 @@ + GObject *(*link_get_udev_device) (NMPlatform *self, int ifindex); + + gboolean (*link_set_user_ipv6ll_enabled) (NMPlatform *, int ifindex, gboolean enabled); ++ gboolean (*link_get_user_ipv6ll_enabled) (NMPlatform *, int ifindex); + + gboolean (*link_get_permanent_address) (NMPlatform *, + int ifindex, +-- +2.4.3 diff --git a/package/newt/0001-Use-CC-instead-of-CPP-to-generate-.depend-files.patch b/package/newt/0001-Use-CC-instead-of-CPP-to-generate-.depend-files.patch new file mode 100644 index 0000000000..853472bfcd --- /dev/null +++ b/package/newt/0001-Use-CC-instead-of-CPP-to-generate-.depend-files.patch @@ -0,0 +1,38 @@ +From 65754effe16506a7a0a04069c8b6e1281811604d Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Sat, 10 Jan 2015 11:54:10 +0100 +Subject: [PATCH newt 1/2] Use $(CC) instead of $(CPP) to generate .depend + files + +Use $(CC) instead of $(CPP) to generate .depend file because '$(CPP) +-M' call does not support multiple input files. This avoid the +following error: + +make[1]: Entering directory `/opt/br/output/build/newt-0.51.0' +/opt/br/output/host/usr/bin/arm-none-linux-gnueabi-cpp -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -M newt.c button.c form.c checkbox.c entry.c label.c listbox.c scrollbar.c textbox.c scale.c grid.c windows.c buttonbar.c checkboxtree.c > .depend +arm-none-linux-gnueabi-cpp: too many input files +make[1]: *** [depend] Error 1 + +Signed-off-by: Samuel Martin +Signed-off-by: Yegor Yefremov +Signed-off-by: Thomas Petazzoni +--- + Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 7989203..17853e0 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -121,7 +121,7 @@ clean: + $(SHAREDDIR)/*.o *.$(SOEXT)* + + depend: +- $(CPP) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend ++ $(CC) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend + + $(SHAREDDIR): + mkdir -p $(SHAREDDIR) +-- +2.1.0 + diff --git a/package/newt/0002-Remove-bogus-I-usr-include-slang-from-CPPFLAGS.patch b/package/newt/0002-Remove-bogus-I-usr-include-slang-from-CPPFLAGS.patch new file mode 100644 index 0000000000..eb445dd8f9 --- /dev/null +++ b/package/newt/0002-Remove-bogus-I-usr-include-slang-from-CPPFLAGS.patch @@ -0,0 +1,33 @@ +From 28145b46649165b94666ee585d064b41306e10fd Mon Sep 17 00:00:00 2001 +From: Alex Suykov +Date: Sat, 10 Jan 2015 11:55:32 +0100 +Subject: [PATCH newt 2/2] Remove bogus -I/usr/include/slang from CPPFLAGS + +Hardcoding -I/usr/include/slang in CPPFLAGS is bogus for +cross-compilation. With recent versions of slang, the headers are +installed in ${sysroot}/usr/include directly, so there is no need for +an additional flag. And if one was needed, it should be added by the +configure script, after detecting the right header location. + +Signed-off-by: Alex Suykov +Signed-off-by: Thomas Petazzoni +--- + Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 17853e0..d32d784 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -5,7 +5,7 @@ CC = @CC@ + CPP = @CPP@ + CFLAGS = @CFLAGS@ + LDFLAGS = @LDFLAGS@ +-CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@ ++CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@ + GNU_LD = @GNU_LD@ + + VERSION = @VERSION@ +-- +2.1.0 + diff --git a/package/nfacct/0001-uclinux.patch b/package/nfacct/0001-uclinux.patch new file mode 100644 index 0000000000..295a370b46 --- /dev/null +++ b/package/nfacct/0001-uclinux.patch @@ -0,0 +1,26 @@ +From da1a0c186232d1bca9c723bd47d11a6e3807ae29 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Tue, 10 Sep 2013 16:16:48 -0300 +Subject: [PATCH] configure: uclinux is also linux + +Signed-off-by: Gustavo Zacarias +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 9679112..9a34bdc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -15,7 +15,7 @@ AC_PROG_INSTALL + AC_PROG_LN_S + + case "$host" in +-*-*-linux*) ;; ++*-*-linux* | *-*-uclinux*) ;; + *) AC_MSG_ERROR([Linux only, dude!]);; + esac + +-- +1.8.1.5 + diff --git a/package/nodejs/0.10.45/0001-remove-python-bz2-dependency.patch b/package/nodejs/0.10.45/0001-remove-python-bz2-dependency.patch new file mode 100644 index 0000000000..75fe437502 --- /dev/null +++ b/package/nodejs/0.10.45/0001-remove-python-bz2-dependency.patch @@ -0,0 +1,27 @@ +Remove dependency on Python bz2 module + +The Python bz2 module is only needed in certain cases, so only import +it when needed. In the normal nodejs build, this allows to remove the +dependency on this module. + +Signed-off-by: Thomas Petazzoni +Index: b/deps/v8/tools/js2c.py +=================================================================== +--- a/deps/v8/tools/js2c.py ++++ b/deps/v8/tools/js2c.py +@@ -33,7 +33,6 @@ + + import os, re, sys, string + import jsmin +-import bz2 + + + def ToCAsciiArray(lines): +@@ -344,6 +343,7 @@ + else: + raw_sources_declaration = RAW_SOURCES_COMPRESSION_DECLARATION + if env['COMPRESSION'] == 'bz2': ++ import bz2 + all_sources = bz2.compress("".join(all_sources)) + total_length = len(all_sources) + sources_data = ToCArray(all_sources) diff --git a/package/nodejs/0.10.45/0002-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/0.10.45/0002-gyp-force-link-command-to-use-CXX.patch new file mode 100644 index 0000000000..a2f02abf34 --- /dev/null +++ b/package/nodejs/0.10.45/0002-gyp-force-link-command-to-use-CXX.patch @@ -0,0 +1,26 @@ +From 00d809e9305241f8636a2d75e22c493293e6971a Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Sun, 20 Apr 2014 15:03:01 +0200 +Subject: [PATCH] gyp: force link command to use CXX + +Signed-off-by: Samuel Martin +--- + tools/gyp/pylib/gyp/generator/make.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py +index 0de510e..54e4c96 100644 +--- a/tools/gyp/pylib/gyp/generator/make.py ++++ b/tools/gyp/pylib/gyp/generator/make.py +@@ -134,7 +134,7 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + # special "figure out circular dependencies" flags around the entire + # input list during linking. + quiet_cmd_link = LINK($(TOOLSET)) $@ +-cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) ++cmd_link = $(CXX.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) + + # We support two kinds of shared objects (.so): + # 1) shared_library, which is just bundling together many dependent libraries +-- +1.9.2 + diff --git a/package/nodejs/0.10.45/0003-fix-musl-USE-MISC-build-issue.patch b/package/nodejs/0.10.45/0003-fix-musl-USE-MISC-build-issue.patch new file mode 100644 index 0000000000..128058df29 --- /dev/null +++ b/package/nodejs/0.10.45/0003-fix-musl-USE-MISC-build-issue.patch @@ -0,0 +1,47 @@ +From 0bc482abeb814573251ecafb5a1e045c885b13a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Mon, 25 May 2015 16:22:57 +0200 +Subject: [PATCH 1/1] Fix musl __USE_MISC issue +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The musl C library does not define __USE_MISC and so libuv (built-in dependency) +does not use the correct struct stat definition for musl. + +The feature test macro __USE_MISC is defined by glibc if _BSD_SOURCE or +_SVID_SOURCE is defined. + +The libuv build system enables the feature test macro _GNU_SOURCE for linux +builds. + +Since glibc 2.19, defining _GNU_SOURCE also has the effect of implicitly +defining _DEFAULT_SOURCE - the replacement for _BSD_SOURCE and _SVID_SOURCE. + +In glibc versions before 2.20, defining _GNU_SOURCE also had the effect of +implicitly defining _BSD_SOURCE and _SVID_SOURCE. This is also true for uClibc. + +Alltogether, we can safely replace __USE_MISC by _GNU_SOURCE to support building +nodejs 0.10.x with the musl C library. + +Signed-off-by: Jörg Krause +--- + deps/uv/src/fs-poll.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/deps/uv/src/fs-poll.c b/deps/uv/src/fs-poll.c +index ad27f18..094447e 100644 +--- a/deps/uv/src/fs-poll.c ++++ b/deps/uv/src/fs-poll.c +@@ -198,7 +198,7 @@ static int statbuf_eq(const uv_statbuf_t* a, const uv_statbuf_t* b) { + + /* Jump through a few hoops to get sub-second granularity on Linux. */ + # if defined(__linux__) +-# if defined(__USE_MISC) /* _BSD_SOURCE || _SVID_SOURCE */ ++# if defined(_GNU_SOURCE) /* _BSD_SOURCE || _SVID_SOURCE */ + if (a->st_ctim.tv_nsec != b->st_ctim.tv_nsec) return 0; + if (a->st_mtim.tv_nsec != b->st_mtim.tv_nsec) return 0; + # else +-- +2.4.1 + diff --git a/package/nodejs/0.10.45/0004-Fix-support-for-uClibc-ng.patch b/package/nodejs/0.10.45/0004-Fix-support-for-uClibc-ng.patch new file mode 100644 index 0000000000..59b9d5044c --- /dev/null +++ b/package/nodejs/0.10.45/0004-Fix-support-for-uClibc-ng.patch @@ -0,0 +1,33 @@ +From 1cc08f6ceacbb0e5ba1f4638ca3a97ac002d7792 Mon Sep 17 00:00:00 2001 +From: "Bark, Martin" +Date: Mon, 14 Dec 2015 13:26:10 +0000 +Subject: [PATCH 2/2] Fix support for uClibc-ng + +uClibc-ng is currently at v1.0.9. The patch corrects the uClibc +version test so that HAVE_IFADDRS_H is defined for uClibc versions +after v0.9.32. + +Submitted upstream to libuv and accepted, see +https://github.com/libuv/libuv/pull/653 and +https://github.com/libuv/libuv/commit/c861972 + +Signed-off-by: Bark, Martin +--- + deps/uv/src/unix/linux-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c +index e6e6828..6cbbb71 100644 +--- a/deps/uv/src/unix/linux-core.c ++++ b/deps/uv/src/unix/linux-core.c +@@ -39,7 +39,7 @@ + #define HAVE_IFADDRS_H 1 + + #ifdef __UCLIBC__ +-# if __UCLIBC_MAJOR__ < 0 || __UCLIBC_MINOR__ < 9 || __UCLIBC_SUBLEVEL__ < 32 ++# if __UCLIBC_MAJOR__ < 0 && __UCLIBC_MINOR__ < 9 && __UCLIBC_SUBLEVEL__ < 32 + # undef HAVE_IFADDRS_H + # endif + #endif +-- +2.6.2 diff --git a/package/nodejs/6.1.0/0001-gyp-force-link-command-to-use-CXX.patch b/package/nodejs/6.1.0/0001-gyp-force-link-command-to-use-CXX.patch new file mode 100644 index 0000000000..5746582c14 --- /dev/null +++ b/package/nodejs/6.1.0/0001-gyp-force-link-command-to-use-CXX.patch @@ -0,0 +1,29 @@ +From 90a3c113c19ec615249ab880c45c6c0a8d369098 Mon Sep 17 00:00:00 2001 +From: Martin Bark +Date: Tue, 30 Jun 2015 09:43:47 +0100 +Subject: [PATCH 2/4] gyp: force link command to use CXX + +Signed-off-by: Samuel Martin +Signed-off-by: Martin Bark +[yann.morin.1998@free.fr: adapt to 4.1.2] +Signed-off-by: "Yann E. MORIN" +--- + tools/gyp/pylib/gyp/generator/make.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py +index b88a433..0a1f2e0 100644 +--- a/tools/gyp/pylib/gyp/generator/make.py ++++ b/tools/gyp/pylib/gyp/generator/make.py +@@ -142,7 +142,7 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + # special "figure out circular dependencies" flags around the entire + # input list during linking. + quiet_cmd_link = LINK($(TOOLSET)) $@ +-cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) ++cmd_link = $(CXX.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) + + # We support two kinds of shared objects (.so): + # 1) shared_library, which is just bundling together many dependent libraries +-- +2.1.4 + diff --git a/package/nut/0001-foo-config.patch b/package/nut/0001-foo-config.patch new file mode 100644 index 0000000000..7202f139cc --- /dev/null +++ b/package/nut/0001-foo-config.patch @@ -0,0 +1,72 @@ +configure: fix calls to {gdlib,net-snmp}-config + +nut directly calls to {gdlib,net-snmp}-config. In Buildroot, +those are not in the PATH, and nut would catch those of the +system (if they are installed), or miss them entirely. + +Fix that by using environment variables that will tell where +to look for them. + +Note: libusb also uses libusb-config, but only as a fallback +if pkg-config fails. Since we ensure that pkg-config exists, +and libusb is properly installed before we build nut, there +is no need to fix the libusb-config calls, since they won't +be called at all. + +Signed-off-by: "Yann E. MORIN" + +diff -durN nut-2.6.5.orig/m4/nut_check_libgd.m4 nut-2.6.5/m4/nut_check_libgd.m4 +--- nut-2.6.5.orig/m4/nut_check_libgd.m4 2012-07-31 19:38:56.000000000 +0200 ++++ nut-2.6.5/m4/nut_check_libgd.m4 2013-11-01 16:24:02.626549810 +0100 +@@ -20,7 +20,7 @@ + LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" + + AC_MSG_CHECKING(for gd version via gdlib-config) +- GD_VERSION=`gdlib-config --version 2>/dev/null` ++ GD_VERSION=`${GDLIB_CONFIG} --version 2>/dev/null` + if test "$?" != "0" -o -z "${GD_VERSION}"; then + GD_VERSION="none" + fi +@@ -34,9 +34,9 @@ + AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]]) + ;; + *) +- CFLAGS="`gdlib-config --includes 2>/dev/null`" +- LDFLAGS="`gdlib-config --ldflags 2>/dev/null`" +- LIBS="`gdlib-config --libs 2>/dev/null`" ++ CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`" ++ LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`" ++ LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`" + ;; + esac + +diff -durN nut-2.6.5.orig/m4/nut_check_libnetsnmp.m4 nut-2.6.5/m4/nut_check_libnetsnmp.m4 +--- nut-2.6.5.orig/m4/nut_check_libnetsnmp.m4 2012-07-31 19:38:56.000000000 +0200 ++++ nut-2.6.5/m4/nut_check_libnetsnmp.m4 2013-11-01 16:30:07.398282923 +0100 +@@ -15,7 +15,7 @@ + + dnl See which version of the Net-SNMP library (if any) is installed + AC_MSG_CHECKING(for Net-SNMP version via net-snmp-config) +- SNMP_VERSION=`net-snmp-config --version 2>/dev/null` ++ SNMP_VERSION=`${NET_SNMP_CONFIG} --version 2>/dev/null` + if test "$?" != "0" -o -z "${SNMP_VERSION}"; then + SNMP_VERSION="none" + fi +@@ -33,7 +33,7 @@ + CFLAGS="${withval}" + ;; + esac +- ], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"]) ++ ], [CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`"]) + AC_MSG_RESULT([${CFLAGS}]) + + AC_MSG_CHECKING(for Net-SNMP libs) +@@ -48,7 +48,7 @@ + LIBS="${withval}" + ;; + esac +- ], [LIBS="`net-snmp-config --libs 2>/dev/null`"]) ++ ], [LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`"]) + AC_MSG_RESULT([${LIBS}]) + + dnl Check if the Net-SNMP library is usable diff --git a/package/nut/0002-parallel-build.patch b/package/nut/0002-parallel-build.patch new file mode 100644 index 0000000000..f979c19da9 --- /dev/null +++ b/package/nut/0002-parallel-build.patch @@ -0,0 +1,24 @@ +conf: fix parallel install + +Do not reference the upsmon.conf.sample twice, otherwise install, with +a high number of make jobs, may fail, like so: + http://autobuild.buildroot.net/results/256/2567e13cd5bc702bc3a38a1d6fc8e34022cc7db5/build-end.log + +Signed-off-by: "Yann E. MORIN" + +--- +Upstream status: + https://github.com/networkupstools/nut/pull/147 + +diff -durB nut-2.7.2.orig/conf/Makefile.am nut-2.7.2/conf/Makefile.am +--- nut-2.7.2.orig/conf/Makefile.am 2014-02-14 09:56:53.000000000 +0100 ++++ nut-2.7.2/conf/Makefile.am 2014-08-17 11:33:46.804439240 +0200 +@@ -2,7 +2,7 @@ + + INSTALL_0600 = $(INSTALL) -m 0600 + +-SECFILES = upsmon.conf.sample upsd.conf.sample upsd.users.sample ++SECFILES = upsd.conf.sample upsd.users.sample + PUBFILES = nut.conf.sample ups.conf.sample + CGIPUB = hosts.conf.sample upsset.conf.sample upsstats.html.sample \ + upsstats-single.html.sample diff --git a/package/opencv/0001-ffmpeg30.patch b/package/opencv/0001-ffmpeg30.patch new file mode 100644 index 0000000000..70b6510b15 --- /dev/null +++ b/package/opencv/0001-ffmpeg30.patch @@ -0,0 +1,638 @@ +From a61b19b524cd2b66a7c43e67edd7cc780bf46cbb Mon Sep 17 00:00:00 2001 +From: Alexander Alekhin +Date: Wed, 2 Mar 2016 17:54:17 +0300 +Subject: [PATCH] backport ffmpeg fixes + +Signed-off-by: Bernd Kuhls +Downloaded from upstream commit: +https://github.com/Itseez/opencv/commit/a61b19b524cd2b66a7c43e67edd7cc780bf46cbb +--- + modules/highgui/src/cap_ffmpeg_impl.hpp | 364 +++++++++++++++++++++++++++----- + 1 file changed, 314 insertions(+), 50 deletions(-) + +diff --git a/modules/highgui/src/cap_ffmpeg_impl.hpp b/modules/highgui/src/cap_ffmpeg_impl.hpp +index 1b79870..6df542a 100644 +--- a/modules/highgui/src/cap_ffmpeg_impl.hpp ++++ b/modules/highgui/src/cap_ffmpeg_impl.hpp +@@ -118,11 +118,6 @@ extern "C" { + #define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__) + #endif + +-/* PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */ +-#ifndef PIX_FMT_RGBA32 +-#define PIX_FMT_RGBA32 PIX_FMT_RGB32 +-#endif +- + #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c ) + + #if defined WIN32 || defined _WIN32 +@@ -132,6 +127,11 @@ extern "C" { + #include + #include + #include ++ #include ++#if defined __APPLE__ ++ #include ++ #include ++#endif + #endif + + #ifndef MIN +@@ -156,6 +156,155 @@ extern "C" { + # define CV_CODEC(name) name + #endif + ++#if LIBAVUTIL_BUILD < (LIBAVUTIL_VERSION_MICRO >= 100 \ ++ ? CALC_FFMPEG_VERSION(51, 74, 100) : CALC_FFMPEG_VERSION(51, 42, 0)) ++#define AVPixelFormat PixelFormat ++#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 ++#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24 ++#define AV_PIX_FMT_GRAY8 PIX_FMT_GRAY8 ++#define AV_PIX_FMT_YUV422P PIX_FMT_YUV422P ++#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P ++#define AV_PIX_FMT_YUV444P PIX_FMT_YUV444P ++#define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P ++#define AV_PIX_FMT_GRAY16LE PIX_FMT_GRAY16LE ++#define AV_PIX_FMT_GRAY16BE PIX_FMT_GRAY16BE ++#endif ++ ++#if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \ ++ ? CALC_FFMPEG_VERSION(52, 38, 100) : CALC_FFMPEG_VERSION(52, 13, 0)) ++#define USE_AV_FRAME_GET_BUFFER 1 ++#else ++#define USE_AV_FRAME_GET_BUFFER 0 ++#ifndef AV_NUM_DATA_POINTERS // required for 0.7.x/0.8.x ffmpeg releases ++#define AV_NUM_DATA_POINTERS 4 ++#endif ++#endif ++ ++ ++#ifndef USE_AV_INTERRUPT_CALLBACK ++#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 21, 0) ++#define USE_AV_INTERRUPT_CALLBACK 1 ++#else ++#define USE_AV_INTERRUPT_CALLBACK 0 ++#endif ++#endif ++ ++#if USE_AV_INTERRUPT_CALLBACK ++#define LIBAVFORMAT_INTERRUPT_TIMEOUT_MS 30000 ++ ++#ifdef WIN32 ++// http://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows ++ ++static ++inline LARGE_INTEGER get_filetime_offset() ++{ ++ SYSTEMTIME s; ++ FILETIME f; ++ LARGE_INTEGER t; ++ ++ s.wYear = 1970; ++ s.wMonth = 1; ++ s.wDay = 1; ++ s.wHour = 0; ++ s.wMinute = 0; ++ s.wSecond = 0; ++ s.wMilliseconds = 0; ++ SystemTimeToFileTime(&s, &f); ++ t.QuadPart = f.dwHighDateTime; ++ t.QuadPart <<= 32; ++ t.QuadPart |= f.dwLowDateTime; ++ return t; ++} ++ ++static ++inline void get_monotonic_time(timespec *tv) ++{ ++ LARGE_INTEGER t; ++ FILETIME f; ++ double microseconds; ++ static LARGE_INTEGER offset; ++ static double frequencyToMicroseconds; ++ static int initialized = 0; ++ static BOOL usePerformanceCounter = 0; ++ ++ if (!initialized) ++ { ++ LARGE_INTEGER performanceFrequency; ++ initialized = 1; ++ usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency); ++ if (usePerformanceCounter) ++ { ++ QueryPerformanceCounter(&offset); ++ frequencyToMicroseconds = (double)performanceFrequency.QuadPart / 1000000.; ++ } ++ else ++ { ++ offset = get_filetime_offset(); ++ frequencyToMicroseconds = 10.; ++ } ++ } ++ ++ if (usePerformanceCounter) ++ { ++ QueryPerformanceCounter(&t); ++ } else { ++ GetSystemTimeAsFileTime(&f); ++ t.QuadPart = f.dwHighDateTime; ++ t.QuadPart <<= 32; ++ t.QuadPart |= f.dwLowDateTime; ++ } ++ ++ t.QuadPart -= offset.QuadPart; ++ microseconds = (double)t.QuadPart / frequencyToMicroseconds; ++ t.QuadPart = microseconds; ++ tv->tv_sec = t.QuadPart / 1000000; ++ tv->tv_nsec = (t.QuadPart % 1000000) * 1000; ++} ++#else ++static ++inline void get_monotonic_time(timespec *time) ++{ ++#if defined(__APPLE__) && defined(__MACH__) ++ clock_serv_t cclock; ++ mach_timespec_t mts; ++ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); ++ clock_get_time(cclock, &mts); ++ mach_port_deallocate(mach_task_self(), cclock); ++ time->tv_sec = mts.tv_sec; ++ time->tv_nsec = mts.tv_nsec; ++#else ++ clock_gettime(CLOCK_MONOTONIC, time); ++#endif ++} ++#endif ++ ++static ++inline timespec get_monotonic_time_diff(timespec start, timespec end) ++{ ++ timespec temp; ++ if (end.tv_nsec - start.tv_nsec < 0) ++ { ++ temp.tv_sec = end.tv_sec - start.tv_sec - 1; ++ temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec; ++ } ++ else ++ { ++ temp.tv_sec = end.tv_sec - start.tv_sec; ++ temp.tv_nsec = end.tv_nsec - start.tv_nsec; ++ } ++ return temp; ++} ++ ++static ++inline double get_monotonic_time_diff_ms(timespec time1, timespec time2) ++{ ++ timespec delta = get_monotonic_time_diff(time1, time2); ++ double milliseconds = delta.tv_sec * 1000 + (double)delta.tv_nsec / 1000000.0; ++ ++ return milliseconds; ++} ++#endif // USE_AV_INTERRUPT_CALLBACK ++ + static int get_number_of_cpus(void) + { + #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(52, 111, 0) +@@ -205,12 +354,36 @@ struct Image_FFMPEG + }; + + ++#if USE_AV_INTERRUPT_CALLBACK ++struct AVInterruptCallbackMetadata ++{ ++ timespec value; ++ unsigned int timeout_after_ms; ++ int timeout; ++}; ++ ++static + inline void _opencv_ffmpeg_free(void** ptr) + { + if(*ptr) free(*ptr); + *ptr = 0; + } + ++static ++inline int _opencv_ffmpeg_interrupt_callback(void *ptr) ++{ ++ AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr; ++ assert(metadata); ++ ++ timespec now; ++ get_monotonic_time(&now); ++ ++ metadata->timeout = get_monotonic_time_diff_ms(metadata->value, now) > metadata->timeout_after_ms; ++ ++ return metadata->timeout ? -1 : 0; ++} ++#endif ++ + + struct CvCapture_FFMPEG + { +@@ -264,6 +437,10 @@ struct CvCapture_FFMPEG + #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + AVDictionary *dict; + #endif ++ ++#if USE_AV_INTERRUPT_CALLBACK ++ AVInterruptCallbackMetadata interrupt_metadata; ++#endif + }; + + void CvCapture_FFMPEG::init() +@@ -301,8 +478,10 @@ void CvCapture_FFMPEG::close() + + if( picture ) + { +- // FFmpeg and Libav added avcodec_free_frame in different versions. + #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ++ ? CALC_FFMPEG_VERSION(55, 45, 101) : CALC_FFMPEG_VERSION(55, 28, 1)) ++ av_frame_free(&picture); ++#elif LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ + ? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0)) + avcodec_free_frame(&picture); + #else +@@ -333,11 +512,15 @@ void CvCapture_FFMPEG::close() + ic = NULL; + } + ++#if USE_AV_FRAME_GET_BUFFER ++ av_frame_unref(&rgb_picture); ++#else + if( rgb_picture.data[0] ) + { + free( rgb_picture.data[0] ); + rgb_picture.data[0] = 0; + } ++#endif + + // free last packet if exist + if (packet.data) { +@@ -556,6 +739,16 @@ bool CvCapture_FFMPEG::open( const char* _filename ) + + close(); + ++#if USE_AV_INTERRUPT_CALLBACK ++ /* interrupt callback */ ++ interrupt_metadata.timeout_after_ms = LIBAVFORMAT_INTERRUPT_TIMEOUT_MS; ++ get_monotonic_time(&interrupt_metadata.value); ++ ++ ic = avformat_alloc_context(); ++ ic->interrupt_callback.callback = _opencv_ffmpeg_interrupt_callback; ++ ic->interrupt_callback.opaque = &interrupt_metadata; ++#endif ++ + #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + av_dict_set(&dict, "rtsp_transport", "tcp", 0); + int err = avformat_open_input(&ic, _filename, NULL, &dict); +@@ -619,19 +812,18 @@ bool CvCapture_FFMPEG::open( const char* _filename ) + + video_stream = i; + video_st = ic->streams[i]; ++#if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ++ ? CALC_FFMPEG_VERSION(55, 45, 101) : CALC_FFMPEG_VERSION(55, 28, 1)) ++ picture = av_frame_alloc(); ++#else + picture = avcodec_alloc_frame(); +- +- rgb_picture.data[0] = (uint8_t*)malloc( +- avpicture_get_size( PIX_FMT_BGR24, +- enc->width, enc->height )); +- avpicture_fill( (AVPicture*)&rgb_picture, rgb_picture.data[0], +- PIX_FMT_BGR24, enc->width, enc->height ); ++#endif + + frame.width = enc->width; + frame.height = enc->height; + frame.cn = 3; +- frame.step = rgb_picture.linesize[0]; +- frame.data = rgb_picture.data[0]; ++ frame.step = 0; ++ frame.data = NULL; + break; + } + } +@@ -668,6 +860,16 @@ bool CvCapture_FFMPEG::grabFrame() + // get the next frame + while (!valid) + { ++ av_free_packet (&packet); ++ ++#if USE_AV_INTERRUPT_CALLBACK ++ if (interrupt_metadata.timeout) ++ { ++ valid = false; ++ break; ++ } ++#endif ++ + int ret = av_read_frame(ic, &packet); + if (ret == AVERROR(EAGAIN)) continue; + +@@ -703,6 +905,11 @@ bool CvCapture_FFMPEG::grabFrame() + picture_pts = packet.pts != AV_NOPTS_VALUE_ && packet.pts != 0 ? packet.pts : packet.dts; + frame_number++; + valid = true; ++ ++#if USE_AV_INTERRUPT_CALLBACK ++ // update interrupt value ++ get_monotonic_time(&interrupt_metadata.value); ++#endif + } + else + { +@@ -727,38 +934,59 @@ bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char** data, int* step, int* + if( !video_st || !picture->data[0] ) + return false; + +- avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], PIX_FMT_RGB24, +- video_st->codec->width, video_st->codec->height); +- + if( img_convert_ctx == NULL || + frame.width != video_st->codec->width || +- frame.height != video_st->codec->height ) ++ frame.height != video_st->codec->height || ++ frame.data == NULL ) + { +- if( img_convert_ctx ) +- sws_freeContext(img_convert_ctx); +- +- frame.width = video_st->codec->width; +- frame.height = video_st->codec->height; ++ // Some sws_scale optimizations have some assumptions about alignment of data/step/width/height ++ // Also we use coded_width/height to workaround problem with legacy ffmpeg versions (like n0.8) ++ int buffer_width = video_st->codec->coded_width, buffer_height = video_st->codec->coded_height; + + img_convert_ctx = sws_getCachedContext( +- NULL, +- video_st->codec->width, video_st->codec->height, ++ img_convert_ctx, ++ buffer_width, buffer_height, + video_st->codec->pix_fmt, +- video_st->codec->width, video_st->codec->height, +- PIX_FMT_BGR24, ++ buffer_width, buffer_height, ++ AV_PIX_FMT_BGR24, + SWS_BICUBIC, + NULL, NULL, NULL + ); + + if (img_convert_ctx == NULL) + return false;//CV_Error(0, "Cannot initialize the conversion context!"); ++ ++#if USE_AV_FRAME_GET_BUFFER ++ av_frame_unref(&rgb_picture); ++ rgb_picture.format = AV_PIX_FMT_BGR24; ++ rgb_picture.width = buffer_width; ++ rgb_picture.height = buffer_height; ++ if (0 != av_frame_get_buffer(&rgb_picture, 32)) ++ { ++ CV_WARN("OutOfMemory"); ++ return false; ++ } ++#else ++ int aligns[AV_NUM_DATA_POINTERS]; ++ avcodec_align_dimensions2(video_st->codec, &buffer_width, &buffer_height, aligns); ++ rgb_picture.data[0] = (uint8_t*)realloc(rgb_picture.data[0], ++ avpicture_get_size( AV_PIX_FMT_BGR24, ++ buffer_width, buffer_height )); ++ avpicture_fill( (AVPicture*)&rgb_picture, rgb_picture.data[0], ++ AV_PIX_FMT_BGR24, buffer_width, buffer_height ); ++#endif ++ frame.width = video_st->codec->width; ++ frame.height = video_st->codec->height; ++ frame.cn = 3; ++ frame.data = rgb_picture.data[0]; ++ frame.step = rgb_picture.linesize[0]; + } + + sws_scale( + img_convert_ctx, + picture->data, + picture->linesize, +- 0, video_st->codec->height, ++ 0, video_st->codec->coded_height, + rgb_picture.data, + rgb_picture.linesize + ); +@@ -1099,10 +1327,20 @@ static AVFrame * icv_alloc_picture_FFMPEG(int pix_fmt, int width, int height, bo + uint8_t * picture_buf; + int size; + ++#if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ ++ ? CALC_FFMPEG_VERSION(55, 45, 101) : CALC_FFMPEG_VERSION(55, 28, 1)) ++ picture = av_frame_alloc(); ++#else + picture = avcodec_alloc_frame(); ++#endif + if (!picture) + return NULL; +- size = avpicture_get_size( (PixelFormat) pix_fmt, width, height); ++ ++ picture->format = pix_fmt; ++ picture->width = width; ++ picture->height = height; ++ ++ size = avpicture_get_size( (AVPixelFormat) pix_fmt, width, height); + if(alloc){ + picture_buf = (uint8_t *) malloc(size); + if (!picture_buf) +@@ -1111,7 +1349,7 @@ static AVFrame * icv_alloc_picture_FFMPEG(int pix_fmt, int width, int height, bo + return NULL; + } + avpicture_fill((AVPicture *)picture, picture_buf, +- (PixelFormat) pix_fmt, width, height); ++ (AVPixelFormat) pix_fmt, width, height); + } + else { + } +@@ -1211,7 +1449,7 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc, + #endif + + c->gop_size = 12; /* emit one intra frame every twelve frames at most */ +- c->pix_fmt = (PixelFormat) pixel_format; ++ c->pix_fmt = (AVPixelFormat) pixel_format; + + if (c->codec_id == CV_CODEC(CODEC_ID_MPEG2VIDEO)) { + c->max_b_frames = 2; +@@ -1372,12 +1610,12 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int + #endif + + // check parameters +- if (input_pix_fmt == PIX_FMT_BGR24) { ++ if (input_pix_fmt == AV_PIX_FMT_BGR24) { + if (cn != 3) { + return false; + } + } +- else if (input_pix_fmt == PIX_FMT_GRAY8) { ++ else if (input_pix_fmt == AV_PIX_FMT_GRAY8) { + if (cn != 1) { + return false; + } +@@ -1390,13 +1628,13 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int + assert( input_picture ); + // let input_picture point to the raw data buffer of 'image' + avpicture_fill((AVPicture *)input_picture, (uint8_t *) data, +- (PixelFormat)input_pix_fmt, width, height); ++ (AVPixelFormat)input_pix_fmt, width, height); + + if( !img_convert_ctx ) + { + img_convert_ctx = sws_getContext(width, + height, +- (PixelFormat)input_pix_fmt, ++ (AVPixelFormat)input_pix_fmt, + c->width, + c->height, + c->pix_fmt, +@@ -1414,7 +1652,7 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int + } + else{ + avpicture_fill((AVPicture *)picture, (uint8_t *) data, +- (PixelFormat)input_pix_fmt, width, height); ++ (AVPixelFormat)input_pix_fmt, width, height); + } + + picture->pts = frame_idx; +@@ -1547,10 +1785,10 @@ bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc, + + /* determine optimal pixel format */ + if (is_color) { +- input_pix_fmt = PIX_FMT_BGR24; ++ input_pix_fmt = AV_PIX_FMT_BGR24; + } + else { +- input_pix_fmt = PIX_FMT_GRAY8; ++ input_pix_fmt = AV_PIX_FMT_GRAY8; + } + + /* Lookup codec_id for given fourcc */ +@@ -1587,21 +1825,21 @@ bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc, + break; + #endif + case CV_CODEC(CODEC_ID_HUFFYUV): +- codec_pix_fmt = PIX_FMT_YUV422P; ++ codec_pix_fmt = AV_PIX_FMT_YUV422P; + break; + case CV_CODEC(CODEC_ID_MJPEG): + case CV_CODEC(CODEC_ID_LJPEG): +- codec_pix_fmt = PIX_FMT_YUVJ420P; ++ codec_pix_fmt = AV_PIX_FMT_YUVJ420P; + bitrate_scale = 3; + break; + case CV_CODEC(CODEC_ID_RAWVIDEO): +- codec_pix_fmt = input_pix_fmt == PIX_FMT_GRAY8 || +- input_pix_fmt == PIX_FMT_GRAY16LE || +- input_pix_fmt == PIX_FMT_GRAY16BE ? input_pix_fmt : PIX_FMT_YUV420P; ++ codec_pix_fmt = input_pix_fmt == AV_PIX_FMT_GRAY8 || ++ input_pix_fmt == AV_PIX_FMT_GRAY16LE || ++ input_pix_fmt == AV_PIX_FMT_GRAY16BE ? input_pix_fmt : AV_PIX_FMT_YUV420P; + break; + default: + // good for lossy formats, MPEG, etc. +- codec_pix_fmt = PIX_FMT_YUV420P; ++ codec_pix_fmt = AV_PIX_FMT_YUV420P; + break; + } + +@@ -1826,7 +2064,7 @@ struct OutputMediaStream_FFMPEG + void write(unsigned char* data, int size, int keyFrame); + + // add a video output stream to the container +- static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format); ++ static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format); + + AVOutputFormat* fmt_; + AVFormatContext* oc_; +@@ -1873,7 +2111,7 @@ void OutputMediaStream_FFMPEG::close() + } + } + +-AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format) ++AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format) + { + #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0) + AVStream* st = avformat_new_stream(oc, 0); +@@ -2011,7 +2249,7 @@ bool OutputMediaStream_FFMPEG::open(const char* fileName, int width, int height, + oc_->max_delay = (int)(0.7 * AV_TIME_BASE); // This reduces buffer underrun warnings with MPEG + + // set a few optimal pixel formats for lossless codecs of interest.. +- PixelFormat codec_pix_fmt = PIX_FMT_YUV420P; ++ AVPixelFormat codec_pix_fmt = AV_PIX_FMT_YUV420P; + int bitrate_scale = 64; + + // TODO -- safe to ignore output audio stream? +@@ -2150,6 +2388,10 @@ struct InputMediaStream_FFMPEG + AVFormatContext* ctx_; + int video_stream_id_; + AVPacket pkt_; ++ ++#if USE_AV_INTERRUPT_CALLBACK ++ AVInterruptCallbackMetadata interrupt_metadata; ++#endif + }; + + bool InputMediaStream_FFMPEG::open(const char* fileName, int* codec, int* chroma_format, int* width, int* height) +@@ -2160,6 +2402,16 @@ bool InputMediaStream_FFMPEG::open(const char* fileName, int* codec, int* chroma + video_stream_id_ = -1; + memset(&pkt_, 0, sizeof(AVPacket)); + ++#if USE_AV_INTERRUPT_CALLBACK ++ /* interrupt callback */ ++ interrupt_metadata.timeout_after_ms = LIBAVFORMAT_INTERRUPT_TIMEOUT_MS; ++ get_monotonic_time(&interrupt_metadata.value); ++ ++ ctx_ = avformat_alloc_context(); ++ ctx_->interrupt_callback.callback = _opencv_ffmpeg_interrupt_callback; ++ ctx_->interrupt_callback.opaque = &interrupt_metadata; ++#endif ++ + #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0) + avformat_network_init(); + #endif +@@ -2220,15 +2472,15 @@ bool InputMediaStream_FFMPEG::open(const char* fileName, int* codec, int* chroma + + switch (enc->pix_fmt) + { +- case PIX_FMT_YUV420P: ++ case AV_PIX_FMT_YUV420P: + *chroma_format = ::VideoChromaFormat_YUV420; + break; + +- case PIX_FMT_YUV422P: ++ case AV_PIX_FMT_YUV422P: + *chroma_format = ::VideoChromaFormat_YUV422; + break; + +- case PIX_FMT_YUV444P: ++ case AV_PIX_FMT_YUV444P: + *chroma_format = ::VideoChromaFormat_YUV444; + break; + +@@ -2276,11 +2528,23 @@ bool InputMediaStream_FFMPEG::read(unsigned char** data, int* size, int* endOfFi + // get the next frame + for (;;) + { ++#if USE_AV_INTERRUPT_CALLBACK ++ if(interrupt_metadata.timeout) ++ { ++ break; ++ } ++#endif ++ + int ret = av_read_frame(ctx_, &pkt_); + + if (ret == AVERROR(EAGAIN)) + continue; + ++#if USE_AV_INTERRUPT_CALLBACK ++ // update interrupt value ++ get_monotonic_time(&interrupt_metadata.value); ++#endif ++ + if (ret < 0) + { + if (ret == (int)AVERROR_EOF) diff --git a/package/opencv/0002-atomic.patch b/package/opencv/0002-atomic.patch new file mode 100644 index 0000000000..bbe8d433cf --- /dev/null +++ b/package/opencv/0002-atomic.patch @@ -0,0 +1,229 @@ +Bug#714923: opencv FTBFS on sparc64 +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714923 + +opencv uses functions from , but it wrongly assumes +this functions apply to an int type. While it is true for some +architectures, some architectures are using a long type there. The +correct type to use is _Atomic_word. + +Signed-off-by: Waldemar Brodkorb + +diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/core.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/core.hpp +--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/core.hpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/include/opencv2/core/core.hpp 2016-04-03 00:10:50.455774144 +0200 +@@ -1290,7 +1290,7 @@ + operator const _Tp*() const; + + _Tp* obj; //< the object pointer. +- int* refcount; //< the associated reference counter ++ _Atomic_word* refcount; //< the associated reference counter + }; + + template +@@ -1490,9 +1490,9 @@ + public: + MatAllocator() {} + virtual ~MatAllocator() {} +- virtual void allocate(int dims, const int* sizes, int type, int*& refcount, ++ virtual void allocate(int dims, const int* sizes, int type, _Atomic_word*& refcount, + uchar*& datastart, uchar*& data, size_t* step) = 0; +- virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0; ++ virtual void deallocate(_Atomic_word* refcount, uchar* datastart, uchar* data) = 0; + }; + + /*! +@@ -1985,7 +1985,7 @@ + + //! pointer to the reference counter; + // when matrix points to user-allocated data, the pointer is NULL +- int* refcount; ++ _Atomic_word* refcount; + + //! helper fields used in locateROI and adjustROI + uchar* datastart; +@@ -3408,7 +3408,7 @@ + { + Hdr(int _dims, const int* _sizes, int _type); + void clear(); +- int refcount; ++ _Atomic_word refcount; + int dims; + int valueOffset; + size_t nodeSize; +diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/gpumat.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/gpumat.hpp +--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/gpumat.hpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/include/opencv2/core/gpumat.hpp 2016-04-02 23:08:58.116874218 +0200 +@@ -301,7 +301,7 @@ + + //! pointer to the reference counter; + // when GpuMatrix points to user-allocated data, the pointer is NULL +- int* refcount; ++ _Atomic_word* refcount; + + //! helper fields used in locateROI and adjustROI + uchar* datastart; +diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/operations.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/operations.hpp +--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/operations.hpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/include/opencv2/core/operations.hpp 2016-04-02 23:12:59.148385306 +0200 +@@ -2589,7 +2589,7 @@ + { + if(obj) + { +- refcount = (int*)fastMalloc(sizeof(*refcount)); ++ refcount = (_Atomic_word*)fastMalloc(sizeof(*refcount)); + *refcount = 1; + } + else +@@ -2628,7 +2628,7 @@ + { + if (this != &_ptr) + { +- int* _refcount = _ptr.refcount; ++ _Atomic_word* _refcount = _ptr.refcount; + if( _refcount ) + CV_XADD(_refcount, 1); + release(); +diff -Nur opencv-2.4.12.3.orig/modules/core/src/gpumat.cpp opencv-2.4.12.3/modules/core/src/gpumat.cpp +--- opencv-2.4.12.3.orig/modules/core/src/gpumat.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/src/gpumat.cpp 2016-04-02 23:14:38.894804300 +0200 +@@ -716,7 +716,7 @@ + datastart = data = static_cast(devPtr); + dataend = data + nettosize; + +- refcount = static_cast(fastMalloc(sizeof(*refcount))); ++ refcount = static_cast<_Atomic_word*>(fastMalloc(sizeof(*refcount))); + *refcount = 1; + } + } +diff -Nur opencv-2.4.12.3.orig/modules/core/src/matrix.cpp opencv-2.4.12.3/modules/core/src/matrix.cpp +--- opencv-2.4.12.3.orig/modules/core/src/matrix.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/src/matrix.cpp 2016-04-02 23:59:53.405491031 +0200 +@@ -213,7 +213,7 @@ + { + size_t totalsize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount)); + data = datastart = (uchar*)fastMalloc(totalsize + (int)sizeof(*refcount)); +- refcount = (int*)(data + totalsize); ++ refcount = (_Atomic_word*)(data + totalsize); + *refcount = 1; + } + else +@@ -228,7 +228,7 @@ + allocator = 0; + size_t totalSize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount)); + data = datastart = (uchar*)fastMalloc(totalSize + (int)sizeof(*refcount)); +- refcount = (int*)(data + totalSize); ++ refcount = (_Atomic_word*)(data + totalSize); + *refcount = 1; + } + #else +diff -Nur opencv-2.4.12.3.orig/modules/core/src/system.cpp opencv-2.4.12.3/modules/core/src/system.cpp +--- opencv-2.4.12.3.orig/modules/core/src/system.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/src/system.cpp 2016-04-02 23:33:19.298905578 +0200 +@@ -892,7 +892,7 @@ + void unlock() { LeaveCriticalSection(&cs); } + + CRITICAL_SECTION cs; +- int refcount; ++ _Atomic_word refcount; + }; + + #ifndef __GNUC__ +@@ -920,7 +920,7 @@ + void unlock() { OSSpinLockUnlock(&sl); } + + OSSpinLock sl; +- int refcount; ++ _Atomic_word refcount; + }; + + #elif defined __linux__ && !defined ANDROID && !defined __LINUXTHREADS_OLD__ +@@ -935,7 +935,7 @@ + void unlock() { pthread_spin_unlock(&sl); } + + pthread_spinlock_t sl; +- int refcount; ++ _Atomic_word refcount; + }; + + #else +@@ -950,7 +950,7 @@ + void unlock() { pthread_mutex_unlock(&sl); } + + pthread_mutex_t sl; +- int refcount; ++ _Atomic_word refcount; + }; + + #endif +diff -Nur opencv-2.4.12.3.orig/modules/gpu/include/opencv2/gpu/gpu.hpp opencv-2.4.12.3/modules/gpu/include/opencv2/gpu/gpu.hpp +--- opencv-2.4.12.3.orig/modules/gpu/include/opencv2/gpu/gpu.hpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/gpu/include/opencv2/gpu/gpu.hpp 2016-04-02 23:16:19.737293785 +0200 +@@ -125,7 +125,7 @@ + size_t step; + + uchar* data; +- int* refcount; ++ _Atomic_word* refcount; + + uchar* datastart; + uchar* dataend; +diff -Nur opencv-2.4.12.3.orig/modules/ocl/include/opencv2/ocl/ocl.hpp opencv-2.4.12.3/modules/ocl/include/opencv2/ocl/ocl.hpp +--- opencv-2.4.12.3.orig/modules/ocl/include/opencv2/ocl/ocl.hpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/ocl/include/opencv2/ocl/ocl.hpp 2016-04-02 23:18:55.715331443 +0200 +@@ -404,7 +404,7 @@ + + //! pointer to the reference counter; + // when oclMatrix points to user-allocated data, the pointer is NULL +- int *refcount; ++ _Atomic_word *refcount; + + //! helper fields used in locateROI and adjustROI + //datastart and dataend are not used in current version +diff -Nur opencv-2.4.12.3.orig/modules/ocl/src/matrix_operations.cpp opencv-2.4.12.3/modules/ocl/src/matrix_operations.cpp +--- opencv-2.4.12.3.orig/modules/ocl/src/matrix_operations.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/ocl/src/matrix_operations.cpp 2016-04-02 23:19:23.633128033 +0200 +@@ -591,7 +591,7 @@ + datastart = data = (uchar *)dev_ptr; + dataend = data + nettosize; + +- refcount = (int *)fastMalloc(sizeof(*refcount)); ++ refcount = (_Atomic_word *)fastMalloc(sizeof(*refcount)); + *refcount = 1; + } + } +diff -Nur opencv-2.4.12.3.orig/modules/python/src2/cv2.cpp opencv-2.4.12.3/modules/python/src2/cv2.cpp +--- opencv-2.4.12.3.orig/modules/python/src2/cv2.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/python/src2/cv2.cpp 2016-04-02 23:18:34.897991791 +0200 +@@ -157,12 +157,12 @@ + static size_t REFCOUNT_OFFSET = (size_t)&(((PyObject*)0)->ob_refcnt) + + (0x12345678 != *(const size_t*)"\x78\x56\x34\x12\0\0\0\0\0")*sizeof(int); + +-static inline PyObject* pyObjectFromRefcount(const int* refcount) ++static inline PyObject* pyObjectFromRefcount(const _Atomic_word* refcount) + { + return (PyObject*)((size_t)refcount - REFCOUNT_OFFSET); + } + +-static inline int* refcountFromPyObject(const PyObject* obj) ++static inline _Atomic_word* refcountFromPyObject(const PyObject* obj) + { + return (int*)((size_t)obj + REFCOUNT_OFFSET); + } +@@ -173,7 +173,7 @@ + NumpyAllocator() {} + ~NumpyAllocator() {} + +- void allocate(int dims, const int* sizes, int type, int*& refcount, ++ void allocate(int dims, const int* sizes, int type, _Atomic_word*& refcount, + uchar*& datastart, uchar*& data, size_t* step) + { + PyEnsureGIL gil; +@@ -206,7 +206,7 @@ + datastart = data = (uchar*)PyArray_DATA((PyArrayObject*) o); + } + +- void deallocate(int* refcount, uchar*, uchar*) ++ void deallocate(_Atomic_word* refcount, uchar*, uchar*) + { + PyEnsureGIL gil; + if( !refcount ) diff --git a/package/opencv/0003-avoid-sysctl_h.patch b/package/opencv/0003-avoid-sysctl_h.patch new file mode 100644 index 0000000000..603220549e --- /dev/null +++ b/package/opencv/0003-avoid-sysctl_h.patch @@ -0,0 +1,31 @@ +From upstream master branch: +https://github.com/Itseez/opencv/blob/master/modules/core/src/ + +Do not include sysctl.h targeting Linux systems. + +Signed-off-by: Waldemar Brodkorb + +diff -Nur opencv-2.4.12.3.orig/modules/core/src/parallel.cpp opencv-2.4.12.3/modules/core/src/parallel.cpp +--- opencv-2.4.12.3.orig/modules/core/src/parallel.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/src/parallel.cpp 2016-04-05 12:59:37.750143762 +0200 +@@ -56,7 +56,7 @@ + #include + #if defined ANDROID + #include +- #else ++ #elif defined __APPLE__ + #include + #endif + #endif +diff -Nur opencv-2.4.12.3.orig/modules/core/src/system.cpp opencv-2.4.12.3/modules/core/src/system.cpp +--- opencv-2.4.12.3.orig/modules/core/src/system.cpp 2015-10-26 08:56:34.000000000 +0100 ++++ opencv-2.4.12.3/modules/core/src/system.cpp 2016-04-05 13:05:22.468323717 +0200 +@@ -163,7 +163,7 @@ + #include + #if defined ANDROID + #include +-#else ++#elif defined __APPLE__ + #include + #endif + #endif diff --git a/package/openpowerlink/0003-cmake-use-CMAKE_CURRENT_SOURCE_DIR-instead-of-CM.patch b/package/openpowerlink/0003-cmake-use-CMAKE_CURRENT_SOURCE_DIR-instead-of-CM.patch new file mode 100644 index 0000000000..668c907b3c --- /dev/null +++ b/package/openpowerlink/0003-cmake-use-CMAKE_CURRENT_SOURCE_DIR-instead-of-CM.patch @@ -0,0 +1,154 @@ +From c354e8d9599aa02566c8acc341f3a2c73281483b Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Wed, 17 Sep 2014 13:27:44 +0200 +Subject: [PATCH] cmake: use CMAKE_CURRENT_SOURCE_DIR instead of + CMAKE_SOURCE_DIR + +The aim of this patch is to be able to call each subproject's CMakeLists.txt +from a top-level CMakeLists.txt. + +This will help to build automatically the epl libraries, epl driver, unittests +and demos. + +This patch has been submitted upstream: +https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57 + +Signed-off-by: Romain Naour +--- + drivers/linux/drv_daemon_pcap/CMakeLists.txt | 6 +++--- + drivers/linux/drv_kernelmod_edrv/CMakeLists.txt | 8 ++++---- + hardware/CMakeLists.txt | 4 ++-- + hardware/drivers/hostinterface/CMakeLists.txt | 2 +- + hardware/drivers/openmac/CMakeLists.txt | 4 ++-- + unittests/CMakeLists.txt | 4 ++-- + 6 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt +index 4c3f933..9041e4d 100644 +--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt ++++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt +@@ -57,8 +57,8 @@ MESSAGE(STATUS "Configuring ${EXE_NAME}") + ############################################################################### + # Set global directories + ############################################################################### +-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/../../..) +-SET(DRV_SOURCE_DIR ${CMAKE_SOURCE_DIR}) ++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) ++SET(DRV_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + SET(CONTRIB_SOURCE_DIR ${OPLK_BASE_DIR}/contrib) + SET(OPLK_INCLUDE_DIR ${OPLK_BASE_DIR}/stack/include) + SET(TOOLS_DIR ${OPLK_BASE_DIR}/tools) +@@ -66,7 +66,7 @@ SET(TOOLS_DIR ${OPLK_BASE_DIR}/tools) + ############################################################################### + # Include CMake Modules + ############################################################################### +-SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../cmake ${CMAKE_MODULE_PATH}) ++SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake ${CMAKE_MODULE_PATH}) + + # include standard cmake modules + INCLUDE(CMakeDependentOption) +diff --git a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt +index 2ad1a0d..af85f86 100644 +--- a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt ++++ b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt +@@ -75,7 +75,7 @@ SET_PROPERTY(CACHE CFG_POWERLINK_EDRV PROPERTY STRINGS 8139 82573 8255x i210 811 + ################################################################################ + # Set global directories + ################################################################################ +-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/../../..) ++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) + SET(CONTRIB_SOURCE_DIR ${OPLK_BASE_DIR}/contrib) + SET(STACK_SOURCE_DIR ${OPLK_BASE_DIR}/stack/src) + SET(COMMON_SOURCE_DIR ${OPLK_BASE_DIR}/stack/src/common) +@@ -152,10 +152,10 @@ IF(CFG_OPLK_MN) + ENDIF() + SET(MODULE_DEFS "${MODULE_DEFS} -DCONFIG_MN") + SET(MODULE_NAME "${MODULE_NAME}mn") +- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/proj/mn) ++ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/proj/mn) + ELSE() + SET(MODULE_NAME "${MODULE_NAME}cn") +- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/proj/cn) ++ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/proj/cn) + ENDIF() + + ############################################################################### +@@ -189,7 +189,7 @@ ENDFOREACH() + # + SET(MODULE_SOURCE_FILES + ${MODULE_SOURCE_FILES} +- ${CMAKE_SOURCE_DIR}/main.c ++ ${CMAKE_CURRENT_SOURCE_DIR}/main.c + ${CONTRIB_SOURCE_DIR}/trace/trace-printk.c + ${EDRV_SOURCE_DIR}/edrvcyclic.c + ${KERNEL_SOURCE_DIR}/ctrl/ctrlk.c +diff --git a/hardware/CMakeLists.txt b/hardware/CMakeLists.txt +index 218c4eb..3ba85ca 100644 +--- a/hardware/CMakeLists.txt ++++ b/hardware/CMakeLists.txt +@@ -40,7 +40,7 @@ INCLUDE(reduceboardname) + + ################################################################################ + # Set paths +-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/..) ++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) + SET(OMETHLIB_BASE_DIR ${PROJECT_SOURCE_DIR}/drivers/openmac) + SET(OMETHLIB_BUILD_DIR ${PROJECT_BINARY_DIR}/drivers/openmac) + SET(HOSTIF_BASE_DIR ${PROJECT_SOURCE_DIR}/drivers/hostinterface) +@@ -56,7 +56,7 @@ STRING(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_PROCESSOR_DIR) + + IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + SET(CMAKE_INSTALL_PREFIX +- ${CMAKE_SOURCE_DIR}/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR} CACHE PATH "openPOWERLINK hardware install prefix" FORCE ++ ${CMAKE_CURRENT_SOURCE_DIR}/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR} CACHE PATH "openPOWERLINK hardware install prefix" FORCE + ) + ENDIF() + +diff --git a/hardware/drivers/hostinterface/CMakeLists.txt b/hardware/drivers/hostinterface/CMakeLists.txt +index 1a9d2aa..9c56c16 100644 +--- a/hardware/drivers/hostinterface/CMakeLists.txt ++++ b/hardware/drivers/hostinterface/CMakeLists.txt +@@ -71,7 +71,7 @@ ELSE() + SET( HOSTIF_LIB_NAME "${HOSTIF_NAME}") + ENDIF() + +-SET(BOARDS_COMMON_DIR ${CMAKE_SOURCE_DIR}/boards/${BOARD_NAME}/common) ++SET(BOARDS_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_NAME}/common) + SET(EXAMPLE_BINARY_DIR ${CMAKE_BINARY_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME}) + + ######################################################################## +diff --git a/hardware/drivers/openmac/CMakeLists.txt b/hardware/drivers/openmac/CMakeLists.txt +index 560c0d9..d532996 100644 +--- a/hardware/drivers/openmac/CMakeLists.txt ++++ b/hardware/drivers/openmac/CMakeLists.txt +@@ -55,8 +55,8 @@ ELSE() + SET(OMETH_LIB_NAME "${OMETH_NAME}") + ENDIF() + +-SET(BOARD_EXAMPLE_DIR ${CMAKE_SOURCE_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME}) +-SET(BOARDS_COMMON_DIR ${CMAKE_SOURCE_DIR}/boards/${BOARD_NAME}/common) ++SET(BOARD_EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME}) ++SET(BOARDS_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_NAME}/common) + SET(EXAMPLE_BINARY_DIR ${CMAKE_BINARY_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME}) + + ######################################################################## +diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt +index 533d4e7..4460c2e 100644 +--- a/unittests/CMakeLists.txt ++++ b/unittests/CMakeLists.txt +@@ -55,10 +55,10 @@ ENDMACRO(ADD_UNIT_TEST) + + ################################################################################ + # Set general directories +-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/..) ++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) + SET(OPLK_SOURCE_DIR ${OPLK_BASE_DIR}/stack/src) + SET(OPLK_INCLUDE_DIR ${OPLK_BASE_DIR}/stack/include) +-SET(TEST_COMMON_SOURCE_DIR ${CMAKE_SOURCE_DIR}/common) ++SET(TEST_COMMON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common) + + # We need a oplkcfg.h file for compiling the sources + # We are using the project for the complete MN library +-- +2.4.3 + diff --git a/package/openpowerlink/0004-Use-PROJECT_NAME-instead-of-CMAKE_PROJECT_NAME.patch b/package/openpowerlink/0004-Use-PROJECT_NAME-instead-of-CMAKE_PROJECT_NAME.patch new file mode 100644 index 0000000000..3957cd1ebd --- /dev/null +++ b/package/openpowerlink/0004-Use-PROJECT_NAME-instead-of-CMAKE_PROJECT_NAME.patch @@ -0,0 +1,125 @@ +From 7aace6a9d28b02c4325610255dc8afe198f02c4d Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Wed, 12 Aug 2015 10:54:32 +0200 +Subject: [PATCH] Use PROJECT_NAME instead of CMAKE_PROJECT_NAME + +In order to support a top level CMakeLists.txt, use the current project +name instead of the top level one. + +This patch has been submitted upstream: +https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57 + +Signed-off-by: Romain Naour +--- + apps/demo_cn_console/CMakeLists.txt | 2 +- + apps/demo_cn_console/linux.cmake | 2 +- + apps/demo_mn_console/CMakeLists.txt | 4 ++-- + apps/demo_mn_console/linux.cmake | 2 +- + apps/demo_mn_qt/CMakeLists.txt | 4 ++-- + apps/demo_mn_qt/linux.cmake | 2 +- + drivers/linux/drv_daemon_pcap/CMakeLists.txt | 2 +- + drivers/linux/drv_kernelmod_edrv/CMakeLists.txt | 10 +++++----- + 8 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/apps/demo_cn_console/CMakeLists.txt b/apps/demo_cn_console/CMakeLists.txt +index cd3b418..c5a47a8 100644 +--- a/apps/demo_cn_console/CMakeLists.txt ++++ b/apps/demo_cn_console/CMakeLists.txt +@@ -112,6 +112,6 @@ TARGET_LINK_LIBRARIES(demo_cn_console ${ARCH_LIBRARIES}) + ################################################################################ + # Installation rules + +-INSTALL(TARGETS demo_cn_console RUNTIME DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(TARGETS demo_cn_console RUNTIME DESTINATION ${PROJECT_NAME}) + + +diff --git a/apps/demo_cn_console/linux.cmake b/apps/demo_cn_console/linux.cmake +index 409bf11..76e381d 100644 +--- a/apps/demo_cn_console/linux.cmake ++++ b/apps/demo_cn_console/linux.cmake +@@ -53,5 +53,5 @@ SET (ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt) + ################################################################################ + # Set architecture specific installation files + +-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME}) + +diff --git a/apps/demo_mn_console/CMakeLists.txt b/apps/demo_mn_console/CMakeLists.txt +index 0c54a98..d8df68e 100644 +--- a/apps/demo_mn_console/CMakeLists.txt ++++ b/apps/demo_mn_console/CMakeLists.txt +@@ -120,6 +120,6 @@ TARGET_LINK_LIBRARIES(demo_mn_console ${ARCH_LIBRARIES}) + ################################################################################ + # Installation rules + +-INSTALL(TARGETS demo_mn_console RUNTIME DESTINATION ${CMAKE_PROJECT_NAME}) +-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(TARGETS demo_mn_console RUNTIME DESTINATION ${PROJECT_NAME}) ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${PROJECT_NAME}) + +diff --git a/apps/demo_mn_console/linux.cmake b/apps/demo_mn_console/linux.cmake +index a9e9072..a994928 100644 +--- a/apps/demo_mn_console/linux.cmake ++++ b/apps/demo_mn_console/linux.cmake +@@ -53,5 +53,5 @@ SET (ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt) + ################################################################################ + # Set architecture specific installation files + +-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME}) + +diff --git a/apps/demo_mn_qt/CMakeLists.txt b/apps/demo_mn_qt/CMakeLists.txt +index ff3a9aa..282a9d8 100644 +--- a/apps/demo_mn_qt/CMakeLists.txt ++++ b/apps/demo_mn_qt/CMakeLists.txt +@@ -161,5 +161,5 @@ TARGET_LINK_LIBRARIES(demo_mn_qt ${ARCH_LIBRARIES} ${QT_LIBRARIES}) + ################################################################################ + # Installation rules + +-INSTALL(TARGETS demo_mn_qt RUNTIME DESTINATION ${CMAKE_PROJECT_NAME}) +-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(TARGETS demo_mn_qt RUNTIME DESTINATION ${PROJECT_NAME}) ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${PROJECT_NAME}) +diff --git a/apps/demo_mn_qt/linux.cmake b/apps/demo_mn_qt/linux.cmake +index 6f19ff2..6ed75ee 100644 +--- a/apps/demo_mn_qt/linux.cmake ++++ b/apps/demo_mn_qt/linux.cmake +@@ -45,5 +45,5 @@ SET(ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt) + ################################################################################ + # Set architecture specific installation files + +-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME}) + +diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt +index 9041e4d..2702abd 100644 +--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt ++++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt +@@ -136,5 +136,5 @@ SET_PROPERTY(TARGET ${EXE_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEB + TARGET_LINK_LIBRARIES(${EXE_NAME} ${OPLKLIB} ${ARCH_LIBRARIES}) + + # add installation rules +-INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${PROJECT_NAME}) + +diff --git a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt +index af85f86..59400c0 100644 +--- a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt ++++ b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt +@@ -301,8 +301,8 @@ ADD_CUSTOM_TARGET( + ################################################################################ + # add installation rules + +-INSTALL(FILES ${MODULE_OUTPUT_DIR}/${MODULE_NAME}.ko DESTINATION ${CMAKE_PROJECT_NAME}) +-INSTALL(FILES ${TOOLS_DIR}/linux/50-openPOWERLINK.rules DESTINATION ${CMAKE_PROJECT_NAME}) +-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkload DESTINATION ${CMAKE_PROJECT_NAME}) +-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkunload DESTINATION ${CMAKE_PROJECT_NAME}) +-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/devices.txt DESTINATION ${CMAKE_PROJECT_NAME}) ++INSTALL(FILES ${MODULE_OUTPUT_DIR}/${MODULE_NAME}.ko DESTINATION ${PROJECT_NAME}) ++INSTALL(FILES ${TOOLS_DIR}/linux/50-openPOWERLINK.rules DESTINATION ${PROJECT_NAME}) ++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkload DESTINATION ${PROJECT_NAME}) ++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkunload DESTINATION ${PROJECT_NAME}) ++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/devices.txt DESTINATION ${PROJECT_NAME}) +-- +2.4.3 + diff --git a/package/openpowerlink/0005-Add-top-level-CMakeLists.txt.patch b/package/openpowerlink/0005-Add-top-level-CMakeLists.txt.patch new file mode 100644 index 0000000000..259a81a40d --- /dev/null +++ b/package/openpowerlink/0005-Add-top-level-CMakeLists.txt.patch @@ -0,0 +1,193 @@ +From 6f4bcf829efe5ce31592003e049606ae1de05e90 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Wed, 12 Aug 2015 11:24:24 +0200 +Subject: [PATCH] Add top level CMakeLists.txt + +This CMakeLists.txt can be used to build openpowerlink +using a automated build system. + +Don't use FIND_LIBRARY when the stack is built from a top +level build (ie CFG_OPLK_LIB is ON). +For a top level build, CMake will automatically add a build +dependency on oplk libraries for building demos applications. + +Also replace OPLKLIB_DEBUG by OPLKLIB in OPLK_LINK_LIBRARIES macro +if CMAKE_BUILD_TYPE is "Debug", otherwise TARGET_LINK_LIBRARIES can't +find the openpowerlink library. +This issue may be related to: +https://github.com/OpenAutomationTechnologies/openPOWERLINK_V2/issues/109 + +Fixes: +http://autobuild.buildroot.net/results/da4/da445b65cb136d71577f04e3a17fdb2ef6302a9b + +This patch has not been accepted by upstream: +https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57 + +Signed-off-by: Romain Naour +--- + CMakeLists.txt | 36 +++++++++++++++ + apps/common/cmake/findoplklib.cmake | 68 +++++++++++++++------------- + apps/common/cmake/linkoplklib.cmake | 2 +- + drivers/linux/drv_daemon_pcap/CMakeLists.txt | 12 +++-- + 4 files changed, 83 insertions(+), 35 deletions(-) + create mode 100644 CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..96e3d0f +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,36 @@ ++ ++CMAKE_MINIMUM_REQUIRED (VERSION 2.8.7) ++ ++#### LIB #### ++ ++IF (CFG_OPLK_LIB) ++ ADD_SUBDIRECTORY("stack") ++ENDIF (CFG_OPLK_LIB) ++ ++#### Linux kernel module #### ++ ++IF (CFG_KERNEL_DRIVERS) ++ ADD_SUBDIRECTORY("drivers/linux/drv_kernelmod_edrv") ++ENDIF (CFG_KERNEL_DRIVERS) ++ ++#### Pcap userspace driver #### ++ ++IF (CFG_PCAP_DAEMON) ++ ADD_SUBDIRECTORY("drivers/linux/drv_daemon_pcap") ++ENDIF (CFG_PCAP_DAEMON) ++ ++#### OpenPowerLink Demos #### ++ ++# Add subdirectory of CN console demo application ++IF (CFG_DEMO_CN_CONSOLE) ++ ADD_SUBDIRECTORY("apps/demo_cn_console") ++ENDIF (CFG_DEMO_CN_CONSOLE) ++ ++# Add subdirectory of MN console demo application ++IF (CFG_DEMO_MN_CONSOLE) ++ ADD_SUBDIRECTORY("apps/demo_mn_console") ++ENDIF (CFG_DEMO_MN_CONSOLE) ++ ++IF (CFG_DEMO_MN_QT) ++ ADD_SUBDIRECTORY("apps/demo_mn_qt") ++ENDIF (CFG_DEMO_MN_QT) +diff --git a/apps/common/cmake/findoplklib.cmake b/apps/common/cmake/findoplklib.cmake +index 1bf570e..79ea35b 100644 +--- a/apps/common/cmake/findoplklib.cmake ++++ b/apps/common/cmake/findoplklib.cmake +@@ -81,36 +81,42 @@ MACRO(FIND_OPLK_LIBRARY OPLK_NODE_TYPE) + # Set oplk library directory + SET(OPLKLIB_DIR ${OPLK_BASE_DIR}/stack/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR}) + +- IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Release")) +- # Search for release library +- UNSET(OPLKLIB CACHE) +- MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_NAME} in ${OPLKLIB_DIR}") +- FIND_LIBRARY(OPLKLIB NAME ${OPLKLIB_NAME} +- HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME}) +- +- IF(CMAKE_SYSTEM_NAME STREQUAL "Windows") +- +- UNSET(OPLKDLL CACHE) +- FIND_PROGRAM(OPLKDLL NAME ${OPLKLIB_NAME}.dll +- HINTS ${OPLKLIB_DIR}) +- +- ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows") +- ENDIF() +- +- IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Debug")) +- # Search for debug library +- UNSET(OPLKLIB_DEBUG CACHE) +- MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_DEBUG_NAME} in ${OPLKLIB_DIR}") +- FIND_LIBRARY(OPLKLIB_DEBUG NAME ${OPLKLIB_DEBUG_NAME} +- HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME}) +- +- IF(CMAKE_SYSTEM_NAME STREQUAL "Windows") +- +- UNSET(OPLKDLL_DEBUG CACHE) +- FIND_PROGRAM(OPLKDLL_DEBUG NAME ${OPLKLIB_DEBUG_NAME}.dll +- HINTS ${OPLKLIB_DIR}) +- +- ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows") +- ENDIF() ++ # Don't look for oplk libraries for a top level build ++ IF(CFG_OPLK_LIB) ++ SET(OPLKLIB ${OPLKLIB_NAME}) ++ SET(OPLKLIB_DEBUG ${OPLKLIB_DEBUG_NAME}) ++ ELSE(CFG_OPLK_LIB) ++ IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Release")) ++ # Search for release library ++ UNSET(OPLKLIB CACHE) ++ MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_NAME} in ${OPLKLIB_DIR}") ++ FIND_LIBRARY(OPLKLIB NAME ${OPLKLIB_NAME} ++ HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME}) ++ ++ IF(CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ ++ UNSET(OPLKDLL CACHE) ++ FIND_PROGRAM(OPLKDLL NAME ${OPLKLIB_NAME}.dll ++ HINTS ${OPLKLIB_DIR}) ++ ++ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ ENDIF() ++ ++ IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Debug")) ++ # Search for debug library ++ UNSET(OPLKLIB_DEBUG CACHE) ++ MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_DEBUG_NAME} in ${OPLKLIB_DIR}") ++ FIND_LIBRARY(OPLKLIB_DEBUG NAME ${OPLKLIB_DEBUG_NAME} ++ HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME}) ++ ++ IF(CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ ++ UNSET(OPLKDLL_DEBUG CACHE) ++ FIND_PROGRAM(OPLKDLL_DEBUG NAME ${OPLKLIB_DEBUG_NAME}.dll ++ HINTS ${OPLKLIB_DIR}) ++ ++ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ ENDIF() ++ ENDIF(CFG_OPLK_LIB) + + ENDMACRO(FIND_OPLK_LIBRARY) +diff --git a/apps/common/cmake/linkoplklib.cmake b/apps/common/cmake/linkoplklib.cmake +index 49aab66..d9fd418 100644 +--- a/apps/common/cmake/linkoplklib.cmake ++++ b/apps/common/cmake/linkoplklib.cmake +@@ -33,7 +33,7 @@ MACRO(OPLK_LINK_LIBRARIES EXECUTABLE_NAME) + TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} optimized ${OPLKLIB} debug ${OPLKLIB_DEBUG}) + ELSE() + IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug") +- TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} debug ${OPLKLIB_DEBUG}) ++ TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} debug ${OPLKLIB}) + ELSE () + TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} optimized ${OPLKLIB}) + ENDIF() +diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt +index 2702abd..81bb598 100644 +--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt ++++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt +@@ -104,9 +104,15 @@ ENDIF() + SET(OPLKLIB_DIR ${OPLK_BASE_DIR}/stack/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR}) + SET(OPLKLIB_INCDIR ${OPLK_BASE_DIR}/stack/proj/${SYSTEM_NAME_DIR}/lib${LIB_NAME}) + +-UNSET(OPLKLIB CACHE) +-FIND_LIBRARY(OPLKLIB NAME ${LIB_NAME}${BUILD_TYPE_EXT} +- HINTS ${OPLKLIB_DIR}) ++# Don't look for oplk libraries for a top level build ++IF(CFG_OPLK_LIB) ++ SET(OPLKLIB ${LIB_NAME}${BUILD_TYPE_EXT}) ++ELSE(CFG_OPLK_LIB) ++ UNSET(OPLKLIB CACHE) ++ FIND_LIBRARY(OPLKLIB NAME ${LIB_NAME}${BUILD_TYPE_EXT} ++ HINTS ${OPLKLIB_DIR}) ++ENDIF(CFG_OPLK_LIB) ++ + INCLUDE_DIRECTORIES(${OPLKLIB_INCDIR}) + + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99 -pthread -fno-strict-aliasing") +-- +2.5.5 + diff --git a/package/openpowerlink/0006-veth-avoid-kernel-header-issue-with-musl.patch b/package/openpowerlink/0006-veth-avoid-kernel-header-issue-with-musl.patch new file mode 100644 index 0000000000..383f047588 --- /dev/null +++ b/package/openpowerlink/0006-veth-avoid-kernel-header-issue-with-musl.patch @@ -0,0 +1,91 @@ +From 42a95209c5650662b86d222678ec14e7edfae156 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Wed, 25 May 2016 13:26:49 +0200 +Subject: [PATCH] veth: avoid kernel header issue with musl + +The Virtual Ethernet driver doesn't build when the musl libc is used on the +system. As stated in the musl wiki [1], the userspace and kernel headers are +mixed leading to a "clash" with the definitions provided by musl. + +Remove netinet/if_ether.h userspace header and replace ETHER_ADDR_LEN by +ETH_ALEN [2] and ETHERMTU by ETH_DATA_LEN [3] in veth-linuxuser.c. + +Fixes: +http://autobuild.buildroot.org/results/2ca/2ca04bb046263e479e7597867b56469893d3c11d/build-end.log + +Upsteam status: pending +https://github.com/OpenAutomationTechnologies/openPOWERLINK_V2/pull/120 + +[Rebase on v2.2.2] +[1] http://wiki.musl-libc.org/wiki/FAQ#Q:_why_am_i_getting_.22error:_redefinition_of_struct_ethhdr.2Ftcphdr.2Fetc.22_.3F +[2] https://git.musl-libc.org/cgit/musl/tree/include/net/ethernet.h?h=v1.1.14#n35 +[3] https://git.musl-libc.org/cgit/musl/tree/include/net/ethernet.h?h=v1.1.14#n48 + +Signed-off-by: Romain Naour +--- + stack/src/kernel/veth/veth-linuxuser.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/stack/src/kernel/veth/veth-linuxuser.c b/stack/src/kernel/veth/veth-linuxuser.c +index 2a0bdd0..2bfaa87 100644 +--- a/stack/src/kernel/veth/veth-linuxuser.c ++++ b/stack/src/kernel/veth/veth-linuxuser.c +@@ -61,7 +61,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + #include + #include +-#include + + //============================================================================// + // G L O B A L D E F I N I T I O N S // +@@ -248,7 +247,7 @@ static void getMacAdrs(UINT8* pMac_p) + + close(sock); + +- OPLK_MEMCPY(pMac_p, &ifr.ifr_hwaddr.sa_data[0], ETHER_ADDR_LEN); ++ OPLK_MEMCPY(pMac_p, &ifr.ifr_hwaddr.sa_data[0], ETH_ALEN); + } + + //------------------------------------------------------------------------------ +@@ -272,9 +271,9 @@ static tOplkError veth_receiveFrame(tFrameInfo* pFrameInfo_p, + + // replace the MAC address of the POWERLINK Ethernet interface with virtual + // Ethernet MAC address before forwarding it into the virtual Ethernet interface +- if (OPLK_MEMCMP(pFrameInfo_p->pFrame->aDstMac, vethInstance_l.macAdrs, ETHER_ADDR_LEN) == 0) ++ if (OPLK_MEMCMP(pFrameInfo_p->pFrame->aDstMac, vethInstance_l.macAdrs, ETH_ALEN) == 0) + { +- OPLK_MEMCPY(pFrameInfo_p->pFrame->aDstMac, vethInstance_l.tapMacAdrs, ETHER_ADDR_LEN); ++ OPLK_MEMCPY(pFrameInfo_p->pFrame->aDstMac, vethInstance_l.tapMacAdrs, ETH_ALEN); + } + + nwrite = write(vethInstance_l.fd, pFrameInfo_p->pFrame, pFrameInfo_p->frameSize); +@@ -302,7 +301,7 @@ to be used as a thread which does a blocking read in a while loop. + //------------------------------------------------------------------------------ + static void* vethRecvThread(void* pArg_p) + { +- UINT8 buffer[ETHERMTU]; ++ UINT8 buffer[ETH_DATA_LEN]; + UINT nread; + tFrameInfo frameInfo; + tOplkError ret = kErrorOk; +@@ -331,7 +330,7 @@ static void* vethRecvThread(void* pArg_p) + break; + + default: // data from tun/tap ready for read +- nread = read(pInstance->fd, buffer, ETHERMTU); ++ nread = read(pInstance->fd, buffer, ETH_DATA_LEN); + if (nread > 0) + { + DEBUG_LVL_VETH_TRACE("VETH:Read %d bytes from the tap interface\n", nread); +@@ -340,7 +339,7 @@ static void* vethRecvThread(void* pArg_p) + DEBUG_LVL_VETH_TRACE("DST MAC: %02X:%02X:%02x:%02X:%02X:%02x\n", + buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); + // replace src MAC address with MAC address of virtual Ethernet interface +- OPLK_MEMCPY(&buffer[6], pInstance->macAdrs, ETHER_ADDR_LEN); ++ OPLK_MEMCPY(&buffer[6], pInstance->macAdrs, ETH_ALEN); + + frameInfo.pFrame = (tPlkFrame *)buffer; + frameInfo.frameSize = nread; +-- +2.5.5 + diff --git a/package/pcre/0001-no-compat.patch b/package/pcre/0001-no-compat.patch new file mode 100644 index 0000000000..7099727737 --- /dev/null +++ b/package/pcre/0001-no-compat.patch @@ -0,0 +1,31 @@ +Kill ABI compatibility bits, we don't need them. +Fixes build failures on non-ELF (blackfin) targets. + +Signed-off-by: Gustavo Zacarias + +diff -Nura pcre-8.32.orig/pcrecpp.cc pcre-8.32/pcrecpp.cc +--- pcre-8.32.orig/pcrecpp.cc 2012-12-28 08:32:10.193847937 -0300 ++++ pcre-8.32/pcrecpp.cc 2012-12-28 08:32:26.924376180 -0300 +@@ -58,22 +58,6 @@ + // Special object that stands-in for no argument + Arg RE::no_arg((void*)NULL); + +-// This is for ABI compatibility with old versions of pcre (pre-7.6), +-// which defined a global no_arg variable instead of putting it in the +-// RE class. This works on GCC >= 3, at least. It definitely works +-// for ELF, but may not for other object formats (Mach-O, for +-// instance, does not support aliases.) We could probably have a more +-// inclusive test if we ever needed it. (Note that not only the +-// __attribute__ syntax, but also __USER_LABEL_PREFIX__, are +-// gnu-specific.) +-#if defined(__GNUC__) && __GNUC__ >= 3 && defined(__ELF__) +-# define ULP_AS_STRING(x) ULP_AS_STRING_INTERNAL(x) +-# define ULP_AS_STRING_INTERNAL(x) #x +-# define USER_LABEL_PREFIX_STR ULP_AS_STRING(__USER_LABEL_PREFIX__) +-extern Arg no_arg +- __attribute__((alias(USER_LABEL_PREFIX_STR "_ZN7pcrecpp2RE6no_argE"))); +-#endif +- + // If a regular expression has no error, its error_ field points here + static const string empty_string; + diff --git a/package/pcre/0002-no-cpp-tests.patch b/package/pcre/0002-no-cpp-tests.patch new file mode 100644 index 0000000000..0255028fb6 --- /dev/null +++ b/package/pcre/0002-no-cpp-tests.patch @@ -0,0 +1,31 @@ +Disable PCRE C++ unit tests, they fail to build on static scenarios +and they're not installed. + +Signed-off-by: Gustavo Zacarias + +diff -Nura pcre-8.33.orig/Makefile.in pcre-8.33/Makefile.in +--- pcre-8.33.orig/Makefile.in 2013-05-28 06:09:27.000000000 -0300 ++++ pcre-8.33/Makefile.in 2013-09-03 11:28:28.398198832 -0300 +@@ -123,12 +123,6 @@ + @WITH_PCRE8_TRUE@am__append_20 = libpcreposix.la + @WITH_GCOV_TRUE@@WITH_PCRE8_TRUE@am__append_21 = $(GCOV_CFLAGS) + @WITH_PCRE_CPP_TRUE@am__append_22 = libpcrecpp.la +-@WITH_PCRE_CPP_TRUE@am__append_23 = pcrecpp_unittest \ +-@WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest \ +-@WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest +-@WITH_PCRE_CPP_TRUE@am__append_24 = pcrecpp_unittest \ +-@WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest \ +-@WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest + @WITH_GCOV_TRUE@@WITH_PCRE_CPP_TRUE@am__append_25 = $(GCOV_CXXFLAGS) + @WITH_GCOV_TRUE@@WITH_PCRE_CPP_TRUE@am__append_26 = $(GCOV_LIBS) + @WITH_GCOV_TRUE@@WITH_PCRE_CPP_TRUE@am__append_27 = $(GCOV_LIBS) +@@ -360,9 +354,6 @@ + @WITH_PCRE8_TRUE@am__EXEEXT_1 = pcregrep$(EXEEXT) + @WITH_REBUILD_CHARTABLES_TRUE@am__EXEEXT_2 = dftables$(EXEEXT) + @WITH_JIT_TRUE@am__EXEEXT_3 = pcre_jit_test$(EXEEXT) +-@WITH_PCRE_CPP_TRUE@am__EXEEXT_4 = pcrecpp_unittest$(EXEEXT) \ +-@WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest$(EXEEXT) \ +-@WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest$(EXEEXT) + PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + am__dftables_SOURCES_DIST = dftables.c + @WITH_REBUILD_CHARTABLES_TRUE@am_dftables_OBJECTS = \ diff --git a/package/perl-db-file/Config.in b/package/perl-db-file/Config.in new file mode 100644 index 0000000000..f07e5df483 --- /dev/null +++ b/package/perl-db-file/Config.in @@ -0,0 +1,11 @@ +config BR2_PACKAGE_PERL_DB_FILE + bool "perl-db-file" + depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_BERKELEYDB + help + Perl5 access to Berkeley DB version 1.x or 2.x. + + https://metacpan.org/release/DB_File + +comment "perl-db-file needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS diff --git a/package/perl-db-file/perl-db-file.hash b/package/perl-db-file/perl-db-file.hash new file mode 100644 index 0000000000..df0113c8b9 --- /dev/null +++ b/package/perl-db-file/perl-db-file.hash @@ -0,0 +1,3 @@ +# retrieved by scancpan from http://cpan.metacpan.org/ +md5 0ae7910cabc31a44e50b713a8a475514 DB_File-1.835.tar.gz +sha256 41206f39a1bac49db8c1595e300b04c70e1393b2d78ccb9ef15c5c0b81037cfc DB_File-1.835.tar.gz diff --git a/package/perl-db-file/perl-db-file.mk b/package/perl-db-file/perl-db-file.mk new file mode 100644 index 0000000000..3db8c563cb --- /dev/null +++ b/package/perl-db-file/perl-db-file.mk @@ -0,0 +1,22 @@ +################################################################################ +# +# perl-db-file +# +################################################################################ + +PERL_DB_FILE_VERSION = 1.835 +PERL_DB_FILE_SOURCE = DB_File-$(PERL_DB_FILE_VERSION).tar.gz +PERL_DB_FILE_SITE = $(BR2_CPAN_MIRROR)/authors/id/P/PM/PMQS +PERL_DB_FILE_DEPENDENCIES = berkeleydb +PERL_DB_FILE_LICENSE = Artistic or GPLv1+ +PERL_DB_FILE_LICENSE_FILES = README + +define PERL_DB_FILE_FIX_CONFIG_IN + $(SED) 's%^INCLUDE.*%INCLUDE = $(STAGING_DIR)/usr/include%' \ + $(@D)/config.in + $(SED) 's%^LIB.*%LIB = $(STAGING_DIR)/usr/lib%' \ + $(@D)/config.in +endef +PERL_DB_FILE_POST_PATCH_HOOKS += PERL_DB_FILE_FIX_CONFIG_IN + +$(eval $(perl-package)) diff --git a/package/php/0001-ditch-unset.patch b/package/php/0001-ditch-unset.patch new file mode 100644 index 0000000000..eda83c95a3 --- /dev/null +++ b/package/php/0001-ditch-unset.patch @@ -0,0 +1,26 @@ +Unsetting ac_cv_{func,lib}_* is bad, you can't feed the configure cache. +Terminate them with extreme prejudice. + +Signed-off-by: Gustavo Zacarias + +diff -Nura php-5.6.8.orig/acinclude.m4 php-5.6.8/acinclude.m4 +--- php-5.6.8.orig/acinclude.m4 2015-04-15 20:05:57.000000000 +0200 ++++ php-5.6.8/acinclude.m4 2015-05-18 20:03:50.833099001 +0200 +@@ -1897,8 +1897,6 @@ + dnl + AC_DEFUN([PHP_CHECK_FUNC_LIB],[ + ifelse($2,,:,[ +- unset ac_cv_lib_$2[]_$1 +- unset ac_cv_lib_$2[]___$1 + unset found + AC_CHECK_LIB($2, $1, [found=yes], [ + AC_CHECK_LIB($2, __$1, [found=yes], [found=no]) +@@ -1930,8 +1928,6 @@ + dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS. + dnl + AC_DEFUN([PHP_CHECK_FUNC],[ +- unset ac_cv_func_$1 +- unset ac_cv_func___$1 + unset found + + AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ]) diff --git a/package/php/0002-no-iconv-search.patch b/package/php/0002-no-iconv-search.patch new file mode 100644 index 0000000000..32aa7f5f88 --- /dev/null +++ b/package/php/0002-no-iconv-search.patch @@ -0,0 +1,55 @@ +Tweak PHP_SETUP_ICONV from aclocal/acinclude.m4 to not +PHP_ADD_INCLUDE $ICONV_DIR/include since the tests use +test instead of AC_TRY_LINK to find headers which is bad, +specially when adding /usr and /usr/local to the mix. +Do basically the same with ext/iconv/config.m4 by tweaking +PHP_ICONV_H_PATH which, again, uses test and absolute paths. + +Signed-off-by: Gustavo Zacarias +[Gustavo: convert to nice m4 instead of patching configure] +[Gustavo: update for 5.6.10] + +diff -Nura php-5.6.10.orig/acinclude.m4 php-5.6.10/acinclude.m4 +--- php-5.6.10.orig/acinclude.m4 2015-06-12 16:09:06.274355813 -0300 ++++ php-5.6.10/acinclude.m4 2015-06-12 16:10:10.884544865 -0300 +@@ -2474,7 +2474,7 @@ + dnl + if test "$found_iconv" = "no"; then + +- for i in $PHP_ICONV /usr/local /usr; do ++ for i in $PHP_ICONV; do + if test -r $i/include/giconv.h; then + AC_DEFINE(HAVE_GICONV_H, 1, [ ]) + ICONV_DIR=$i +diff -Nura php-5.6.10.orig/ext/iconv/config.m4 php-5.6.10/ext/iconv/config.m4 +--- php-5.6.10.orig/ext/iconv/config.m4 2015-06-12 16:09:07.792407246 -0300 ++++ php-5.6.10/ext/iconv/config.m4 2015-06-12 16:11:07.752471600 -0300 +@@ -14,28 +14,6 @@ + ]) + + if test "$iconv_avail" != "no"; then +- if test -z "$ICONV_DIR"; then +- for i in /usr/local /usr; do +- if test -f "$i/include/iconv.h" || test -f "$i/include/giconv.h"; then +- PHP_ICONV_PREFIX="$i" +- break +- fi +- done +- if test -z "$PHP_ICONV_PREFIX"; then +- PHP_ICONV_PREFIX="/usr" +- fi +- else +- PHP_ICONV_PREFIX="$ICONV_DIR" +- fi +- +- CFLAGS="-I$PHP_ICONV_PREFIX/include $CFLAGS" +- LDFLAGS="-L$PHP_ICONV_PREFIX/$PHP_LIBDIR $LDFLAGS" +- +- if test -r "$PHP_ICONV_PREFIX/include/giconv.h"; then +- PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/giconv.h" +- else +- PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/iconv.h" +- fi + + AC_MSG_CHECKING([if iconv is glibc's]) + AC_TRY_LINK([#include ],[gnu_get_libc_version();], diff --git a/package/php/0003-disable-pharcmd.patch b/package/php/0003-disable-pharcmd.patch new file mode 100644 index 0000000000..bfcc956343 --- /dev/null +++ b/package/php/0003-disable-pharcmd.patch @@ -0,0 +1,27 @@ +Disable the 'phar' command-line tool build/installation since it requires +php to run and pack up phar itself in phar format. This would require +a host-php instance and really probably nobody needs the phar tool +on the target. + +Signed-off-by: Gustavo Zacarias +[Gustavo: update for autoreconf/configure.in] + +diff -Nura php-5.6.7.orig/configure.in php-5.6.7/configure.in +--- php-5.6.7.orig/configure.in 2015-04-08 11:08:10.815835010 -0300 ++++ php-5.6.7/configure.in 2015-04-08 11:16:20.460467444 -0300 +@@ -1437,13 +1437,8 @@ + INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag" + CXXFLAGS="$CXXFLAGS $standard_libtool_flag" + +-if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then +- pharcmd=pharcmd +- pharcmd_install=install-pharcmd +-else +- pharcmd= +- pharcmd_install= +-fi; ++pharcmd= ++pharcmd_install= + + all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd" + install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install" diff --git a/package/php/0004-flock-type-linux.patch b/package/php/0004-flock-type-linux.patch new file mode 100644 index 0000000000..a03c2624a7 --- /dev/null +++ b/package/php/0004-flock-type-linux.patch @@ -0,0 +1,48 @@ +OPcache: flock mechanism is obviously linux so force it. + +Signed-off-by: Gustavo Zacarias + +diff -Nura php-5.6.7.orig/ext/opcache/config.m4 php-5.6.7/ext/opcache/config.m4 +--- php-5.6.7.orig/ext/opcache/config.m4 2015-04-08 11:08:11.125845540 -0300 ++++ php-5.6.7/ext/opcache/config.m4 2015-04-08 11:57:23.648831436 -0300 +@@ -326,38 +326,8 @@ + msg=yes,msg=no,msg=no) + AC_MSG_RESULT([$msg]) + +-flock_type=unknown +-AC_MSG_CHECKING("whether flock struct is linux ordered") +-AC_TRY_RUN([ +- #include +- struct flock lock = { 1, 2, 3, 4, 5 }; +- int main() { +- if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 3 && lock.l_len == 4) { +- return 0; +- } +- return 1; +- } +-], [ +- flock_type=linux +- AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) +- AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) +- +-AC_MSG_CHECKING("whether flock struct is BSD ordered") +-AC_TRY_RUN([ +- #include +- struct flock lock = { 1, 2, 3, 4, 5 }; +- int main() { +- if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) { +- return 0; +- } +- return 1; +- } +-], [ +- flock_type=bsd +- AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) +- AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++flock_type=linux ++AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) + + if test "$flock_type" == "unknown"; then + AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) diff --git a/package/php/0005-ac-cache-strcasestr.patch b/package/php/0005-ac-cache-strcasestr.patch new file mode 100644 index 0000000000..8a8c5d86ff --- /dev/null +++ b/package/php/0005-ac-cache-strcasestr.patch @@ -0,0 +1,24 @@ +Allow cache answer for strcasestr discovery. + +Signed-off-by: Gustavo Zacarias + +diff -Nura php-5.6.7.orig/ext/fileinfo/config.m4 php-5.6.7/ext/fileinfo/config.m4 +--- php-5.6.7.orig/ext/fileinfo/config.m4 2015-04-08 22:19:45.798770792 -0300 ++++ php-5.6.7/ext/fileinfo/config.m4 2015-04-08 22:26:33.110654338 -0300 +@@ -14,6 +14,7 @@ + libmagic/readcdf.c libmagic/softmagic.c" + + AC_MSG_CHECKING([for strcasestr]) ++ AC_CACHE_VAL(ac_cv_func_strcasestr, + AC_TRY_RUN([ + #include + #include +@@ -46,7 +47,7 @@ + AC_MSG_RESULT(no) + AC_MSG_NOTICE(using libmagic strcasestr implementation) + libmagic_sources="$libmagic_sources libmagic/strcasestr.c" +- ]) ++ ])) + + PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic) + PHP_ADD_BUILD_DIR($ext_builddir/libmagic) diff --git a/package/php/0006-fix-php-fpm.service.in.patch b/package/php/0006-fix-php-fpm.service.in.patch new file mode 100644 index 0000000000..a182a2528b --- /dev/null +++ b/package/php/0006-fix-php-fpm.service.in.patch @@ -0,0 +1,35 @@ +From bb19125781c0794da9a63fee62e263ff4efff661 Mon Sep 17 00:00:00 2001 +From: Floris Bos +Date: Fri, 1 May 2015 15:28:55 +0200 +Subject: [PATCH] Fix php-fpm.service.in + +- Expand file paths. +- Remove obsolete After=syslog.target. Syslog is socket activated nowadays. + +Signed-off-by: Floris Bos +--- + sapi/fpm/php-fpm.service.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in +index a2df30e..c135f04 100644 +--- a/sapi/fpm/php-fpm.service.in ++++ b/sapi/fpm/php-fpm.service.in +@@ -1,11 +1,11 @@ + [Unit] + Description=The PHP FastCGI Process Manager +-After=syslog.target network.target ++After=network.target + + [Service] + Type=@php_fpm_systemd@ +-PIDFile=@localstatedir@/run/php-fpm.pid +-ExecStart=@sbindir@/php-fpm --nodaemonize --fpm-config @sysconfdir@/php-fpm.conf ++PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid ++ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf + ExecReload=/bin/kill -USR2 $MAINPID + + [Install] +-- +2.1.4 + diff --git a/package/poppler/0001-Fix-invalid-shell-comparaison-in-libtiff-test.patch b/package/poppler/0001-Fix-invalid-shell-comparaison-in-libtiff-test.patch new file mode 100644 index 0000000000..f40bee1dd4 --- /dev/null +++ b/package/poppler/0001-Fix-invalid-shell-comparaison-in-libtiff-test.patch @@ -0,0 +1,23 @@ +Fix syntax issue in configure script + +The change is not done in configure.ac, because the package doesn't +autoreconf properly. + +Patch on configure.ac submitted upstream at +https://bugs.freedesktop.org/show_bug.cgi?id=90292. + +Signed-off-by: Thomas Petazzoni + +Index: b/configure +=================================================================== +--- a/configure ++++ b/configure +@@ -19738,7 +19738,7 @@ + CXXFLAGS="$CXXFLAGS $LIBTIFF_CFLAGS" + LIBS="$LIBS $LIBTIFF_LIBS" + if test x$enable_libtiff = xyes; then +- if test x"$LIBTIFF_LIBS" != ; then ++ if test x"$LIBTIFF_LIBS" != x; then + ac_fn_cxx_check_func "$LINENO" "TIFFOpen" "ac_cv_func_TIFFOpen" + if test "x$ac_cv_func_TIFFOpen" = xyes; then : + diff --git a/package/protobuf/0001-Fix-GOOGLE_PROTOBUF_ATOMICOPS_ERROR-syntax-error.patch b/package/protobuf/0001-Fix-GOOGLE_PROTOBUF_ATOMICOPS_ERROR-syntax-error.patch new file mode 100644 index 0000000000..c271ea45d7 --- /dev/null +++ b/package/protobuf/0001-Fix-GOOGLE_PROTOBUF_ATOMICOPS_ERROR-syntax-error.patch @@ -0,0 +1,61 @@ +From 50982f711de6ad58f6e0bef01a75d2b9cf35f5dc Mon Sep 17 00:00:00 2001 +From: George Redivo +Date: Mon, 6 Jul 2015 16:56:41 -0300 +Subject: [PATCH 1/2] Fix GOOGLE_PROTOBUF_ATOMICOPS_ERROR syntax error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's not possible to define "#error" inside a define. +It causes 'error: stray ‘#’ in program' compilation error. + +Now the define GOOGLE_PROTOBUF_ATOMICOPS_ERROR is the error message +and it's used along the code together "#error". +--- + src/google/protobuf/stubs/atomicops.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h +index b1336e3..a130b38 100644 +--- a/src/google/protobuf/stubs/atomicops.h ++++ b/src/google/protobuf/stubs/atomicops.h +@@ -162,7 +162,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); + + // Include our platform specific implementation. + #define GOOGLE_PROTOBUF_ATOMICOPS_ERROR \ +-#error "Atomic operations are not supported on your platform" ++"Atomic operations are not supported on your platform" + + // ThreadSanitizer, http://clang.llvm.org/docs/ThreadSanitizer.html. + #if defined(THREAD_SANITIZER) +@@ -172,7 +172,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); + #if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64) + #include + #else +-GOOGLE_PROTOBUF_ATOMICOPS_ERROR ++#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR + #endif + + // Solaris +@@ -203,15 +203,15 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR + #if __has_extension(c_atomic) + #include + #else +-GOOGLE_PROTOBUF_ATOMICOPS_ERROR ++#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR + #endif + #else +-GOOGLE_PROTOBUF_ATOMICOPS_ERROR ++#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR + #endif + + // Unknown. + #else +-GOOGLE_PROTOBUF_ATOMICOPS_ERROR ++#error GOOGLE_PROTOBUF_ATOMICOPS_ERROR + #endif + + // On some platforms we need additional declarations to make AtomicWord +-- +2.5.0 + diff --git a/package/protobuf/0002-configure.ac-check-if-libatomic-is-needed.patch b/package/protobuf/0002-configure.ac-check-if-libatomic-is-needed.patch new file mode 100644 index 0000000000..a70a23e74e --- /dev/null +++ b/package/protobuf/0002-configure.ac-check-if-libatomic-is-needed.patch @@ -0,0 +1,34 @@ +From f020fe05a20dfcd16cd7df833dcf3cdeef770538 Mon Sep 17 00:00:00 2001 +From: Carlos Santos +Date: Thu, 11 Feb 2016 10:58:35 -0200 +Subject: [PATCH 2/2] configure.ac: check if libatomic is needed + +Compilation of protobuf for PowerPC and SPARC may fail due to missing +references to __atomic_fetch_add_4 and __atomic_compare_exchange_4. + +The __atomic_*() intrinsics for all sizes are provided by libatomic when +gcc is >= 4.8. This can be achieved by adding this to configure.ac: + + AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic]) + +Signed-off-by: Carlos Santos +--- + configure.ac | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.ac b/configure.ac +index c07067c..88d4a0d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -139,6 +139,8 @@ AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"]) + ACX_PTHREAD + AC_CXX_STL_HASH + ++AC_SEARCH_LIBS([__atomic_load_4], [atomic]) ++ + case "$target_os" in + mingw* | cygwin* | win*) + ;; +-- +2.5.0 + diff --git a/package/python-pillow/python-pillow-01-crosscompiling.patch b/package/python-pillow/python-pillow-01-crosscompiling.patch new file mode 100644 index 0000000000..0a7da3d74c --- /dev/null +++ b/package/python-pillow/python-pillow-01-crosscompiling.patch @@ -0,0 +1,94 @@ +diff -Naur python-pillow-2.4.0.orig/setup.cfg python-pillow-2.4.0.new/setup.cfg +--- python-pillow-2.4.0.orig/setup.cfg 2014-04-01 18:34:28.000000000 +0300 ++++ python-pillow-2.4.0.new/setup.cfg 2014-06-26 16:15:43.711930729 +0300 +@@ -3,3 +3,12 @@ + tag_date = 0 + tag_svn_revision = 0 + ++[build_ext] ++plat-name = linux-arm ++disable-webp = ++disable-lcms = ++disable-freetype = ++disable-jpeg2000 = ++disable-tcl = ++disable-webpmux = ++disable-tiff = " +diff -Naur python-pillow-2.4.0.orig/setup.py python-pillow-2.4.0.new/setup.py +--- python-pillow-2.4.0.orig/setup.py 2014-04-01 18:21:44.000000000 +0300 ++++ python-pillow-2.4.0.new/setup.py 2014-06-26 16:20:38.494366591 +0300 +@@ -225,60 +225,6 @@ + _add_directory(library_dirs, "/usr/X11/lib") + _add_directory(include_dirs, "/usr/X11/include") + +- elif sys.platform.startswith("linux"): +- arch_tp = (plat.processor(), plat.architecture()[0]) +- if arch_tp == ("x86_64","32bit"): +- # 32 bit build on 64 bit machine. +- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") +- else: +- for platform_ in arch_tp: +- +- if not platform_: +- continue +- +- if platform_ in ["x86_64", "64bit"]: +- _add_directory(library_dirs, "/lib64") +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu") +- break +- elif platform_ in ["i386", "i686", "32bit"]: +- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") +- break +- elif platform_ in ["aarch64"]: +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory(library_dirs, "/usr/lib/aarch64-linux-gnu") +- break +- elif platform_ in ["arm", "armv7l"]: +- _add_directory(library_dirs, "/usr/lib/arm-linux-gnueabi") +- break +- elif platform_ in ["ppc64"]: +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory(library_dirs, "/usr/lib/ppc64-linux-gnu") +- _add_directory(library_dirs, "/usr/lib/powerpc64-linux-gnu") +- break +- elif platform_ in ["ppc"]: +- _add_directory(library_dirs, "/usr/lib/ppc-linux-gnu") +- _add_directory(library_dirs, "/usr/lib/powerpc-linux-gnu") +- break +- elif platform_ in ["s390x"]: +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory(library_dirs, "/usr/lib/s390x-linux-gnu") +- break +- elif platform_ in ["s390"]: +- _add_directory(library_dirs, "/usr/lib/s390-linux-gnu") +- break +- else: +- raise ValueError( +- "Unable to identify Linux platform: `%s`" % platform_) +- +- # XXX Kludge. Above /\ we brute force support multiarch. Here we +- # try Barry's more general approach. Afterward, something should +- # work ;-) +- self.add_multiarch_paths() +- +- elif sys.platform.startswith("gnu"): +- self.add_multiarch_paths() +- + elif sys.platform.startswith("netbsd"): + _add_directory(library_dirs, "/usr/pkg/lib") + _add_directory(include_dirs, "/usr/pkg/include") +@@ -323,13 +269,6 @@ + if os.path.isfile(os.path.join(tcl_dir, "tk.h")): + _add_directory(include_dirs, tcl_dir) + +- # standard locations +- _add_directory(library_dirs, "/usr/local/lib") +- _add_directory(include_dirs, "/usr/local/include") +- +- _add_directory(library_dirs, "/usr/lib") +- _add_directory(include_dirs, "/usr/include") +- + # on Windows, look for the OpenJPEG libraries in the location that + # the official installed puts them + if sys.platform == "win32": diff --git a/package/python-protobuf/0001-disable-unneeded-build-dependencies.patch b/package/python-protobuf/0001-disable-unneeded-build-dependencies.patch new file mode 100644 index 0000000000..3f0eabd23a --- /dev/null +++ b/package/python-protobuf/0001-disable-unneeded-build-dependencies.patch @@ -0,0 +1,37 @@ +From 7e7db7225e227905acabfa2149152ece21c93e70 Mon Sep 17 00:00:00 2001 +From: Steven Noonan +Date: Sun, 8 Nov 2015 09:03:00 -0800 +Subject: [PATCH] python-protobuf: don't require google-apputils + +This dependency is totally superfluous for successfully building/running +python-protobuf. It's only "required" at build time and is not staged into the +install directory, but it isn't even really required for a successful build. + +Signed-off-by: Steven Noonan +--- + python/setup.py | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/python/setup.py b/python/setup.py +index 2450a77..db6f497 100755 +--- a/python/setup.py ++++ b/python/setup.py +@@ -160,7 +160,6 @@ if __name__ == '__main__': + packages = [ 'google' ], + namespace_packages = [ 'google' ], + test_suite = 'setup.MakeTestSuite', +- google_test_dir = "google/protobuf/internal", + # Must list modules explicitly so that we don't install tests. + py_modules = [ + 'google.protobuf.internal.api_implementation', +@@ -189,7 +188,6 @@ if __name__ == '__main__': + 'google.protobuf.text_format'], + cmdclass = { 'clean': clean, 'build_py': build_py }, + install_requires = ['setuptools'], +- setup_requires = ['google-apputils'], + ext_modules = ext_module_list, + url = 'https://developers.google.com/protocol-buffers/', + maintainer = maintainer_email, +-- +2.6.2 + diff --git a/package/python-spidev/0001-Fix-build-with-musl-libc.patch b/package/python-spidev/0001-Fix-build-with-musl-libc.patch new file mode 100644 index 0000000000..b22a73aa67 --- /dev/null +++ b/package/python-spidev/0001-Fix-build-with-musl-libc.patch @@ -0,0 +1,43 @@ +From 3d6e59bff088783f249a60a5f1c900c7f99f933b Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls +Date: Sun, 31 Jan 2016 15:03:50 +0100 +Subject: [PATCH 1/1] Fix build with musl libc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Include missing header to prevent build error: + +spidev_module.c: In function ‘SpiDev_xfer’: +spidev_module.c:330:27: error: ‘_IOC_SIZEBITS’ undeclared (first use in this function) + status = ioctl(self->fd, SPI_IOC_MESSAGE(1), &xfer); + ^ +spidev_module.c:330:27: note: each undeclared identifier is reported only once for each function it appears in +spidev_module.c: In function ‘SpiDev_xfer2’: +spidev_module.c:421:27: error: ‘_IOC_SIZEBITS’ undeclared (first use in this function) + status = ioctl(self->fd, SPI_IOC_MESSAGE(1), &xfer); + ^ + +Signed-off-by: Bernd Kuhls bernd.kuhls@t-online.de +Signed-off-by: Bernd Kuhls +--- +Patch sent upstream: https://github.com/doceme/py-spidev/pull/39 + + spidev_module.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/spidev_module.c b/spidev_module.c +index d58ef07..bccaacf 100644 +--- a/spidev_module.c ++++ b/spidev_module.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #define SPIDEV_MAXPATH 4096 + +-- +2.7.0 + diff --git a/package/python3/0003-Make-the-build-of-pyc-and-pyo-files-conditional.patch b/package/python3/0003-Make-the-build-of-pyc-and-pyo-files-conditional.patch new file mode 100644 index 0000000000..03684afec5 --- /dev/null +++ b/package/python3/0003-Make-the-build-of-pyc-and-pyo-files-conditional.patch @@ -0,0 +1,78 @@ +From 7c5338161263c290f18b1ff90859084d314be98c Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:29:35 +0100 +Subject: [PATCH] Make the build of pyc and pyo files conditional + +This commit adds two new configure options: --disable-pyc-build and +--disable-pyo-build to disable the compilation of pyc and pyo files +respectively. + +Signed-off-by: Thomas Petazzoni +--- + Makefile.pre.in | 8 ++++++++ + configure.ac | 12 ++++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 58dab28..f1bdd99 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1245,24 +1245,32 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi ++ifeq (@PYC_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + $(DESTDIR)$(LIBDEST) ++endif ++ifeq (@PYO_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + $(DESTDIR)$(LIBDEST) ++endif ++ifeq (@PYC_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ++endif ++ifeq (@PYO_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ++endif + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +diff --git a/configure.ac b/configure.ac +index 7b491b4..f2c4705 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -922,6 +922,18 @@ fi + + AC_MSG_CHECKING(LDLIBRARY) + ++AC_SUBST(PYC_BUILD) ++ ++AC_ARG_ENABLE(pyc-build, ++ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]), ++ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ]) ++ ++AC_SUBST(PYO_BUILD) ++ ++AC_ARG_ENABLE(pyo-build, ++ AS_HELP_STRING([--disable-pyo-build], [disable build of pyo files]), ++ [ PYO_BUILD="${enableval}" ], [ PYO_BUILD=yes ]) ++ + # MacOSX framework builds need more magic. LDLIBRARY is the dynamic + # library that we build, but we do not want to link against it (we + # will find it with a -framework option). For this reason there is an +-- +2.6.4 + diff --git a/package/qextserialport/0001-gui.patch b/package/qextserialport/0001-gui.patch new file mode 100644 index 0000000000..d3dedae824 --- /dev/null +++ b/package/qextserialport/0001-gui.patch @@ -0,0 +1,16 @@ +Don't require Qt GUI module + +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- +diff -Nrup qextserialport-f83b4e7ca922e53.orig/qextserialport.pro qextserialport-f83b4e7ca922e53/qextserialport.pro +--- qextserialport-f83b4e7ca922e53.orig/qextserialport.pro 2012-10-17 09:13:53.000000000 +0200 ++++ qextserialport-f83b4e7ca922e53/qextserialport.pro 2012-11-13 22:48:29.249431510 +0100 +@@ -41,6 +41,8 @@ macx:qesp_mac_framework { + + win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release build_all + ++!win32*:!wince*:QT -= gui ++ + #generate proper library name + greaterThan(QT_MAJOR_VERSION, 4) { + QESP_LIB_BASENAME = QtExtSerialPort diff --git a/package/qextserialport/0002-main-include.patch b/package/qextserialport/0002-main-include.patch new file mode 100644 index 0000000000..858f3354d5 --- /dev/null +++ b/package/qextserialport/0002-main-include.patch @@ -0,0 +1,15 @@ +Create a main include file QExtSerialPort + +This main include file will be installed in + so that Qt applications can use this +library by including header files in a Qt-like style. + +Signed-off-by: Thomas Petazzoni + +Index: qextserialport-ef4af2a2ee3f/src/QExtSerialPort +=================================================================== +--- /dev/null ++++ qextserialport-ef4af2a2ee3f/src/QExtSerialPort +@@ -0,0 +1,2 @@ ++#include "qextserialport.h" ++#include "qextserialenumerator.h" diff --git a/package/qextserialport/0003-pkgconfig.patch b/package/qextserialport/0003-pkgconfig.patch new file mode 100644 index 0000000000..d67f3fcbb3 --- /dev/null +++ b/package/qextserialport/0003-pkgconfig.patch @@ -0,0 +1,19 @@ +Add a pkgconfig file to ease usage with applications + +Signed-off-by: Thomas Petazzoni + +Index: qextserialport-ef4af2a2ee3f/qextserialport.pc +=================================================================== +--- /dev/null ++++ qextserialport-ef4af2a2ee3f/qextserialport.pc +@@ -0,0 +1,10 @@ ++prefix=/usr ++exec_prefix=${prefix} ++libdir=${prefix}/lib ++includedir=${prefix}/include/QExtSerialPort ++ ++Name: QtExtSerialPort ++Description: QtExtSerialPort library ++Version: 1.2.0 ++Libs: -L${libdir} -lqextserialport ++Cflags: -I${includedir} diff --git a/package/qlibc/0004-md5-fix-musl-build-by-removing-usage-of-internal-gli.patch b/package/qlibc/0004-md5-fix-musl-build-by-removing-usage-of-internal-gli.patch new file mode 100644 index 0000000000..2ce37572c0 --- /dev/null +++ b/package/qlibc/0004-md5-fix-musl-build-by-removing-usage-of-internal-gli.patch @@ -0,0 +1,60 @@ +From fe45b18f777b1414aee908f08f56a5730a00dbb5 Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls +Date: Sat, 21 May 2016 09:59:56 +0200 +Subject: [PATCH 1/1] md5: fix musl build by removing usage of internal glibc + header sys/cdefs.h + +As suggested in musl FAQ: +http://wiki.musl-libc.org/wiki/FAQ#Q:_I.27m_trying_to_compile_something_against_musl_and_I_get_error_messages_about_sys.2Fcdefs.h + +Signed-off-by: Bernd Kuhls +(Patch for master branch sent upstream: + https://github.com/wolkykim/qlibc/pull/53, + this patch is a backport for v2.1.6) +--- + src/internal/md5/md5.h | 10 ++++++---- + src/internal/md5/md5c.c | 1 - + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/internal/md5/md5.h b/src/internal/md5/md5.h +index cbfa7ca..8e726fe 100644 +--- a/src/internal/md5/md5.h ++++ b/src/internal/md5/md5.h +@@ -35,9 +35,9 @@ typedef struct MD5Context { + unsigned char buffer[64]; /* input buffer */ + } MD5_CTX; + +-#include +- +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + void MD5Init (MD5_CTX *); + void MD5Update (MD5_CTX *, const unsigned char *, unsigned int); + void MD5Final (unsigned char[16], MD5_CTX *); +@@ -45,6 +45,8 @@ char * MD5End(MD5_CTX *, char *); + char * MD5File(const char *, char *); + char * MD5FileChunk(const char *, char *, off_t, off_t); + char * MD5Data(const unsigned char *, unsigned int, char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* Q_MD5_H */ +diff --git a/src/internal/md5/md5c.c b/src/internal/md5/md5c.c +index de9e47f..040bf5e 100644 +--- a/src/internal/md5/md5c.c ++++ b/src/internal/md5/md5c.c +@@ -26,7 +26,6 @@ + * edited for clarity and style only. + */ + +-#include + #include + #include + #include "md5.h" +-- +2.8.1 + diff --git a/package/qt5/qt5base/0001-Disable-c-standard-compiler-flags-for-the-host-build.patch b/package/qt5/qt5base/0001-Disable-c-standard-compiler-flags-for-the-host-build.patch new file mode 100644 index 0000000000..54e4db8e67 --- /dev/null +++ b/package/qt5/qt5base/0001-Disable-c-standard-compiler-flags-for-the-host-build.patch @@ -0,0 +1,44 @@ +From e69e69519661954716d59bfa5bbd0626515cfda9 Mon Sep 17 00:00:00 2001 +From: Peter Seiderer +Date: Thu, 3 Mar 2016 15:17:31 +0100 +Subject: [PATCH] Disable c++ standard compiler flags for the host build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There is no test for c++ standard support for the host build +(only for the target compiler/build) which leads to trouble +in some cross compiling environments (old host compiler, new +cross compiler): + + g++: error: unrecognized command line option ‘-std=c++1z’ + +So disable c++ standard compiler flags unconditionally for host builds. + +Task-number: QTBUG-51644 +Change-Id: Ifb3042e125fe199a7e081740d1171d26ccacf0c5 +Reviewed-by: Oswald Buddenhagen +Signed-off-by: Yegor Yefremov +--- + mkspecs/features/default_post.prf | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf +index cd8d885..561c8f4 100644 +--- a/mkspecs/features/default_post.prf ++++ b/mkspecs/features/default_post.prf +@@ -95,7 +95,10 @@ breakpad { + !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME) + } + +-c++11|c++14|c++1z { ++# Disable special compiler flags for host builds (needs to be changed for 5.7 ++# to fall back to c++11 because since 5.7 c++11 is required everywhere, ++# including host builds). ++if(!host_build|!cross_compile):if(c++11|c++14|c++1z) { + c++1z: cxxstd = CXX1Z + else: c++14: cxxstd = CXX14 + else: cxxstd = CXX11 +-- +2.1.4 + diff --git a/package/qt5/qt5base/0006-eglfs-rasp-pi-header-inclusion.patch b/package/qt5/qt5base/0006-eglfs-rasp-pi-header-inclusion.patch new file mode 100644 index 0000000000..f1f6d9b0b7 --- /dev/null +++ b/package/qt5/qt5base/0006-eglfs-rasp-pi-header-inclusion.patch @@ -0,0 +1,45 @@ +From 91c3b111e45dd476aba057836b1b618eacf90f3f Mon Sep 17 00:00:00 2001 +From: Julien Corjon +Date: Tue, 21 Jul 2015 09:58:14 +0200 +Subject: [PATCH] eglfs - fix rasp-pi header inclusion + +eglplateform.h include headers for low level instruction and fail on brcm +headers inclusion + For the brcm presence test we use egl pkg-config file + For the eglfs-plugin compilation we use the egl configuration + +Upstream-Status: https://bugreports.qt.io/browse/QTBUG-47339 +Signed-off-by: Julien Corjon +--- + config.tests/qpa/eglfs-brcm/eglfs-brcm.pro | 2 ++ + src/plugins/platforms/eglfs/eglfs-plugin.pro | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro +index ce16a3a..192a8ad 100644 +--- a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro ++++ b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro +@@ -1,6 +1,8 @@ + SOURCES = eglfs-brcm.cpp + + CONFIG -= qt ++CONFIG += link_pkgconfig ++PKGCONFIG += egl + + INCLUDEPATH += $$QMAKE_INCDIR_EGL + +diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro +index 0f493fd..8479496 100644 +--- a/src/plugins/platforms/eglfs/eglfs-plugin.pro ++++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro +@@ -6,6 +6,7 @@ PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin + load(qt_plugin) + + QT += platformsupport-private eglfs_device_lib-private ++CONFIG += egl + + SOURCES += $$PWD/qeglfsmain.cpp + +-- +2.1.0 + diff --git a/package/qt5/qt5base/0007-build-with-explicitlib-after-all.patch b/package/qt5/qt5base/0007-build-with-explicitlib-after-all.patch new file mode 100644 index 0000000000..a878ba6451 --- /dev/null +++ b/package/qt5/qt5base/0007-build-with-explicitlib-after-all.patch @@ -0,0 +1,51 @@ +From 523c7e3fd55c853dd424d57f28e225d57439cf89 Mon Sep 17 00:00:00 2001 +From: Oswald Buddenhagen +Date: Thu, 3 Mar 2016 14:12:16 +0100 +Subject: [PATCH] build with explicitlib after all + +unlike speculated in 2fe363514, this is not a workaround at all: it +causes that libraries' public link interfaces (LIBS) are exported in the +first place. unlike with staticlib, this does not export LIBS_PRIVATE, +so it wouldn't even be a particularly effective workaround for rpath +brokenness anyway. + +the problem was pretty well hidden by the qt module system, which at the +level of libraries is pretty redundant with the .prl file handling, +which shows just how stupid the whole "design" is. + +unlike before, we now enable explicitlib for all libraries, not just qt +modules - we enable create_prl for all of them as well, after all. + +an immediate effect of this change is that it fixes linking on RaspPI: +the qtcore headers make the user code require linking libatomic, so we +must add it to our public link interface. + +Task-number: QTBUG-51621 +Change-Id: I5742c88694db8e8a9b79d17222dc6df2b38e5ab2 +Reviewed-by: Joerg Bornemann +Reviewed-by: Allan Sandfeld Jensen + +Upstream: https://codereview.qt-project.org/gitweb?p=qt%2Fqtbase.git;a=commit;h=523c7e3fd55c853dd424d57f28e225d57439cf89 +Signed-off: Peter Seiderer +--- + mkspecs/features/qt_build_config.prf | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf +index 518fd93..b3081b9 100644 +--- a/mkspecs/features/qt_build_config.prf ++++ b/mkspecs/features/qt_build_config.prf +@@ -72,6 +72,10 @@ CONFIG += \ + # However, testcases should be still built with exceptions. + exceptions_off testcase_exceptions + ++# Under Windows, this is neither necessary (transitive deps are automatically ++# resolved), nor functional (.res files end up in .prl files and break things). ++unix: CONFIG += explicitlib ++ + + defineTest(qtBuildPart) { + bp = $$eval($$upper($$section(_QMAKE_CONF_, /, -2, -2))_BUILD_PARTS) +-- +2.7.4 + diff --git a/package/qt5/qt5tools/0001-Disable-qdoc-needs-qtdeclarative.patch b/package/qt5/qt5tools/0001-Disable-qdoc-needs-qtdeclarative.patch new file mode 100644 index 0000000000..61cbdfe6a1 --- /dev/null +++ b/package/qt5/qt5tools/0001-Disable-qdoc-needs-qtdeclarative.patch @@ -0,0 +1,30 @@ +From acdb24783322bb6e69df61cf04df2b2e47a06ad2 Mon Sep 17 00:00:00 2001 +From: Peter Seiderer +Date: Tue, 29 Mar 2016 13:37:09 +0200 +Subject: [PATCH] Disable qdoc (needs qtdeclarative). + +Fixes: + + Project ERROR: Unknown module(s) in QT: qmldevtools-private + Makefile:63: recipe for target 'sub-qdoc-qmake_all' failed + +Signed-off-by: Peter Seiderer +--- + src/src.pro | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/src.pro b/src/src.pro +index 387d54f..494898f 100644 +--- a/src/src.pro ++++ b/src/src.pro +@@ -14,7 +14,6 @@ qtHaveModule(widgets) { + } + + SUBDIRS += linguist \ +- qdoc \ + qtplugininfo + if(!android|android_app):!ios: SUBDIRS += qtpaths + +-- +2.1.4 + diff --git a/package/qt5/qt5webkit/0004-Fix-linking-with-libpthread.patch b/package/qt5/qt5webkit/0004-Fix-linking-with-libpthread.patch new file mode 100644 index 0000000000..b7b6791ab7 --- /dev/null +++ b/package/qt5/qt5webkit/0004-Fix-linking-with-libpthread.patch @@ -0,0 +1,34 @@ +From 5dd4bb67cfce812fd7686e43616e2069f354a7df Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen +Date: Mon, 22 Feb 2016 10:57:32 +0100 +Subject: [PATCH] Fix linking with libpthread + +WebKit use libpthread directly but is depending on other qt modules +causing it to be linked against, which might break unless -lpthread +is last. Instead just add it explicitly after the static libraries. + +Upstream-Status: Backport from 5.7 branch + +Change-Id: I2b95cff2c96373f8dce6f95052c4fccbe1982b33 +Reviewed-by: Simon Hausmann +Signed-off-by: Jonathan Liu +Signed-off-by: Gary Bisson +--- + Tools/qmake/mkspecs/features/default_post.prf | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf +index 67276b7..39bb3f7 100644 +--- a/Tools/qmake/mkspecs/features/default_post.prf ++++ b/Tools/qmake/mkspecs/features/default_post.prf +@@ -201,6 +201,7 @@ needToLink() { + linkAgainstLibrary($$library, $$eval(WEBKIT.$${library_identifier}.root_source_dir)) + LIBS += $$eval(WEBKIT.$${library_identifier}.dependent_libs) + } ++ posix:!darwin: LIBS += -lpthread + } + + creating_module { +-- +2.7.1 + diff --git a/package/readline/0001-patchlevel-1.patch b/package/readline/0001-patchlevel-1.patch new file mode 100644 index 0000000000..8593073b9b --- /dev/null +++ b/package/readline/0001-patchlevel-1.patch @@ -0,0 +1,47 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-001 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-001 + +Bug-Reported-by: Daan van Rossum +Bug-Reference-ID: <20140307072523.GA14250@flash.uchicago.edu> +Bug-Reference-URL: + +Bug-Description: + +The `.' command in vi mode cannot undo multi-key commands beginning with +`c', `d', and `y' (command plus motion specifier). + +Patch (apply with `patch -p0'): + +*** a/readline-6.3/readline.c 2013-10-28 14:58:06.000000000 -0400 +--- b/readline.c 2014-03-07 15:20:33.000000000 -0500 +*************** +*** 965,969 **** + if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && + key != ANYOTHERKEY && +! rl_key_sequence_length == 1 && /* XXX */ + _rl_vi_textmod_command (key)) + _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); +--- 965,969 ---- + if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && + key != ANYOTHERKEY && +! _rl_dispatching_keymap == vi_movement_keymap && + _rl_vi_textmod_command (key)) + _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 5 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 1 diff --git a/package/readline/0002-patchlevel-2.patch b/package/readline/0002-patchlevel-2.patch new file mode 100644 index 0000000000..a8a94e0810 --- /dev/null +++ b/package/readline/0002-patchlevel-2.patch @@ -0,0 +1,48 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-002 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-002 + +Bug-Reported-by: Anatol Pomozov +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00010.html + +Bug-Description: + +When in callback mode, some readline commands can cause readline to seg +fault by passing invalid contexts to callback functions. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3/readline.c 2013-10-28 14:58:06.000000000 -0400 +--- b/readline.c 2014-03-10 14:15:02.000000000 -0400 +*************** +*** 745,749 **** + + RL_CHECK_SIGNALS (); +! if (r == 0) /* success! */ + { + _rl_keyseq_chain_dispose (); +--- 745,750 ---- + + RL_CHECK_SIGNALS (); +! /* We only treat values < 0 specially to simulate recursion. */ +! if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */ + { + _rl_keyseq_chain_dispose (); +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 1 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 2 diff --git a/package/readline/0003-patchlevel-3.patch b/package/readline/0003-patchlevel-3.patch new file mode 100644 index 0000000000..195ed554e9 --- /dev/null +++ b/package/readline/0003-patchlevel-3.patch @@ -0,0 +1,51 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-003 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-003 + +Bug-Reported-by: +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +There are debugging functions in the readline release that are theoretically +exploitable as security problems. They are not public functions, but have +global linkage. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3/util.c 2013-09-02 13:36:12.000000000 -0400 +--- b/util.c 2014-03-20 10:25:53.000000000 -0400 +*************** +*** 477,480 **** +--- 479,483 ---- + } + ++ #if defined (DEBUG) + #if defined (USE_VARARGS) + static FILE *_rl_tracefp; +*************** +*** 539,542 **** +--- 542,546 ---- + } + #endif ++ #endif /* DEBUG */ + + +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 2 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 3 diff --git a/package/readline/0004-patchlevel-4.patch b/package/readline/0004-patchlevel-4.patch new file mode 100644 index 0000000000..86ab3d5079 --- /dev/null +++ b/package/readline/0004-patchlevel-4.patch @@ -0,0 +1,49 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-004 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-004 + +Bug-Reported-by: Egmont Koblinger +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00153.html + +Bug-Description: + +The signal handling changes to bash and readline (to avoid running any code +in a signal handler context) cause the cursor to be placed on the wrong +line of a multi-line command after a ^C interrupts editing. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3-patched/display.c 2013-12-27 13:10:56.000000000 -0500 +--- b/display.c 2014-03-27 11:52:45.000000000 -0400 +*************** +*** 2678,2682 **** + if (_rl_echoing_p) + { +! _rl_move_vert (_rl_vis_botlin); + _rl_vis_botlin = 0; + fflush (rl_outstream); +--- 2678,2683 ---- + if (_rl_echoing_p) + { +! if (_rl_vis_botlin > 0) /* minor optimization plus bug fix */ +! _rl_move_vert (_rl_vis_botlin); + _rl_vis_botlin = 0; + fflush (rl_outstream); +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 3 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 4 diff --git a/package/readline/0005-patchlevel-5.patch b/package/readline/0005-patchlevel-5.patch new file mode 100644 index 0000000000..6e73c7f263 --- /dev/null +++ b/package/readline/0005-patchlevel-5.patch @@ -0,0 +1,62 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-005 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-005 + +Bug-Reported-by: Juergen Daubert +Bug-Reference-ID: <20140303180430.GA7346@jue.netz> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00002.html + +Bug-Description: + +There are still applications using the deprecated Function/VFunction/etc. +typedefs in rltypedefs.h. This patch restores the typedefs, but attempts +to mark them as deprecated using gcc/clang attributes. Thanks to Max Horn +for the suggestion. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3-patched/rltypedefs.h 2011-03-26 14:53:31.000000000 -0400 +--- b/rltypedefs.h 2014-04-10 11:30:45.000000000 -0400 +*************** +*** 27,30 **** +--- 27,49 ---- + #endif + ++ /* Old-style, attempt to mark as deprecated in some way people will notice. */ ++ ++ #if !defined (_FUNCTION_DEF) ++ # define _FUNCTION_DEF ++ ++ #if defined(__GNUC__) || defined(__clang__) ++ typedef int Function () __attribute__ ((deprecated)); ++ typedef void VFunction () __attribute__ ((deprecated)); ++ typedef char *CPFunction () __attribute__ ((deprecated)); ++ typedef char **CPPFunction () __attribute__ ((deprecated)); ++ #else ++ typedef int Function (); ++ typedef void VFunction (); ++ typedef char *CPFunction (); ++ typedef char **CPPFunction (); ++ #endif ++ ++ #endif /* _FUNCTION_DEF */ ++ + /* New style. */ + +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 4 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 5 diff --git a/package/readline/0006-patchlevel-6.patch b/package/readline/0006-patchlevel-6.patch new file mode 100644 index 0000000000..b28b53c7ab --- /dev/null +++ b/package/readline/0006-patchlevel-6.patch @@ -0,0 +1,67 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-006 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-006 + +Bug-Reported-by: +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00069.html + +Bug-Description: + +Using reverse-i-search when horizontal scrolling is enabled does not redisplay +the entire line containing the successful search results. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3-patched/display.c 2014-04-08 18:19:36.000000000 -0400 +--- b/display.c 2014-04-20 18:32:52.000000000 -0400 +*************** +*** 1638,1642 **** + the spot of first difference is before the end of the invisible chars, + lendiff needs to be adjusted. */ +! if (current_line == 0 && !_rl_horizontal_scroll_mode && + current_invis_chars != visible_wrap_offset) + { +--- 1638,1642 ---- + the spot of first difference is before the end of the invisible chars, + lendiff needs to be adjusted. */ +! if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */ + current_invis_chars != visible_wrap_offset) + { +*************** +*** 1826,1831 **** + _rl_last_c_pos += bytes_to_insert; + + if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new))) +! goto clear_rest_of_line; + } + } +--- 1826,1836 ---- + _rl_last_c_pos += bytes_to_insert; + ++ /* XXX - we only want to do this if we are at the end of the line ++ so we move there with _rl_move_cursor_relative */ + if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new))) +! { +! _rl_move_cursor_relative (ne-new, new); +! goto clear_rest_of_line; +! } + } + } +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 5 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 6 diff --git a/package/readline/0007-patchlevel-7.patch b/package/readline/0007-patchlevel-7.patch new file mode 100644 index 0000000000..4c6f59cd24 --- /dev/null +++ b/package/readline/0007-patchlevel-7.patch @@ -0,0 +1,51 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-007 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-007 + +Bug-Reported-by: John Lenton +Bug-Reference-ID: +Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1317476 + +Bug-Description: + +Readline should allow SIGALRM and SIGVTALRM (if available) to `interrupt' +rl_getc and cause the handler to run when not in a signal handling context. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3-patched/input.c 2014-01-10 15:07:08.000000000 -0500 +--- b/input.c 2014-05-30 16:20:56.000000000 -0400 +*************** +*** 535,540 **** +--- 538,551 ---- + else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM) + return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); ++ /* keyboard-generated signals of interest */ + else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT) + RL_CHECK_SIGNALS (); ++ /* non-keyboard-generated signals of interest */ ++ else if (_rl_caught_signal == SIGALRM ++ #if defined (SIGVTALRM) ++ || _rl_caught_signal == SIGVTALRM ++ #endif ++ ) ++ RL_CHECK_SIGNALS (); + + if (rl_signal_event_hook) +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 6 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 7 diff --git a/package/readline/0008-patchlevel-8.patch b/package/readline/0008-patchlevel-8.patch new file mode 100644 index 0000000000..412ba352d6 --- /dev/null +++ b/package/readline/0008-patchlevel-8.patch @@ -0,0 +1,51 @@ +From http://ftp.gnu.org/pub/gnu/readline/readline-6.3-patches/readline63-008 + +Signed-off-by: Gustavo Zacarias + + READLINE PATCH REPORT + ===================== + +Readline-Release: 6.3 +Patch-ID: readline63-008 + +Bug-Reported-by: Jared Yanovich +Bug-Reference-ID: <20140625225019.GJ17044@nightderanger.psc.edu> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00070.html + +Bug-Description: + +When the readline `revert-all-at-newline' option is set, pressing newline +when the current line is one retrieved from history results in a double free +and a segmentation fault. + +Patch (apply with `patch -p0'): + +*** a/readline-6.3-patched/misc.c 2012-09-01 18:03:11.000000000 -0400 +--- b/misc.c 2014-06-30 13:41:19.000000000 -0400 +*************** +*** 462,465 **** +--- 462,466 ---- + /* Set up rl_line_buffer and other variables from history entry */ + rl_replace_from_history (entry, 0); /* entry->line is now current */ ++ entry->data = 0; /* entry->data is now current undo list */ + /* Undo all changes to this history entry */ + while (rl_undo_list) +*************** +*** 469,473 **** + FREE (entry->line); + entry->line = savestring (rl_line_buffer); +- entry->data = 0; + } + entry = previous_history (); +--- 470,473 ---- +*** a/readline-6.3/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- b/patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 7 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 8 diff --git a/package/redis/0003-redis.conf-sane-defaults.patch b/package/redis/0003-redis.conf-sane-defaults.patch new file mode 100644 index 0000000000..6ee3f210ca --- /dev/null +++ b/package/redis/0003-redis.conf-sane-defaults.patch @@ -0,0 +1,37 @@ +Taken from archlinux redis package +See https://projects.archlinux.org/svntogit/community.git/tree/trunk/redis.conf-sane-defaults.patch?h=packages/redis&id=5b2491ea61b746f289acebd12bc66e337d7e5b88 + +Signed-off-by: Martin Bark + +========================================================================= +diff --git a/redis.conf b/redis.conf +index 6efb6ac..344e021 100644 +--- a/redis.conf ++++ b/redis.conf +@@ -61,7 +61,7 @@ tcp-backlog 511 + # Examples: + # + # bind 192.168.1.100 10.0.0.1 +-# bind 127.0.0.1 ++bind 127.0.0.1 + + # Specify the path for the Unix socket that will be used to listen for + # incoming connections. There is no default, so Redis will not listen +@@ -87,7 +87,7 @@ timeout 0 + # On other kernels the period depends on the kernel configuration. + # + # A reasonable value for this option is 60 seconds. +-tcp-keepalive 0 ++tcp-keepalive 60 + + # Specify the server verbosity level. + # This can be one of: +@@ -184,7 +184,7 @@ dbfilename dump.rdb + # The Append Only File will also be created inside this directory. + # + # Note that you must specify a directory here, not a file name. +-dir ./ ++dir /var/lib/redis/ + + ################################# REPLICATION ################################# + diff --git a/package/rpi-firmware/mkknlimg b/package/rpi-firmware/mkknlimg new file mode 100644 index 0000000000..33f81874bf --- /dev/null +++ b/package/rpi-firmware/mkknlimg @@ -0,0 +1,299 @@ +#!/usr/bin/env perl +# +# Originaly from: https://github.com/raspberrypi/tools/blob/master/mkimage/mkknlimg +# Original cset : f5642106425d430e1f82ee064121a5fd0e05a386 +# +# ---------------------------------------------------------------------- +# mkknlimg by Phil Elwell for Raspberry Pi +# based on extract-ikconfig by Dick Streefland +# +# (c) 2009,2010 Dick Streefland +# (c) 2014,2015 Raspberry Pi (Trading) Limited +# +# Licensed under the terms of the GNU General Public License. +# ---------------------------------------------------------------------- + +use strict; +use warnings; +use integer; + +use constant FLAG_PI => 1; +use constant FLAG_DTOK => 2; +use constant FLAG_DDTK => 4; +use constant FLAG_283X => 8; + +my $trailer_magic = 'RPTL'; + +my $tmpfile1 = "/tmp/mkknlimg_$$.1"; +my $tmpfile2 = "/tmp/mkknlimg_$$.2"; + +my $dtok = 0; +my $ddtk = 0; +my $is_283x = 0; + +while (@ARGV && ($ARGV[0] =~ /^-/)) +{ + my $arg = shift(@ARGV); + if ($arg eq '--dtok') + { + $dtok = 1; + } + elsif ($arg eq '--ddtk') + { + $ddtk = 1; + } + elsif ($arg eq '--283x') + { + $is_283x = 1; + } + else + { + print ("* Unknown option '$arg'\n"); + usage(); + } +} + +usage() if (@ARGV != 2); + +my $kernel_file = $ARGV[0]; +my $out_file = $ARGV[1]; + +if (! -r $kernel_file) +{ + print ("* File '$kernel_file' not found\n"); + usage(); +} + +my $wanted_configs = +{ + 'CONFIG_BCM2708_DT' => FLAG_PI | FLAG_DTOK, + 'CONFIG_ARCH_BCM2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, +}; + +my $wanted_strings = +{ + 'bcm2708_fb' => FLAG_PI, + 'brcm,bcm2835-mmc' => FLAG_PI, + 'brcm,bcm2835-sdhost' => FLAG_PI, + 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, + 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, + 'brcm,bcm2835-pm-wdt' => FLAG_PI | FLAG_DTOK | FLAG_283X, + 'of_overlay_apply' => FLAG_DTOK | FLAG_DDTK, +}; + +my $res = try_extract($kernel_file, $tmpfile1); +$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, + $kernel_file, $tmpfile1, $tmpfile2); +$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, + $kernel_file, $tmpfile1, $tmpfile2); +$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, + $kernel_file, $tmpfile1, $tmpfile2); +$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, + $kernel_file, $tmpfile1, $tmpfile2); +$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, + $kernel_file, $tmpfile1, $tmpfile2); +$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, + $kernel_file, $tmpfile1, $tmpfile2); + +my $append_trailer; +my $trailer; +my $kver = '?'; + +$append_trailer = $dtok; + +if ($res) +{ + $kver = $res->{'kver'} || '?'; + my $flags = $res->{'flags'}; + print("Version: $kver\n"); + + if ($flags & FLAG_PI) + { + $append_trailer = 1; + $dtok ||= ($flags & FLAG_DTOK) != 0; + $is_283x ||= ($flags & FLAG_283X) != 0; + $ddtk ||= ($flags & FLAG_DDTK) != 0; + } + else + { + print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); + } +} +elsif (!$dtok) +{ + print ("* Is this a valid kernel? In pass-through mode.\n"); +} + +if ($append_trailer) +{ + printf("DT: %s\n", $dtok ? "y" : "n"); + printf("DDT: %s\n", $ddtk ? "y" : "n"); + printf("283x: %s\n", $is_283x ? "y" : "n"); + + my @atoms; + + push @atoms, [ $trailer_magic, pack('V', 0) ]; + push @atoms, [ 'KVer', $kver ]; + push @atoms, [ 'DTOK', pack('V', $dtok) ]; + push @atoms, [ 'DDTK', pack('V', $ddtk) ]; + push @atoms, [ '283x', pack('V', $is_283x) ]; + + $trailer = pack_trailer(\@atoms); + $atoms[0]->[1] = pack('V', length($trailer)); + + $trailer = pack_trailer(\@atoms); +} + +my $ofh; +my $total_len = 0; + +if ($out_file eq $kernel_file) +{ + die "* Failed to open '$out_file' for append\n" + if (!open($ofh, '>>', $out_file)); + $total_len = tell($ofh); +} +else +{ + die "* Failed to open '$kernel_file'\n" + if (!open(my $ifh, '<', $kernel_file)); + die "* Failed to create '$out_file'\n" + if (!open($ofh, '>', $out_file)); + + my $copybuf; + while (1) + { + my $bytes = sysread($ifh, $copybuf, 64*1024); + last if (!$bytes); + syswrite($ofh, $copybuf, $bytes); + $total_len += $bytes; + } + close($ifh); +} + +if ($trailer) +{ + # Pad to word-alignment + syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); + syswrite($ofh, $trailer); +} + +close($ofh); + +exit($trailer ? 0 : 1); + +END { + unlink($tmpfile1) if ($tmpfile1); + unlink($tmpfile2) if ($tmpfile2); +} + + +sub usage +{ + print ("Usage: mkknlimg [--dtok] [--283x] \n"); + exit(1); +} + +sub try_extract +{ + my ($knl, $tmp) = @_; + + my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; + + return undef if (!$ver); + + chomp($ver); + + my $res = { 'kver'=>$ver }; + $res->{'flags'} = strings_to_flags($knl, $wanted_strings) | + configs_to_flags($knl, $tmp, $wanted_configs); + + return $res; +} + + +sub try_decompress +{ + my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; + + my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; + if ($pos) + { + chomp($pos); + $pos = (split(/[\r\n]+/, $pos))[$idx]; + return undef if (!defined($pos)); + $pos =~ s/:.*[\r\n]*$//s; + my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; + my $err = (system($cmd) >> 8); + return undef if (($err != 0) && ($err != 2)); + + return try_extract($tmp2, $tmp1); + } + + return undef; +} + + +sub strings_to_flags +{ + my ($knl, $strings) = @_; + my $string_pattern = '^('.join('|', keys(%$strings)).')$'; + my $flags = 0; + + my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; + foreach my $match (@matches) + { + chomp($match); + $flags |= $strings->{$match}; + } + + return $flags; +} + +sub configs_to_flags +{ + my ($knl, $tmp, $configs) = @_; + my $config_pattern = '^('.join('|', keys(%$configs)).')=(.*)$'; + my $cf1 = 'IKCFG_ST\037\213\010'; + my $cf2 = '0123456789'; + my $flags = 0; + + my $pos = `tr "$cf1\n$cf2" "\n$cf2=" < "$knl" | grep -abo "^$cf2"`; + if ($pos) + { + $pos =~ s/:.*[\r\n]*$//s; + $pos += 8; + my $err = (system("tail -c+$pos \"$knl\" | zcat > $tmp 2> /dev/null") >> 8); + if (($err == 0) || ($err == 2)) + { + if (open(my $fh, '<', $tmp)) + { + while (my $line = <$fh>) + { + chomp($line); + if (($line =~ /$config_pattern/) && + (($2 eq 'y') || ($2 eq 'm'))) + { + $flags |= $configs->{$1}; + } + } + + close($fh); + } + } + } + + return $flags; +} + +sub pack_trailer +{ + my ($atoms) = @_; + my $trailer = pack('VV', 0, 0); + for (my $i = $#$atoms; $i>=0; $i--) + { + my $atom = $atoms->[$i]; + $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); + } + return $trailer; +} diff --git a/package/rpm/0002-depends-fix.patch b/package/rpm/0002-depends-fix.patch new file mode 100644 index 0000000000..4a92775763 --- /dev/null +++ b/package/rpm/0002-depends-fix.patch @@ -0,0 +1,19 @@ +Bugfix included upstream + +diff -u --new-file --recursive rpm-5.2.0_vanilla/lib/depends.c rpm-5.2.0_depends-fix/lib/depends.c +--- rpm-5.2.0_vanilla/lib/depends.c 2009-05-23 01:23:46.000000000 +0000 ++++ rpm-5.2.0_depends-fix/lib/depends.c 2009-09-22 06:33:37.950783501 +0000 +@@ -2371,11 +2371,11 @@ + + memset(selected, 0, sizeof(*selected) * ts->orderCount); + +- if ((requires = rpmteDS(p, RPMTAG_REQUIRENAME)) != NULL) { +- + /* Avoid narcisstic relations. */ + selected[rpmtsiOc(pi)] = 1; + ++ if ((requires = rpmteDS(p, RPMTAG_REQUIRENAME)) != NULL) { ++ + /* T2. Next "q <- p" relation. */ + + /* First, do pre-requisites. */ diff --git a/package/rpm/0003-exclude-some-tools.patch b/package/rpm/0003-exclude-some-tools.patch new file mode 100644 index 0000000000..2cbc7cbf6a --- /dev/null +++ b/package/rpm/0003-exclude-some-tools.patch @@ -0,0 +1,30 @@ +diff -ru rpm-5.2.0_vanilla/tools/Makefile.am rpm-5.2.0_exclude-some-tools/tools/Makefile.am +--- rpm-5.2.0_vanilla/tools/Makefile.am 2009-06-03 01:24:42.000000000 +0000 ++++ rpm-5.2.0_exclude-some-tools/tools/Makefile.am 2009-12-20 07:47:13.000000000 +0000 +@@ -45,9 +45,7 @@ + bin_PROGRAMS = rpm2cpio + + pkgbindir = @USRLIBRPM@/bin +-pkgbin_PROGRAMS = \ +- rpmcache rpmdigest grep mtree rpmrepo rpmspecdump wget \ +- rpmcmp rpmdeps @WITH_KEYUTILS_RPMKEY@ @WITH_LIBELF_DEBUGEDIT@ ++pkgbin_PROGRAMS = + dist_man_MANS = rpmgrep.1 + + debugedit_SOURCES = debugedit.c hashtab.c +diff -ru rpm-5.2.0_vanilla/tools/Makefile.in rpm-5.2.0_exclude-some-tools/tools/Makefile.in +--- rpm-5.2.0_vanilla/tools/Makefile.in 2009-07-07 21:14:06.000000000 +0000 ++++ rpm-5.2.0_exclude-some-tools/tools/Makefile.in 2009-12-20 07:47:37.000000000 +0000 +@@ -39,11 +39,7 @@ + target_triplet = @target@ + EXTRA_PROGRAMS = rpmkey$(EXEEXT) debugedit$(EXEEXT) + bin_PROGRAMS = rpm2cpio$(EXEEXT) +-pkgbin_PROGRAMS = rpmcache$(EXEEXT) rpmdigest$(EXEEXT) grep$(EXEEXT) \ +- mtree$(EXEEXT) rpmrepo$(EXEEXT) rpmspecdump$(EXEEXT) \ +- wget$(EXEEXT) rpmcmp$(EXEEXT) rpmdeps$(EXEEXT) \ +- @WITH_KEYUTILS_RPMKEY@ @WITH_LIBELF_DEBUGEDIT@ $(am__EXEEXT_1) \ +- $(am__EXEEXT_2) ++pkgbin_PROGRAMS = + @WITH_XAR_TRUE@am__append_1 = txar + @WITH_DB_INTERNAL_TRUE@@WITH_DB_TOOLS_INTEGRATED_TRUE@am__append_2 = db_tool + @WITH_DB_INTERNAL_TRUE@@WITH_DB_RPC_TRUE@@WITH_DB_TOOLS_INTEGRATED_TRUE@am__append_3 = \ diff --git a/package/rpm/0004-ignore-shared-mutexes.patch b/package/rpm/0004-ignore-shared-mutexes.patch new file mode 100644 index 0000000000..f19d6b6f32 --- /dev/null +++ b/package/rpm/0004-ignore-shared-mutexes.patch @@ -0,0 +1,12 @@ +diff -ru rpm-5.2.0_vanilla/db/env/env_open.c rpm-5.2.0_test/db/env/env_open.c +--- rpm-5.2.0_vanilla/db/env/env_open.c 2008-05-28 01:23:27.000000000 +0000 ++++ rpm-5.2.0_test/db/env/env_open.c 2009-12-24 14:54:55.000000000 +0000 +@@ -124,7 +124,7 @@ + } + } + +-#ifdef HAVE_MUTEX_THREAD_ONLY ++#ifdef NK_HAVE_MUTEX_THREAD_ONLY + /* + * Currently we support one kind of mutex that is intra-process only, + * POSIX 1003.1 pthreads, because a variety of systems don't support diff --git a/package/rpm/0005-no-parentdirs.patch b/package/rpm/0005-no-parentdirs.patch new file mode 100644 index 0000000000..d05c99ad61 --- /dev/null +++ b/package/rpm/0005-no-parentdirs.patch @@ -0,0 +1,14 @@ +Reduce parentdirs we use, parentdirs are used for ordering +Included upstream +diff -u --new-file --recursive rpm-5.1.9_vanilla/lib/depends.c rpm-5.1.9_no-parentdirs/lib/depends.c +--- rpm-5.1.9_vanilla/lib/depends.c 2009-04-12 19:46:17.000000000 +0000 ++++ rpm-5.1.9_no-parentdirs/lib/depends.c 2009-06-13 15:21:43.504999639 +0000 +@@ -2257,7 +2257,7 @@ + #define isAuto(_x) ((_x) & _autobits) + + /*@unchecked@*/ +-static int slashDepth = 100; /* #slashes pemitted in parentdir deps. */ ++static int slashDepth = 2; /* #slashes pemitted in parentdir deps. */ + + static int countSlashes(const char * dn) + /*@*/ diff --git a/package/rpm/0006-ordering-fix.patch b/package/rpm/0006-ordering-fix.patch new file mode 100644 index 0000000000..a618e1f2c9 --- /dev/null +++ b/package/rpm/0006-ordering-fix.patch @@ -0,0 +1,45 @@ +Included upstream +--- x/lib/depends.c 2009/05/15 13:40:58 1.445 ++++ y/lib/depends.c 2009/08/22 22:12:02 1.446 +@@ -2216,9 +2216,6 @@ + { + rpmte q, qprev; + +- /* Mark the package as queued. */ +- rpmteTSI(p)->tsi_queued = 1; +- + if ((*rp) == NULL) { /* 1st element */ + /*@-dependenttrans@*/ /* FIX: double indirection */ + (*rp) = (*qp) = p; +@@ -2238,6 +2235,12 @@ + /* XXX Insure removed after added. */ + if (rpmteType(p) == TR_REMOVED && rpmteType(p) != rpmteType(q)) + continue; ++ ++ /* XXX Follow all previous generations in the queue. */ ++ if (rpmteTSI(p)->tsi_queued > rpmteTSI(q)->tsi_queued) ++ continue; ++ ++ /* XXX Within a generation, queue behind more "important". */ + if (rpmteTSI(q)->tsi_qcnt <= rpmteTSI(p)->tsi_qcnt) + break; + } +@@ -2521,6 +2524,9 @@ + + if (rpmteTSI(p)->tsi_count != 0) + continue; ++ ++ /* Mark the package as queued. */ ++ rpmteTSI(p)->tsi_queued = orderingCount + 1; + rpmteTSI(p)->tsi_suc = NULL; + addQ(p, &q, &r, prefcolor); + qlen++; +@@ -2584,6 +2590,8 @@ + (void) rpmteSetParent(p, q); + (void) rpmteSetDegree(q, rpmteDegree(q)+1); + ++ /* Mark the package as queued. */ ++ rpmteTSI(p)->tsi_queued = orderingCount + 1; + /* XXX TODO: add control bit. */ + rpmteTSI(p)->tsi_suc = NULL; + /*@-nullstate@*/ /* XXX FIX: rpmteTSI(q)->tsi_suc can be NULL. */ diff --git a/package/rpm/0007-parentdir-vs-requires.patch b/package/rpm/0007-parentdir-vs-requires.patch new file mode 100644 index 0000000000..309ab254e0 --- /dev/null +++ b/package/rpm/0007-parentdir-vs-requires.patch @@ -0,0 +1,37 @@ +Avoid looking up files or directories that this package provides +Included upstream +diff -u --new-file --recursive rpm-5.2.0_vanilla/lib/depends.c rpm-5.2.0_parentdir-vs-requires/lib/depends.c +--- rpm-5.2.0_vanilla/lib/depends.c 2009-05-23 01:23:46.000000000 +0000 ++++ rpm-5.2.0_parentdir-vs-requires/lib/depends.c 2009-09-22 17:00:24.880956271 +0000 +@@ -2095,6 +2095,7 @@ + rpmtsi qi; rpmte q; + tsortInfo tsi; + nsType NSType = rpmdsNSType(requires); ++ const char * N = rpmdsN(requires); + fnpyKey key; + int teType = rpmteType(p); + alKey pkgKey; +@@ -2128,6 +2129,23 @@ + break; + } + ++ /* Avoid looking up files/directories that are "owned" by _THIS_ package. */ ++ if (*N == '/') { ++ rpmfi fi = rpmteFI(p, RPMTAG_BASENAMES); ++ int bingo = 0; ++ ++ fi = rpmfiInit(fi, 0); ++ while (rpmfiNext(fi) >= 0) { ++ const char * fn = rpmfiFN(fi); ++ if (strcmp(N, fn)) ++ continue; ++ bingo = 1; ++ break; ++ } ++ if (bingo) ++ return 0; ++ } ++ + pkgKey = RPMAL_NOMATCH; + key = rpmalSatisfiesDepend(al, requires, &pkgKey); + diff --git a/package/rpm/0008-short-circuit-c99.patch b/package/rpm/0008-short-circuit-c99.patch new file mode 100644 index 0000000000..5d7b53a25d --- /dev/null +++ b/package/rpm/0008-short-circuit-c99.patch @@ -0,0 +1,235 @@ +Buildroot specific +diff -ru rpm-5.1.9_vanilla/xz/configure rpm-5.1.9_short-circuit-c99/xz/configure +--- rpm-5.1.9_vanilla/xz/configure 2009-04-18 16:47:23.000000000 +0000 ++++ rpm-5.1.9_short-circuit-c99/xz/configure 2009-08-04 08:25:59.000000000 +0000 +@@ -4970,214 +4970,7 @@ + am__fastdepCC_FALSE= + fi + +- +- { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 +-$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +-if test "${ac_cv_prog_cc_c99+set}" = set; then +- $as_echo_n "(cached) " >&6 +-else +- ac_cv_prog_cc_c99=no +-ac_save_CC=$CC +-cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +-#include +-#include +-#include +-#include +-#include +- +-// Check varargs macros. These examples are taken from C99 6.10.3.5. +-#define debug(...) fprintf (stderr, __VA_ARGS__) +-#define showlist(...) puts (#__VA_ARGS__) +-#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +-static void +-test_varargs_macros (void) +-{ +- int x = 1234; +- int y = 5678; +- debug ("Flag"); +- debug ("X = %d\n", x); +- showlist (The first, second, and third items.); +- report (x>y, "x is %d but y is %d", x, y); +-} +- +-// Check long long types. +-#define BIG64 18446744073709551615ull +-#define BIG32 4294967295ul +-#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +-#if !BIG_OK +- your preprocessor is broken; +-#endif +-#if BIG_OK +-#else +- your preprocessor is broken; +-#endif +-static long long int bignum = -9223372036854775807LL; +-static unsigned long long int ubignum = BIG64; +- +-struct incomplete_array +-{ +- int datasize; +- double data[]; +-}; +- +-struct named_init { +- int number; +- const wchar_t *name; +- double average; +-}; +- +-typedef const char *ccp; +- +-static inline int +-test_restrict (ccp restrict text) +-{ +- // See if C++-style comments work. +- // Iterate through items via the restricted pointer. +- // Also check for declarations in for loops. +- for (unsigned int i = 0; *(text+i) != '\0'; ++i) +- continue; +- return 0; +-} +- +-// Check varargs and va_copy. +-static void +-test_varargs (const char *format, ...) +-{ +- va_list args; +- va_start (args, format); +- va_list args_copy; +- va_copy (args_copy, args); +- +- const char *str; +- int number; +- float fnumber; +- +- while (*format) +- { +- switch (*format++) +- { +- case 's': // string +- str = va_arg (args_copy, const char *); +- break; +- case 'd': // int +- number = va_arg (args_copy, int); +- break; +- case 'f': // float +- fnumber = va_arg (args_copy, double); +- break; +- default: +- break; +- } +- } +- va_end (args_copy); +- va_end (args); +-} +- +-int +-main () +-{ +- +- // Check bool. +- _Bool success = false; +- +- // Check restrict. +- if (test_restrict ("String literal") == 0) +- success = true; +- char *restrict newvar = "Another string"; +- +- // Check varargs. +- test_varargs ("s, d' f .", "string", 65, 34.234); +- test_varargs_macros (); +- +- // Check flexible array members. +- struct incomplete_array *ia = +- malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); +- ia->datasize = 10; +- for (int i = 0; i < ia->datasize; ++i) +- ia->data[i] = i * 1.234; +- +- // Check named initializers. +- struct named_init ni = { +- .number = 34, +- .name = L"Test wide string", +- .average = 543.34343, +- }; +- +- ni.number = 58; +- +- int dynamic_array[ni.number]; +- dynamic_array[ni.number - 1] = 543; +- +- // work around unused variable warnings +- return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' +- || dynamic_array[ni.number - 1] != 543); +- +- ; +- return 0; +-} +-_ACEOF +-for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +-do +- CC="$ac_save_CC $ac_arg" +- rm -f conftest.$ac_objext +-if { (ac_try="$ac_compile" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_compile") 2>conftest.er1 +- ac_status=$? +- grep -v '^ *+' conftest.er1 >conftest.err +- rm -f conftest.er1 +- cat conftest.err >&5 +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { +- test -z "$ac_c_werror_flag" || +- test ! -s conftest.err +- } && test -s conftest.$ac_objext; then +- ac_cv_prog_cc_c99=$ac_arg +-else +- $as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- +-fi +- +-rm -f core conftest.err conftest.$ac_objext +- test "x$ac_cv_prog_cc_c99" != "xno" && break +-done +-rm -f conftest.$ac_ext +-CC=$ac_save_CC +- +-fi +-# AC_CACHE_VAL +-case "x$ac_cv_prog_cc_c99" in +- x) +- { $as_echo "$as_me:$LINENO: result: none needed" >&5 +-$as_echo "none needed" >&6; } ;; +- xno) +- { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +-$as_echo "unsupported" >&6; } ;; +- *) +- CC="$CC $ac_cv_prog_cc_c99" +- { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 +-$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +-esac +- +- +- +-if test x$ac_cv_prog_cc_c99 = xno ; then +- { { $as_echo "$as_me:$LINENO: error: No C99 compiler was found." >&5 +-$as_echo "$as_me: error: No C99 compiler was found." >&2;} +- { (exit 1); exit 1; }; } +-fi ++CC="$CC -std=c99" + + if test "x$CC" != xcc; then + { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 +diff -ru rpm-5.1.9_vanilla/xz/configure.ac rpm-5.1.9_short-circuit-c99/xz/configure.ac +--- rpm-5.1.9_vanilla/xz/configure.ac 2009-02-16 17:07:46.000000000 +0000 ++++ rpm-5.1.9_short-circuit-c99/xz/configure.ac 2009-08-04 08:25:28.000000000 +0000 +@@ -402,10 +402,7 @@ + AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99]) + AC_PROG_LN_S + +-AC_PROG_CC_C99 +-if test x$ac_cv_prog_cc_c99 = xno ; then +- AC_MSG_ERROR([No C99 compiler was found.]) +-fi ++CC="$CC -std=c99" + + AM_PROG_CC_C_O + AM_PROG_AS diff --git a/package/rrdtool/0001-Add-configure-option-to-disable-documentation.patch b/package/rrdtool/0001-Add-configure-option-to-disable-documentation.patch new file mode 100644 index 0000000000..afb62927de --- /dev/null +++ b/package/rrdtool/0001-Add-configure-option-to-disable-documentation.patch @@ -0,0 +1,71 @@ +From deaef0790f3cbbce826275d3564551fc9568b628 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Wed, 2 Dec 2015 14:31:52 -0300 +Subject: [PATCH] Add configure option to disable documentation + +Signed-off-by: Gustavo Zacarias +--- + Makefile.am | 6 +++++- + configure.ac | 8 ++++++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index f45975c..1f46a9b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -5,7 +5,11 @@ RSYNC = rsync --rsh=ssh + + # build the following subdirectories + +-SUBDIRS = po src doc bindings tests ++SUBDIRS = po src bindings tests ++ ++if BUILD_DOCS ++SUBDIRS += doc ++endif + + if BUILD_EXAMPLES + SUBDIRS += examples +diff --git a/configure.ac b/configure.ac +index dc70e7d..7460c67 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -100,6 +100,9 @@ AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, + AC_DEFINE_UNQUOTED(RRDGRAPH_YLEGEND_ANGLE,${RRDGRAPH_YLEGEND_ANGLE:-90.0}, + [Vertical label angle: -90.0 (default) or 90.0]) + ++AC_ARG_ENABLE(docs,AS_HELP_STRING([--disable-docs],[disable building documentation]), ++[],[enable_docs=yes]) ++ + AC_ARG_ENABLE(examples,AS_HELP_STRING([--disable-examples],[disable building of examples]), + [],[enable_examples=yes]) + +@@ -115,6 +118,7 @@ AC_ARG_ENABLE(rrd_graph,AS_HELP_STRING([--disable-rrd_graph],[disable all rrd_gr + AC_ARG_ENABLE(rrd_restore,AS_HELP_STRING([--disable-rrd_restore],[disable rrd_restore XML import functions]), + [],[enable_rrd_restore=yes]) + ++AM_CONDITIONAL(BUILD_DOCS,[test $enable_docs != no]) + AM_CONDITIONAL(BUILD_EXAMPLES,[test $enable_examples != no]) + AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no]) + AM_CONDITIONAL(BUILD_RRDCACHED,[test $enable_rrdcached != no]) +@@ -945,6 +949,8 @@ fi + + AC_SUBST(COMP_PYTHON) + ++if test $enable_docs != no; then ++ + dnl Check for nroff + AC_ARG_VAR(NROFF, [path to the local nroff version]) + AC_PATH_PROGS(NROFF, [gnroff nroff]) +@@ -961,6 +967,8 @@ AC_ARG_VAR(RRDDOCDIR, [[DATADIR/doc/PACKAGE-VERSION] Documentation directory]) + if test -z "$RRDDOCDIR"; then + RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi + ++fi ++ + # systemd check + PKG_PROG_PKG_CONFIG + AC_ARG_WITH([systemdsystemunitdir], +-- +2.4.10 + diff --git a/package/rsyslog/0001-musl-fcntl-h.patch b/package/rsyslog/0001-musl-fcntl-h.patch new file mode 100644 index 0000000000..5c2daee695 --- /dev/null +++ b/package/rsyslog/0001-musl-fcntl-h.patch @@ -0,0 +1,30 @@ +From 835571774dc519dd2cff7ab1020cf298cc953a8f Mon Sep 17 00:00:00 2001 +From: Thordur Bjornsson +Date: Tue, 7 Jul 2015 12:34:08 +0200 +Subject: [PATCH] omfile: unconditionally include fcntl.h. + +required for open() flags + +Signed-off-by: Thordur Bjornsson +[Bernd: downloaded from upstream commit: + https://github.com/rsyslog/rsyslog/commit/835571774dc519dd2cff7ab1020cf298cc953a8f +Signed-off-by: Bernd Kuhls +--- + tools/omfile.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/tools/omfile.c b/tools/omfile.c +index 482e723..4444b97 100644 +--- a/tools/omfile.c ++++ b/tools/omfile.c +@@ -48,9 +48,7 @@ + #include + #include + #include +-#ifdef OS_SOLARIS +-# include +-#endif ++#include + #ifdef HAVE_ATOMIC_BUILTINS + # include + #endif diff --git a/package/rt-tests/01-fix-build-system.patch b/package/rt-tests/01-fix-build-system.patch new file mode 100644 index 0000000000..36af74776f --- /dev/null +++ b/package/rt-tests/01-fix-build-system.patch @@ -0,0 +1,52 @@ +From f9a55a87af57780ea8940561d22cd6a90f461416 Mon Sep 17 00:00:00 2001 +From: Alexey Brodkin +Date: Mon, 10 Nov 2014 11:44:55 +0300 +Subject: [PATCH] Fix various minor issues with rt-tests build system + +The issues fixed are : + + * Remove the automatic NUMA detection from the host + architecture. This is broken when doing cross-compilation. One can + still set NUMA=1 if NUMA support is desired. + + * Provide a HASPYTHON variable to tell whether the target system has + Python or not. Otherwise, the build system simply tests whether + Python is available on the host. The PYLIB variable is also changed + so that it can be overriden from the environment, in order to + provide the correct Python module location for the target. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Alexey Brodkin +Cc: Peter Korsgaard +--- + Makefile | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 318a5c6..645d138 100644 +--- a/Makefile ++++ b/Makefile +@@ -14,17 +14,13 @@ bindir ?= $(prefix)/bin + mandir ?= $(prefix)/share/man + srcdir ?= $(prefix)/src + +-machinetype = $(shell $(CC) -dumpmachine | \ +- sed -e 's/-.*//' -e 's/i.86/i386/' -e 's/mips.*/mips/' -e 's/ppc.*/powerpc/') +-ifneq ($(filter x86_64 i386 ia64 mips powerpc,$(machinetype)),) +-NUMA := 1 +-endif +- + CFLAGS ?= -Wall -Wno-nonnull + CPPFLAGS += -D_GNU_SOURCE -Isrc/include + LDFLAGS ?= + +-PYLIB := $(shell python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()') ++ifeq ($(HASPYTHON),1) ++PYLIB ?= $(shell python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()') ++endif + + ifndef DEBUG + CFLAGS += -O2 +-- +1.9.3 + diff --git a/package/rt-tests/02-uclibc.patch b/package/rt-tests/02-uclibc.patch new file mode 100644 index 0000000000..180bdf7c6e --- /dev/null +++ b/package/rt-tests/02-uclibc.patch @@ -0,0 +1,109 @@ +From 713224456f4a3242496af803413f670433f27c74 Mon Sep 17 00:00:00 2001 +From: Alexey Brodkin +Date: Mon, 10 Nov 2014 11:55:27 +0300 +Subject: [PATCH] [PATCH] fix build with uClibc + +Fix two build issues with (modern) uClibc: +- uClibc has clock_nanosleep() if built with UCLIBC_HAS_ADVANCED_REALTIME, + conflicting with emulation function +- uClibc doesn't provide utmpx.h if not built with UCLIBC_HAS_UTMPX, which + is included in several files (but not needed). + +Signed-off-by: Peter Korsgaard +--- + src/backfire/sendme.c | 1 - + src/cyclictest/cyclictest.c | 3 ++- + src/pmqtest/pmqtest.c | 1 - + src/ptsematest/ptsematest.c | 1 - + src/sigwaittest/sigwaittest.c | 2 -- + src/svsematest/svsematest.c | 1 - + 6 files changed, 2 insertions(+), 7 deletions(-) + +diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c +index 8c169dd..b959951 100644 +--- a/src/backfire/sendme.c ++++ b/src/backfire/sendme.c +@@ -32,7 +32,6 @@ + #include "rt-utils.h" + #include "rt-get_cpu.h" + +-#include + #include + #include + #include +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 4547831..343e421 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -56,7 +57,7 @@ + #define gettid() syscall(__NR_gettid) + #define sigev_notify_thread_id _sigev_un._tid + +-#ifdef __UCLIBC__ ++#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_ADVANCED_REALTIME__) + #define MAKE_PROCESS_CPUCLOCK(pid, clock) \ + ((~(clockid_t) (pid) << 3) | (clockid_t) (clock)) + #define CPUCLOCK_SCHED 2 +diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c +index 336a8eb..2e34afe 100644 +--- a/src/pmqtest/pmqtest.c ++++ b/src/pmqtest/pmqtest.c +@@ -33,7 +33,6 @@ + #include + #include + #include +-#include + #include + #include "rt-utils.h" + #include "rt-get_cpu.h" +diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c +index 7558a41..5358a65 100644 +--- a/src/ptsematest/ptsematest.c ++++ b/src/ptsematest/ptsematest.c +@@ -33,7 +33,6 @@ + #include + #include + #include +-#include + #include "rt-utils.h" + #include "rt-get_cpu.h" + #include "error.h" +diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c +index 428f5ce..85c32a2 100644 +--- a/src/sigwaittest/sigwaittest.c ++++ b/src/sigwaittest/sigwaittest.c +@@ -31,11 +31,9 @@ + #include + #include + #include +-#include + #include + #include + #include +-#include + #include "rt-utils.h" + #include "rt-get_cpu.h" + +diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c +index c1128cc..5d02550 100644 +--- a/src/svsematest/svsematest.c ++++ b/src/svsematest/svsematest.c +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + + #include + +-- +1.9.3 + diff --git a/package/rt-tests/03-fix-non-nptl-buil.patch b/package/rt-tests/03-fix-non-nptl-buil.patch new file mode 100644 index 0000000000..5c65018916 --- /dev/null +++ b/package/rt-tests/03-fix-non-nptl-buil.patch @@ -0,0 +1,55 @@ +From c6920f97be02ca3fba9320b043acd578ce4c62d8 Mon Sep 17 00:00:00 2001 +From: Alexey Brodkin +Date: Mon, 10 Nov 2014 10:00:13 +0300 +Subject: [PATCH] Makefile: allow building selected tests with non-NPTL + toolchain + +Some architectures are still stuck with non-NPTL toolchains. +These are for example ARC, Blackfin, Xtensa etc. + +Still rt-tests are very good benchmarks and it would be good to enable use of +at least selected (those that will be built) tests on those architectures. + +This change makes it possible to only build subset of tests that don't require +NPTL calls. + +By default behavior is not modified - all tests are built, but if one wants +to build with non-NPTL toolchain just add "HAVE_NPTL=no" in command line +or modify "HAVE_NPTL" variable right in Makefile and execute "make". + +This patch was submitted upstream: +https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg762958.html +so as soon as it is accepted with the next version bump this patch should be +removed. + +Signed-off-by: Alexey Brodkin +Cc: Vineet Gupta +Cc: Clark Williams +--- + Makefile | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 318a5c6..675edf7 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,8 +1,13 @@ + VERSION_STRING = 0.89 + +-sources = cyclictest.c signaltest.c pi_stress.c rt-migrate-test.c \ +- ptsematest.c sigwaittest.c svsematest.c pmqtest.c sendme.c \ +- pip_stress.c hackbench.c ++HAVE_NPTL ?= yes ++ ++ifeq ($(HAVE_NPTL),yes) ++sources = cyclictest.c pi_stress.c pip_stress.c pmqtest.c rt-migrate-test.c ++endif ++ ++sources += signaltest.c ptsematest.c sigwaittest.c svsematest.c sendme.c \ ++ hackbench.c + + TARGETS = $(sources:.c=) + +-- +1.9.3 + diff --git a/package/rt-tests/04-Makefile-fix-tests-dependencies.patch b/package/rt-tests/04-Makefile-fix-tests-dependencies.patch new file mode 100644 index 0000000000..0b2feb16d5 --- /dev/null +++ b/package/rt-tests/04-Makefile-fix-tests-dependencies.patch @@ -0,0 +1,50 @@ +From e464368807211978fe2dfccf081fa8dc7a35b71b Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Fri, 23 Jan 2015 07:52:21 +0200 +Subject: [PATCH] Makefile: fix tests dependencies + +librttest is listed in $(LIBS) so all tests must depend on librttest.a. +Fixes build failures like: + +.../armv7-ctng-linux-gnueabihf-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -o hackbench hackbench.o -lrt -lpthread -lrttest -L. +.../armv7-ctng-linux-gnueabihf/bin/ld: cannot find -lrttest +collect2: error: ld returned 1 exit status + +Signed-off-by: Baruch Siach +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index a3879cea8164..b9a1fed1b920 100644 +--- a/Makefile ++++ b/Makefile +@@ -69,14 +69,14 @@ cyclictest: cyclictest.o librttest.a + signaltest: signaltest.o librttest.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +-pi_stress: pi_stress.o ++pi_stress: pi_stress.o librttest.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + + hwlatdetect: src/hwlatdetect/hwlatdetect.py + chmod +x src/hwlatdetect/hwlatdetect.py + ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect + +-rt-migrate-test: rt-migrate-test.o ++rt-migrate-test: rt-migrate-test.o librttest.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + + ptsematest: ptsematest.o librttest.a +@@ -97,7 +97,7 @@ sendme: sendme.o librttest.a + pip_stress: pip_stress.o librttest.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +-hackbench: hackbench.o ++hackbench: hackbench.o librttest.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + + librttest.a: rt-utils.o error.o rt-get_cpu.o +-- +2.1.4 + diff --git a/package/ruby/0001-process.c-fix-rb_spawn_process-for-nommu.patch b/package/ruby/0001-process.c-fix-rb_spawn_process-for-nommu.patch new file mode 100644 index 0000000000..701c1059d2 --- /dev/null +++ b/package/ruby/0001-process.c-fix-rb_spawn_process-for-nommu.patch @@ -0,0 +1,34 @@ +From 24e6d5bcf791a5c3f46191e544731420ff8b1312 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Thu, 19 May 2016 11:10:02 -0300 +Subject: [PATCH] process.c: fix rb_spawn_process() for nommu + +rb_spawn_process() in process.c tries different solutions for when fork +and/or spawnv are/aren't available. +The last resort when both aren't is to use the system() call which +stores the value in the status variable, which isn't declared. + +Signed-off-by: Gustavo Zacarias +--- +Patch status: reported https://bugs.ruby-lang.org/issues/12398 + + process.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/process.c b/process.c +index e196639..40967f7 100644 +--- a/process.c ++++ b/process.c +@@ -3897,6 +3897,9 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen) + VALUE prog; + struct rb_execarg sarg; + #endif ++#if !defined HAVE_WORKING_FORK || !USE_SPAWNV ++ int status; ++#endif + + #if defined HAVE_WORKING_FORK && !USE_SPAWNV + pid = rb_fork_async_signal_safe(NULL, rb_exec_atfork, eargp, eargp->redirect_fds, errmsg, errmsg_buflen); +-- +2.7.3 + diff --git a/package/samba4/0001-disable-libbsd.patch b/package/samba4/0001-disable-libbsd.patch new file mode 100644 index 0000000000..67f79d0059 --- /dev/null +++ b/package/samba4/0001-disable-libbsd.patch @@ -0,0 +1,26 @@ +Disable libbsd support, samba4 uses a global config.h for its own +codebase and that of heimdal (when building with builtin). +This causes redefinition conflicts for link(2) when both standard unistd.h +and bsd/unistd.h get included. + +Signed-off-by: Gustavo Zacarias + +diff -Nura samba-4.2.0rc1.orig/lib/replace/wscript samba-4.2.0rc1/lib/replace/wscript +--- samba-4.2.0rc1.orig/lib/replace/wscript 2014-10-01 06:17:32.000000000 -0300 ++++ samba-4.2.0rc1/lib/replace/wscript 2014-10-01 07:21:13.559498987 -0300 +@@ -282,15 +282,6 @@ + conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign') + conf.CHECK_FUNCS('prctl') + +- # libbsd on some platforms provides strlcpy and strlcat +- if not conf.CHECK_FUNCS('strlcpy strlcat'): +- conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', +- checklibc=True) +- if not conf.CHECK_FUNCS('getpeereid'): +- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): +- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') +- + conf.CHECK_CODE(''' + struct ucred cred; + socklen_t cred_len; diff --git a/package/ser2net/0001-Fix-TIOCSRS485-undeclared-error.patch b/package/ser2net/0001-Fix-TIOCSRS485-undeclared-error.patch new file mode 100644 index 0000000000..9c6d1689b7 --- /dev/null +++ b/package/ser2net/0001-Fix-TIOCSRS485-undeclared-error.patch @@ -0,0 +1,65 @@ +ser2net: Fix compilation failures due to missing TIOCSRS485 macro + +Patch sent upstream: + https://sourceforge.net/p/ser2net/mailman/message/32905302/ + +Signed-off-by: Vicente Olivert Riera + +From: Yegor Yefremov + +include fixes compilations for systems, +where won't be included automatically. + +Move special Linux includes to dataxfer.h. + +Signed-off-by: Yegor Yefremov +--- + dataxfer.h | 5 +++-- + devcfg.c | 2 -- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/dataxfer.h b/dataxfer.h +index bd2665e..c3d7431 100644 +--- a/dataxfer.h ++++ b/dataxfer.h +@@ -20,8 +20,6 @@ + #ifndef DATAXFER + #define DATAXFER + +-#include +- + #include "controller.h" + + #ifdef USE_UUCP_LOCKING +@@ -30,6 +28,9 @@ extern int uucp_locking_enabled; + + #ifdef linux + ++#include ++#include ++ + #define USE_RS485_FEATURE + + /* Check, if the toolchain provides serial_rs485 structure and macros */ +diff --git a/devcfg.c b/devcfg.c +index ab819a6..1f84714 100644 +--- a/devcfg.c ++++ b/devcfg.c +@@ -18,7 +18,6 @@ + */ + + /* This code handles generating the configuration for the serial port. */ +- + #include + #include + #include +@@ -31,7 +30,6 @@ + #include + #include + #include +-#include + + #include "ser2net.h" + #include "selector.h" +-- +1.9.1 diff --git a/package/snmppp/0001-Add-missing-includes.patch b/package/snmppp/0001-Add-missing-includes.patch new file mode 100644 index 0000000000..c3fa491525 --- /dev/null +++ b/package/snmppp/0001-Add-missing-includes.patch @@ -0,0 +1,41 @@ +From 6433c6e8d81313ec7ef6c8d3abf96fffa537e23e Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli +Date: Tue, 1 Apr 2014 14:35:25 +0200 +Subject: [PATCH] Add missing includes + +Signed-off-by: Luca Ceresoli +--- + include/snmp_pp/config_snmp_pp.h.in | 4 ++++ + include/snmp_pp/smival.h | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/include/snmp_pp/config_snmp_pp.h.in b/include/snmp_pp/config_snmp_pp.h.in +index 89a5b0d..3100713 100644 +--- a/include/snmp_pp/config_snmp_pp.h.in ++++ b/include/snmp_pp/config_snmp_pp.h.in +@@ -28,6 +28,10 @@ + #ifndef _CONFIG_SNMP_PP_H_ + #define _CONFIG_SNMP_PP_H_ + ++#ifdef __linux__ ++#include ++#endif ++ + #define SNMP_PP_VERSION_STRING "@VERSION@" + #define SNMP_PP_VERSION @SNMP_PP_MAJOR_VERSION@ + #define SNMP_PP_RELEASE @SNMP_PP_MINOR_VERSION@ +diff --git a/include/snmp_pp/smival.h b/include/snmp_pp/smival.h +index 7a36fab..7522087 100644 +--- a/include/snmp_pp/smival.h ++++ b/include/snmp_pp/smival.h +@@ -59,6 +59,7 @@ + #define _SMIVALUE + + //----[ includes ]----------------------------------------------------- ++#include + #include "snmp_pp/smi.h" + + #ifdef SNMP_PP_NAMESPACE +-- +1.8.3.2 + diff --git a/package/snowball-hdmiservice/Config.in b/package/snowball-hdmiservice/Config.in new file mode 100644 index 0000000000..21a4f3c3cb --- /dev/null +++ b/package/snowball-hdmiservice/Config.in @@ -0,0 +1,14 @@ +config BR2_PACKAGE_SNOWBALL_HDMISERVICE + bool "snowball-hdmiservice" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + help + HDMI userspace control daemon + + This package contains the HDMI userspace control daemon for the + snowball board + + http://www.igloocommunity.org + +comment "snowball-hdmiservice needs a toolchain w/ threads, dynamic library" + depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS diff --git a/package/snowball-hdmiservice/snowball-hdmiservice.mk b/package/snowball-hdmiservice/snowball-hdmiservice.mk new file mode 100644 index 0000000000..267b5ad9b8 --- /dev/null +++ b/package/snowball-hdmiservice/snowball-hdmiservice.mk @@ -0,0 +1,25 @@ +################################################################################ +# +# snowball-hdmiservice +# +################################################################################ + +SNOWBALL_HDMISERVICE_VERSION = f75c99d1c52707240a78b4ba78e41d20d3aa3b08 +SNOWBALL_HDMISERVICE_SITE = $(call github,igloocommunity,hdmiservice,$(SNOWBALL_HDMISERVICE_VERSION)) +SNOWBALL_HDMISERVICE_LICENSE = MIT +SNOWBALL_HDMISERVICE_LICENSE_FILES = debian/copyright +SNOWBALL_HDMISERVICE_INSTALL_STAGING = YES + +define SNOWBALL_HDMISERVICE_BUILD_CMDS + $(MAKE) -C $(@D) CC="$(TARGET_CC) $(TARGET_CFLAGS)" +endef + +define SNOWBALL_HDMISERVICE_INSTALL_STAGING_CMDS + $(MAKE) -C $(@D) CC="$(TARGET_CC) $(TARGET_CFLAGS)" DESTDIR=$(STAGING_DIR) install +endef + +define SNOWBALL_HDMISERVICE_INSTALL_TARGET_CMDS + $(MAKE) -C $(@D) CC="$(TARGET_CC) $(TARGET_CFLAGS)" DESTDIR=$(TARGET_DIR) install +endef + +$(eval $(generic-package)) diff --git a/package/snowball-init/Config.in b/package/snowball-init/Config.in new file mode 100644 index 0000000000..6c94731203 --- /dev/null +++ b/package/snowball-init/Config.in @@ -0,0 +1,17 @@ +config BR2_PACKAGE_SNOWBALL_INIT + bool "snowball-init" + # Runtime dependency, needed by snowball startup script + select BR2_PACKAGE_BLUEZ_UTILS + depends on !BR2_STATIC_LIBS # bluez_utils + depends on BR2_USE_WCHAR # libglib2 + depends on BR2_TOOLCHAIN_HAS_THREADS # dbus, alsa-lib, libglib2 + depends on BR2_USE_MMU # dbus + select BR2_PACKAGE_UX500_FIRMWARE + help + Snowball init scripts + + http://www.igloocommunity.org + +comment "snowball-init needs a toolchain w/ wchar, threads, dynamic library" + depends on BR2_USE_MMU + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS diff --git a/package/snowball-init/snowball-init.mk b/package/snowball-init/snowball-init.mk new file mode 100644 index 0000000000..f06b03277a --- /dev/null +++ b/package/snowball-init/snowball-init.mk @@ -0,0 +1,16 @@ +################################################################################ +# +# snowball-init +# +################################################################################ + +SNOWBALL_INIT_VERSION = b064be21de25729039e5e54037bbdd2e25cfd5b7 +SNOWBALL_INIT_SITE = $(call github,igloocommunity,snowball-init,$(SNOWBALL_INIT_VERSION)) +SNOWBALL_INIT_LICENSE = BSD-4c +SNOWBALL_INIT_LICENSE_FILES = debian/copyright + +define SNOWBALL_INIT_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 $(@D)/snowball $(TARGET_DIR)/etc/init.d/S50snowball +endef + +$(eval $(generic-package)) diff --git a/package/socketcand/0001-Remove-inline-keyword.patch b/package/socketcand/0001-Remove-inline-keyword.patch new file mode 100644 index 0000000000..92e8737ba0 --- /dev/null +++ b/package/socketcand/0001-Remove-inline-keyword.patch @@ -0,0 +1,90 @@ +From bdb3cd081a694f8f6924e399d944e32c1578235c Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov +Date: Wed, 22 Jul 2015 11:03:27 +0200 +Subject: [PATCH] Remove inline keyword + +Fixes GCC5.x compilation issues related to C99 inline semantics. + +Signed-off-by: Yegor Yefremov +--- + socketcand.h | 8 ++++---- + state_bcm.c | 2 +- + state_control.c | 2 +- + state_isotp.c | 2 +- + state_raw.c | 2 +- + 5 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/socketcand.h b/socketcand.h +index a287fe2..39eef83 100644 +--- a/socketcand.h ++++ b/socketcand.h +@@ -27,10 +27,10 @@ + + #undef DEBUG_RECEPTION + +-inline void state_bcm(); +-inline void state_raw(); +-inline void state_isotp(); +-inline void state_control(); ++void state_bcm(); ++void state_raw(); ++void state_isotp(); ++void state_control(); + + extern int client_socket; + extern char **interface_names; +diff --git a/state_bcm.c b/state_bcm.c +index c63a0a9..0c980fa 100644 +--- a/state_bcm.c ++++ b/state_bcm.c +@@ -28,7 +28,7 @@ int sc = -1; + fd_set readfds; + struct timeval tv; + +-inline void state_bcm() { ++void state_bcm() { + int i, ret; + struct sockaddr_can caddr; + socklen_t caddrlen = sizeof(caddr); +diff --git a/state_control.c b/state_control.c +index 5f62b74..baa9df6 100644 +--- a/state_control.c ++++ b/state_control.c +@@ -17,7 +17,7 @@ + #include + #include + +-inline void state_control() { ++void state_control() { + char buf[MAXLEN]; + int i, items; + +diff --git a/state_isotp.c b/state_isotp.c +index ae66035..4005f94 100644 +--- a/state_isotp.c ++++ b/state_isotp.c +@@ -24,7 +24,7 @@ + int si = -1; + fd_set readfds; + +-inline void state_isotp() { ++void state_isotp() { + int i, items, ret; + + struct sockaddr_can addr; +diff --git a/state_raw.c b/state_raw.c +index 1bd2ece..99111ae 100644 +--- a/state_raw.c ++++ b/state_raw.c +@@ -31,7 +31,7 @@ char ctrlmsg[CMSG_SPACE(sizeof(struct timeval)) + CMSG_SPACE(sizeof(__u32))]; + struct timeval tv; + struct cmsghdr *cmsg; + +-inline void state_raw() { ++void state_raw() { + char buf[MAXLEN]; + int i, ret, items; + +-- +2.1.4 + diff --git a/package/sstrip/Config.in b/package/sstrip/Config.in new file mode 100644 index 0000000000..12a5941c54 --- /dev/null +++ b/package/sstrip/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_SSTRIP + bool "sstrip" + help + Small utility that removes a few bytes from an executable that + strip leaves behind. + + http://www.muppetlabs.com/~breadbox/software/elfkickers.html diff --git a/package/sstrip/sstrip.mk b/package/sstrip/sstrip.mk new file mode 100644 index 0000000000..fe57b3c19b --- /dev/null +++ b/package/sstrip/sstrip.mk @@ -0,0 +1,32 @@ +################################################################################ +# +# sstrip +# +################################################################################ + +SSTRIP_SITE = svn://svn.openwrt.org/openwrt/trunk/tools/sstrip +SSTRIP_VERSION = 20154 +HOST_SSTRIP_BINARY = $(GNU_TARGET_NAME)-sstrip + +define SSTRIP_BUILD_CMDS + cd $(@D) ; \ + $(TARGET_CC) $(TARGET_CFLAGS) -include endian.h -include byteswap.h \ + -o sstrip src/sstrip.c +endef + +define SSTRIP_INSTALL_TARGET_CMDS + $(INSTALL) -D $(@D)/sstrip $(TARGET_DIR)/usr/bin/sstrip +endef + +define HOST_SSTRIP_BUILD_CMDS + cd $(@D) ; \ + $(HOSTCC) $(HOST_CFLAGS) -include endian.h -include byteswap.h \ + -o sstrip src/sstrip.c +endef + +define HOST_SSTRIP_INSTALL_CMDS + $(INSTALL) -D $(@D)/sstrip $(HOST_DIR)/usr/bin/$(HOST_SSTRIP_BINARY) +endef + +$(eval $(generic-package)) +$(eval $(host-generic-package)) diff --git a/package/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch b/package/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch new file mode 100644 index 0000000000..0d81b59081 --- /dev/null +++ b/package/strace/0001-arc-metag-nios2-or1k-tile-fix-build.patch @@ -0,0 +1,104 @@ +From d83bcfa9a2977c037c638ae09e561f554ab19681 Mon Sep 17 00:00:00 2001 +From: Alexey Brodkin +Date: Sat, 26 Dec 2015 00:13:36 +0300 +Subject: [PATCH] arc, metag, nios2, or1k, tile: fix build + +Fix build regression introduced by commit +34683e3926d8c2daa368afb805da422ee7043396. + +* linux/32/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap. +* linux/arc/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap_pgoff. +* linux/nios2/syscallent.h: Likewise. +* linux/or1k/syscallent.h: Likewise. +* linux/tile/syscallent1.h: Add sys_ prefix to ARCH_mmap and sys_mmap_4koff. +* pathtrace.c (pathtrace_match): Handle SEN_ARCH_mmap. + +This is a back-port of upstream commit +http://sourceforge.net/p/strace/code/ci/dd1a80c8d213eed95fe55b7ebcb07ee165dd8e4b/ + +It should be removed upon the next bump of strace version. + +Signed-off-by: Alexey Brodkin +--- + linux/32/syscallent.h | 6 +++--- + linux/arc/syscallent.h | 2 +- + linux/nios2/syscallent.h | 2 +- + linux/or1k/syscallent.h | 2 +- + linux/tile/syscallent1.h | 2 +- + pathtrace.c | 1 + + 6 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h +index 5f997e7..e6f895c 100644 +--- a/linux/32/syscallent.h ++++ b/linux/32/syscallent.h +@@ -1,5 +1,5 @@ +-#ifndef ARCH_mmap +-# define ARCH_mmap mmap ++#ifndef sys_ARCH_mmap ++# define sys_ARCH_mmap sys_mmap + #endif + [ 0] = { 2, 0, SEN(io_setup), "io_setup" }, + [ 1] = { 1, 0, SEN(io_destroy), "io_destroy" }, +@@ -276,5 +276,5 @@ + [283] = { 2, 0, SEN(membarrier), "membarrier", }, + [284] = { 3, TM, SEN(mlock2), "mlock2" }, + +-#undef ARCH_mmap ++#undef sys_ARCH_mmap + #undef ARCH_WANT_SYNC_FILE_RANGE2 +diff --git a/linux/arc/syscallent.h b/linux/arc/syscallent.h +index 5847dc4..1100008 100644 +--- a/linux/arc/syscallent.h ++++ b/linux/arc/syscallent.h +@@ -1,4 +1,4 @@ +-#define ARCH_mmap mmap_pgoff ++#define sys_ARCH_mmap sys_mmap_pgoff + #include "32/syscallent.h" + [244] = { 3, 0, SEN(printargs), "arc_cacheflush"}, + [245] = { 1, 0, SEN(printargs), "arc_settls" }, +diff --git a/linux/nios2/syscallent.h b/linux/nios2/syscallent.h +index 8a4b70e..01efe3a 100644 +--- a/linux/nios2/syscallent.h ++++ b/linux/nios2/syscallent.h +@@ -1,4 +1,4 @@ +-#define ARCH_mmap mmap_pgoff ++#define sys_ARCH_mmap sys_mmap_pgoff + #include "32/syscallent.h" + [244] = {4, 0, SEN(cacheflush), "cacheflush"}, + [245 ... 259] = { }, +diff --git a/linux/or1k/syscallent.h b/linux/or1k/syscallent.h +index ed84b3b..351fe25 100644 +--- a/linux/or1k/syscallent.h ++++ b/linux/or1k/syscallent.h +@@ -1,4 +1,4 @@ +-#define ARCH_mmap mmap_pgoff ++#define sys_ARCH_mmap sys_mmap_pgoff + #include "32/syscallent.h" + [244] = { 3, NF, SEN(or1k_atomic), "or1k_atomic" }, + [245 ... 259] = { }, +diff --git a/linux/tile/syscallent1.h b/linux/tile/syscallent1.h +index c86f059..28dbab4 100644 +--- a/linux/tile/syscallent1.h ++++ b/linux/tile/syscallent1.h +@@ -1,4 +1,4 @@ +-#define ARCH_mmap mmap_4koff ++#define sys_ARCH_mmap sys_mmap_4koff + #define ARCH_WANT_SYNC_FILE_RANGE2 1 + #include "32/syscallent.h" + [244] = { 1, 0, SEN(printargs), "cmpxchg_badaddr" }, +diff --git a/pathtrace.c b/pathtrace.c +index d530ec2..e72cdf7 100644 +--- a/pathtrace.c ++++ b/pathtrace.c +@@ -216,6 +216,7 @@ pathtrace_match(struct tcb *tcp) + case SEN_mmap: + case SEN_mmap_4koff: + case SEN_mmap_pgoff: ++ case SEN_ARCH_mmap: + /* x, x, x, x, fd */ + return fdmatch(tcp, tcp->u_arg[4]); + +-- +2.4.3 + diff --git a/package/sunxi-mali-prop/Config.in b/package/sunxi-mali-prop/Config.in new file mode 100644 index 0000000000..b9efb4e351 --- /dev/null +++ b/package/sunxi-mali-prop/Config.in @@ -0,0 +1,4 @@ +# Sunxi-mali-prop is a git submodule of sunxi-mali. To use this package +# select the sunxi-mali option. +config BR2_PACKAGE_SUNXI_MALI_PROP + bool diff --git a/package/sunxi-mali-prop/sunxi-mali-prop.mk b/package/sunxi-mali-prop/sunxi-mali-prop.mk new file mode 100644 index 0000000000..b828dc275d --- /dev/null +++ b/package/sunxi-mali-prop/sunxi-mali-prop.mk @@ -0,0 +1,10 @@ +################################################################################ +# +# sunxi-mali-prop +# +################################################################################ + +SUNXI_MALI_PROP_VERSION = 1c5063f43cdc9de341c0d63b2e3921cab86c7742 +SUNXI_MALI_PROP_SITE = $(call github,linux-sunxi,sunxi-mali-proprietary,$(SUNXI_MALI_PROP_VERSION)) + +$(eval $(generic-package)) diff --git a/package/taglib/0001-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch b/package/taglib/0001-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch new file mode 100644 index 0000000000..535ccb4d38 --- /dev/null +++ b/package/taglib/0001-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch @@ -0,0 +1,40 @@ +From 4e6a75eed3602f10aff516f49c8088c6da8db9df Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Sun, 31 Aug 2014 12:11:57 +0200 +Subject: [PATCH 1/1] cmake: use the standard CMake flag to drive the shared + object build + +If BUILD_SHARED_LIBS is set and ENABLE_STATIC undefined, then drive +ENABLE_STATIC with the BUILD_SHARED_LIBS value. + +Signed-off-by: Samuel Martin +--- + CMakeLists.txt | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 317ffa1..9931957 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,7 +2,17 @@ project(taglib) + + cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) + +-option(ENABLE_STATIC "Make static version of libtag" OFF) ++# Use the standard CMake flag to drive the shared object build. ++if(DEFINED BUILD_SHARED_LIBS AND NOT DEFINED ENABLE_STATIC) ++ if(BUILD_SHARED_LIBS) ++ set(ENABLE_STATIC OFF) ++ else() ++ set(ENABLE_STATIC ON) ++ endif() ++else() ++ option(ENABLE_STATIC "Make static version of libtag" OFF) ++endif() ++ + if(ENABLE_STATIC) + add_definitions(-DTAGLIB_STATIC) + set(BUILD_SHARED_LIBS OFF) +-- +2.1.0 + diff --git a/package/tar/0001-fix-build-failure.patch b/package/tar/0001-fix-build-failure.patch new file mode 100644 index 0000000000..8550a3ef5a --- /dev/null +++ b/package/tar/0001-fix-build-failure.patch @@ -0,0 +1,52 @@ +Status: upstream +http://git.savannah.gnu.org/cgit/tar.git/commit/?id=e9ddc08da0982f36581ae5a8c7763453ff41cfe8 + +Signed-off-by: Gustavo Zacarias + +From e9ddc08da0982f36581ae5a8c7763453ff41cfe8 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Wed, 24 Sep 2014 21:22:16 +0000 +Subject: Bugfixes. + +* doc/tar.1: Fix typo in font spec. +* src/tar.c (sort_mode_arg, sort_mode_flag): Protect "inode" +(SAVEDIR_SORT_INODE) with D_INO_IN_DIRENT +--- +diff --git a/doc/tar.1 b/doc/tar.1 +index 9000627..b91de63 100644 +--- a/doc/tar.1 ++++ b/doc/tar.1 +@@ -879,7 +879,7 @@ Exclude files matching patterns listed in FILE. + \fB\-\-strip\-components\fR=\fINUMBER\fR + Strip \fINUMBER\fR leading components from file names on extraction. + .TP +-\fB\-\-transform\fR=\fIEXPRESSION\dR, \fB\-\-xform\fR=\fIEXPRESSION\fR ++\fB\-\-transform\fR=\fIEXPRESSION\fR, \fB\-\-xform\fR=\fIEXPRESSION\fR + Use sed replace \fIEXPRESSION\fR to transform file names. + .SS File name matching options + These options affect both exclude and include patterns. +diff --git a/src/tar.c b/src/tar.c +index 225c624..f8102e0 100644 +--- a/src/tar.c ++++ b/src/tar.c +@@ -1341,14 +1341,18 @@ static char filename_terminator; + static char const *const sort_mode_arg[] = { + "none", + "name", ++#if D_INO_IN_DIRENT + "inode", ++#endif + NULL + }; + + static int sort_mode_flag[] = { + SAVEDIR_SORT_NONE, + SAVEDIR_SORT_NAME, ++#if D_INO_IN_DIRENT + SAVEDIR_SORT_INODE ++#endif + }; + + ARGMATCH_VERIFY (sort_mode_arg, sort_mode_flag); +-- +cgit v0.9.0.2 diff --git a/package/tinc/0001-musl.patch b/package/tinc/0001-musl.patch new file mode 100644 index 0000000000..654c7058d7 --- /dev/null +++ b/package/tinc/0001-musl.patch @@ -0,0 +1,32 @@ +From: Jo-Philipp Wich +Date: Thu, 18 Jun 2015 21:58:31 +0000 (+0200) +Subject: fix musl compatibility +X-Git-Tag: release-1.0.26~9 +X-Git-Url: http://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=a04fd9d0c9babca461cee186677db8f607677c6a;hp=bb616245b7883ab30291cd8d46672ed2ae733166 + +fix musl compatibility + +Let configure include sys/if_tun.h when testing for netinet/if_ether.h +to detect the Kernel/libc header conflict on musl. + +After this patch, configure will correctly detect netinet/if_ether.h as +unusable and the subsequent compilation will not attempt to use it. + +Signed-off-by: Bernd Kuhls +(downloaded upstream commit included in tinc 1.0.25: + http://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff;h=a04fd9d0c9babca461cee186677db8f607677c6a) +--- + +diff --git a/src/have.h b/src/have.h +index e83f98f..69d5100 100644 +--- a/src/have.h ++++ b/src/have.h +@@ -207,4 +207,8 @@ + #include + #endif + ++#ifdef HAVE_LINUX_IF_TUN_H ++#include ++#endif ++ + #endif /* __TINC_SYSTEM_H__ */ diff --git a/package/tinyalsa/0001-tinypcminfo-make-function-pcm_get_format_name-static.patch b/package/tinyalsa/0001-tinypcminfo-make-function-pcm_get_format_name-static.patch new file mode 100644 index 0000000000..4c8d48fd9e --- /dev/null +++ b/package/tinyalsa/0001-tinypcminfo-make-function-pcm_get_format_name-static.patch @@ -0,0 +1,45 @@ +From 10d82df8d920ceec4be9028a4939f96d6f407e81 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 26 Aug 2015 09:20:13 +0200 +Subject: [PATCH] tinypcminfo: make function pcm_get_format_name() static + +When building tinyalsa with gcc 5.x, the following warnings appear: + +tinypcminfo.c:97:52: warning: 'format_lookup' is static but used in inline function 'pcm_get_format_name' which is not static + return bit_index < ARRAY_SIZE(format_lookup) ? format_lookup[bit_index] : NULL; + ^ +tinypcminfo.c:97:35: warning: 'format_lookup' is static but used in inline function 'pcm_get_format_name' which is not static + return bit_index < ARRAY_SIZE(format_lookup) ? format_lookup[bit_index] : NULL; + +And the build fails with: + +tinypcminfo.o: In function `main': +tinypcminfo.c:(.text+0x2f0): undefined reference to `pcm_get_format_name' +collect2: error: ld returned 1 exit status + +To fix this, this patch marks the pcm_get_format_name() as static, +since it's anyway only used in tinypcminfo.c. + +Submitted upstream: https://github.com/tinyalsa/tinyalsa/pull/61 + +Signed-off-by: Thomas Petazzoni +--- + tinypcminfo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tinypcminfo.c b/tinypcminfo.c +index b2d11bc..99eec34 100644 +--- a/tinypcminfo.c ++++ b/tinypcminfo.c +@@ -92,7 +92,7 @@ static const char *format_lookup[] = { + /* Returns a human readable name for the format associated with bit_index, + * NULL if bit_index is not known. + */ +-inline const char *pcm_get_format_name(unsigned bit_index) ++static inline const char *pcm_get_format_name(unsigned bit_index) + { + return bit_index < ARRAY_SIZE(format_lookup) ? format_lookup[bit_index] : NULL; + } +-- +2.5.0 + diff --git a/package/tinyalsa/0002-asound.h-include-time.h-to-get-struct-timespec-proto.patch b/package/tinyalsa/0002-asound.h-include-time.h-to-get-struct-timespec-proto.patch new file mode 100644 index 0000000000..1b5d43cec5 --- /dev/null +++ b/package/tinyalsa/0002-asound.h-include-time.h-to-get-struct-timespec-proto.patch @@ -0,0 +1,33 @@ +From c8333f8c7a4e4b9549abeef7530b2cd20a18e537 Mon Sep 17 00:00:00 2001 +From: rofl0r +Date: Mon, 12 Oct 2015 12:57:09 +0100 +Subject: [PATCH] asound.h: include to get struct timespec prototype + +without including it, we get +In file included from mixer.c:44:0: +include/sound/asound.h:337:18: error: field 'trigger_tstamp' has incomplete type +include/sound/asound.h:338:18: error: field 'tstamp' has incomplete type +etc. + +Signed-off-by: Baruch Siach +--- +Patch status: upstream commit c8333f8c7a4e + + include/sound/asound.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/sound/asound.h b/include/sound/asound.h +index a041628ec28e..7c6de81673f5 100644 +--- a/include/sound/asound.h ++++ b/include/sound/asound.h +@@ -12,6 +12,7 @@ + #ifndef __SOUND_ASOUND_H + #define __SOUND_ASOUND_H + ++#include + #include + + #define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) +-- +2.8.1 + diff --git a/package/tinyxml2/0001-Use-BUILD_SHARED_LIBS-cmake-standard.patch b/package/tinyxml2/0001-Use-BUILD_SHARED_LIBS-cmake-standard.patch new file mode 100644 index 0000000000..52288c509f --- /dev/null +++ b/package/tinyxml2/0001-Use-BUILD_SHARED_LIBS-cmake-standard.patch @@ -0,0 +1,65 @@ +From 69acf13fa679628259063c4d0cd17e59b8bb0b75 Mon Sep 17 00:00:00 2001 +From: xantares +Date: Fri, 14 Nov 2014 19:40:58 +0100 +Subject: [PATCH] Use BUILD_SHARED_LIBS cmake standard. + +Signed-off-by: Romain Naour +--- + CMakeLists.txt | 27 +++++++++------------------ + 1 file changed, 9 insertions(+), 18 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 91c61a4..4375bb9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,8 +10,8 @@ include(GNUInstallDirs) + ################################ + # set lib version here + +-set(GENERIC_LIB_VERSION "2.2.0") +-set(GENERIC_LIB_SOVERSION "2") ++set(GENERIC_LIB_VERSION "2.2.0") ++set(GENERIC_LIB_SOVERSION "2") + + + ################################ +@@ -46,12 +46,8 @@ endif(MSVC) + + ################################ + # Add targets +-set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries") +-if(BUILD_STATIC_LIBS) +- add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h) +- set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2) +-endif(BUILD_STATIC_LIBS) +-add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h) ++option(BUILD_SHARED_LIBS "build shared or static libraries" ON) ++add_library(tinyxml2 tinyxml2.cpp tinyxml2.h) + set_target_properties(tinyxml2 PROPERTIES + COMPILE_DEFINITIONS "TINYXML2_EXPORT" + VERSION "${GENERIC_LIB_VERSION}" +@@ -63,16 +59,11 @@ add_dependencies(test ${TARGET_DATA_COPY}) + target_link_libraries(test tinyxml2) + + +-if(BUILD_STATIC_LIBS) +- install(TARGETS tinyxml2 tinyxml2static +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-else(BUILD_STATIC_LIBS) +- install(TARGETS tinyxml2 +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-endif(BUILD_STATIC_LIBS) ++install(TARGETS tinyxml2 ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ + install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + foreach(p LIB INCLUDE) +-- +1.9.3 + diff --git a/package/tinyxml2/0002-Rename-test-fixed-cmake-warning.patch b/package/tinyxml2/0002-Rename-test-fixed-cmake-warning.patch new file mode 100644 index 0000000000..409269ac4b --- /dev/null +++ b/package/tinyxml2/0002-Rename-test-fixed-cmake-warning.patch @@ -0,0 +1,38 @@ +From 77631a9cf500a578338a83bc230c419bf2a05b50 Mon Sep 17 00:00:00 2001 +From: xantares +Date: Fri, 14 Nov 2014 19:46:18 +0100 +Subject: [PATCH] Rename test, fixed cmake warning. + +Signed-off-by: Romain Naour +--- + CMakeLists.txt | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4375bb9..4a8f91d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -53,10 +53,10 @@ set_target_properties(tinyxml2 PROPERTIES + VERSION "${GENERIC_LIB_VERSION}" + SOVERSION "${GENERIC_LIB_SOVERSION}") + +-add_executable(test xmltest.cpp) +-add_dependencies(test tinyxml2) +-add_dependencies(test ${TARGET_DATA_COPY}) +-target_link_libraries(test tinyxml2) ++add_executable(xmltest xmltest.cpp) ++add_dependencies(xmltest tinyxml2) ++add_dependencies(xmltest ${TARGET_DATA_COPY}) ++target_link_libraries(xmltest tinyxml2) + + + install(TARGETS tinyxml2 +@@ -76,4 +76,4 @@ endforeach() + configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-#add_test(test ${SAMPLE_NAME} COMMAND $) ++#add_test(xmltest ${SAMPLE_NAME} COMMAND $) +-- +1.9.3 + diff --git a/package/tmux/0001-remove-use-of-sys-cdefs.h.patch b/package/tmux/0001-remove-use-of-sys-cdefs.h.patch new file mode 100644 index 0000000000..929953fa9d --- /dev/null +++ b/package/tmux/0001-remove-use-of-sys-cdefs.h.patch @@ -0,0 +1,42 @@ +From 29e4794ca396a8db8a468ec74559922d2af5a987 Mon Sep 17 00:00:00 2001 +From: Nicholas Marriott +Date: Tue, 24 Nov 2015 18:46:50 +0000 +Subject: [PATCH] -sys/queue.h in proc.c, and nuke the unnecessary C++ header + guards stuff and sys/cdefs.h in vis.h (it causes problems on some platforms). + Reported by someone on GitHub, issue 212. + +--- +Backported from master upstream to fix musl build +https://github.com/tmux/tmux/commit/7b085136a7291cbcdfcc53182fbd13aaca70306e + +proc.c does not exist on version 2.1 + +Signed-off-by: Ricardo Martincoski +--- + compat/vis.h | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/compat/vis.h b/compat/vis.h +index 6795139..9f12d23 100644 +--- a/compat/vis.h ++++ b/compat/vis.h +@@ -73,9 +73,6 @@ + */ + #define UNVIS_END 1 /* no more characters */ + +-#include +- +-__BEGIN_DECLS + char *vis(char *, int, int, int); + int strvis(char *, const char *, int); + int stravis(char **, const char *, int); +@@ -85,6 +82,4 @@ int strunvis(char *, const char *); + int unvis(char *, char, int *, int); + ssize_t strnunvis(char *, const char *, size_t); + +-__END_DECLS +- + #endif /* !_VIS_H_ */ +-- +1.9.1 + diff --git a/package/torsmo/Config.in b/package/torsmo/Config.in new file mode 100644 index 0000000000..5c18ac6f48 --- /dev/null +++ b/package/torsmo/Config.in @@ -0,0 +1,11 @@ +config BR2_PACKAGE_TORSMO + bool "torsmo" + depends on BR2_DEPRECATED_SINCE_2015_11 + depends on BR2_PACKAGE_XORG7 + depends on BR2_USE_MMU # fork() + select BR2_PACKAGE_XLIB_LIBX11 + select BR2_PACKAGE_XLIB_LIBXEXT + help + Torsmo is a system monitor that sits in the corner of your desktop. + + http://mirror.egtvedt.no/avr32linux.org/twiki/pub/Main/Torsmo diff --git a/package/torsmo/torsmo.hash b/package/torsmo/torsmo.hash new file mode 100644 index 0000000000..8bbf9dc87a --- /dev/null +++ b/package/torsmo/torsmo.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 6a6bc82e71c841ba9359f0ffe370e57ef7b04b49a448252bb0c1c28fc10e964c torsmo-0.18.tar.gz diff --git a/package/torsmo/torsmo.mk b/package/torsmo/torsmo.mk new file mode 100644 index 0000000000..96a797603f --- /dev/null +++ b/package/torsmo/torsmo.mk @@ -0,0 +1,18 @@ +################################################################################ +# +# torsmo +# +################################################################################ + +TORSMO_VERSION = 0.18 +TORSMO_SITE = http://mirror.egtvedt.no/avr32linux.org/twiki/pub/Main/Torsmo +TORSMO_LICENSE = BSD-3c +TORSMO_LICENSE_FILES = COPYING + +# help2man doesn't work when cross compiling +TORSMO_CONF_ENV = ac_cv_path_HELP2MAN='' +TORSMO_CONF_OPTS = --x-includes="-I$(STAGING_DIR)/usr/include/X11" --x-libraries="-I$(STAGING_DIR)/usr/lib" --with-x + +TORSMO_DEPENDENCIES = xlib_libX11 xlib_libXext + +$(eval $(autotools-package)) diff --git a/package/tslib/0001-enable_raw_module.patch b/package/tslib/0001-enable_raw_module.patch new file mode 100644 index 0000000000..cb89338cf7 --- /dev/null +++ b/package/tslib/0001-enable_raw_module.patch @@ -0,0 +1,14 @@ +Enable raw module by default + +Signed-off-by: Daniel Nyström + +diff -Naur tslib-e000d35a.orig/etc/ts.conf tslib-e000d35a/etc/ts.conf +--- tslib-e000d35a.orig/etc/ts.conf 2010-12-21 18:54:45.000000000 +0100 ++++ tslib-e000d35a/etc/ts.conf 2010-12-21 18:55:03.000000000 +0100 +@@ -1,5 +1,5 @@ + # Uncomment if you wish to use the linux input layer event interface +-# module_raw input ++module_raw input + + # Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d + # module_raw collie diff --git a/package/tslib/0002-add_finddef_and_inputattach_utils.patch b/package/tslib/0002-add_finddef_and_inputattach_utils.patch new file mode 100644 index 0000000000..dcc6ec75ae --- /dev/null +++ b/package/tslib/0002-add_finddef_and_inputattach_utils.patch @@ -0,0 +1,718 @@ +diff -Naur tslib-org/tests/Makefile.am tslib-1.0/tests/Makefile.am +--- tslib-org/tests/Makefile.am 2006-08-25 00:02:55.000000000 +0300 ++++ tslib-1.0/tests/Makefile.am 2007-05-07 17:39:54.000000000 +0300 +@@ -12,7 +12,7 @@ + AM_CFLAGS = $(DEBUGFLAGS) + INCLUDES = -I$(top_srcdir)/src + +-bin_PROGRAMS = ts_test ts_calibrate ts_print ts_print_raw ts_harvest ++bin_PROGRAMS = ts_test ts_calibrate ts_print ts_print_raw ts_harvest ts_finddev inputattach + + ts_test_SOURCES = ts_test.c fbutils.c fbutils.h font_8x8.c font_8x16.c font.h + ts_test_LDADD = $(top_builddir)/src/libts.la +@@ -27,4 +27,10 @@ + ts_calibrate_LDADD = $(top_builddir)/src/libts.la + + ts_harvest_SOURCES = ts_harvest.c fbutils.c fbutils.h testutils.c testutils.h font_8x8.c font_8x16.c font.h +-ts_harvest_LDADD = $(top_builddir)/src/libts.la ++ts_harvest_LDADD = $(top_builddir)/src/libts.la ++ ++ts_finddev_SOURCES = ts_finddev.c ++ts_finddev_LDADD = $(top_builddir)/src/libts.la ++ ++inputattach_SOURCES = inputattach.c ++inputattach_LDADD = +diff -Naur tslib-org/tests/inputattach.c tslib-1.0/tests/inputattach.c +--- tslib-org/tests/inputattach.c 1970-01-01 02:00:00.000000000 +0200 ++++ tslib-1.0/tests/inputattach.c 2007-05-07 17:36:37.000000000 +0300 +@@ -0,0 +1,611 @@ ++/* ++ * $Id: inputattach.c,v 1.24 2006/02/08 12:19:31 vojtech Exp $ ++ * ++ * Copyright (c) 1999-2000 Vojtech Pavlik ++ * ++ * Sponsored by SuSE ++ * ++ * Twiddler support Copyright (c) 2001 Arndt Schoenewald ++ * Sponsored by Quelltext AG (http://www.quelltext-ag.de), Dortmund, Germany ++ */ ++ ++/* ++ * Input line discipline attach program ++ */ ++ ++/* ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * Should you need to contact me, the author, you can do so either by ++ * e-mail - mail your message to , or by paper mail: ++ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic ++ */ ++ ++/* softa note: ++cvs version is here: ++http://cvs.sourceforge.net/viewcvs.py/ *checkout* /linuxconsole/ruby/utils/inputattach.c ++*/ ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++// softa patch! ++/* ++ * Serio types ++ */ ++#ifndef SERIO_UNKNOWN ++ #define SERIO_UNKNOWN 0x00 ++#endif ++#ifndef SERIO_MSC ++ #define SERIO_MSC 0x01 ++#endif ++#ifndef SERIO_SUN ++ #define SERIO_SUN 0x02 ++#endif ++#ifndef SERIO_MS ++ #define SERIO_MS 0x03 ++#endif ++#ifndef SERIO_MP ++ #define SERIO_MP 0x04 ++#endif ++#ifndef SERIO_MZ ++ #define SERIO_MZ 0x05 ++#endif ++#ifndef SERIO_MZP ++ #define SERIO_MZP 0x06 ++#endif ++#ifndef SERIO_MZPP ++ #define SERIO_MZPP 0x07 ++#endif ++#ifndef SERIO_VSXXXAA ++ #define SERIO_VSXXXAA 0x08 ++#endif ++#ifndef SERIO_SUNKBD ++ #define SERIO_SUNKBD 0x10 ++#endif ++#ifndef SERIO_WARRIOR ++ #define SERIO_WARRIOR 0x18 ++#endif ++#ifndef SERIO_SPACEORB ++ #define SERIO_SPACEORB 0x19 ++#endif ++#ifndef SERIO_MAGELLAN ++ #define SERIO_MAGELLAN 0x1a ++#endif ++#ifndef SERIO_SPACEBALL ++ #define SERIO_SPACEBALL 0x1b ++#endif ++#ifndef SERIO_GUNZE ++ #define SERIO_GUNZE 0x1c ++#endif ++#ifndef SERIO_IFORCE ++ #define SERIO_IFORCE 0x1d ++#endif ++#ifndef SERIO_STINGER ++ #define SERIO_STINGER 0x1e ++#endif ++#ifndef SERIO_NEWTON ++ #define SERIO_NEWTON 0x1f ++#endif ++#ifndef SERIO_STOWAWAY ++ #define SERIO_STOWAWAY 0x20 ++#endif ++#ifndef SERIO_H3600 ++ #define SERIO_H3600 0x21 ++#endif ++#ifndef SERIO_PS2SER ++ #define SERIO_PS2SER 0x22 ++#endif ++#ifndef SERIO_TWIDKBD ++ #define SERIO_TWIDKBD 0x23 ++#endif ++#ifndef SERIO_TWIDJOY ++ #define SERIO_TWIDJOY 0x24 ++#endif ++#ifndef SERIO_HIL ++ #define SERIO_HIL 0x25 ++#endif ++#ifndef SERIO_SNES232 ++ #define SERIO_SNES232 0x26 ++#endif ++#ifndef SERIO_SEMTECH ++ #define SERIO_SEMTECH 0x27 ++#endif ++#ifndef SERIO_LKKBD ++ #define SERIO_LKKBD 0x28 ++#endif ++#ifndef SERIO_ELO ++ #define SERIO_ELO 0x29 ++#endif ++#ifndef SERIO_MICROTOUCH ++ #define SERIO_MICROTOUCH 0x30 ++#endif ++#ifndef SERIO_PENMOUNT ++ #define SERIO_PENMOUNT 0x31 ++#endif ++#ifndef SERIO_TOUCHRIGHT ++ #define SERIO_TOUCHRIGHT 0x32 ++#endif ++#ifndef SERIO_TOUCHWIN ++ #define SERIO_TOUCHWIN 0x33 ++#endif ++// end softa patch! ++ ++int readchar(int fd, unsigned char *c, int timeout) ++{ ++ struct timeval tv; ++ fd_set set; ++ ++ tv.tv_sec = 0; ++ tv.tv_usec = timeout * 1000; ++ ++ FD_ZERO(&set); ++ FD_SET(fd, &set); ++ ++ if (!select(fd+1, &set, NULL, NULL, &tv)) return -1; ++ if (read(fd, c, 1) != 1) return -1; ++ ++ return 0; ++} ++ ++ ++ ++void setline(int fd, int flags, int speed) ++{ ++ struct termios t; ++ ++ tcgetattr(fd, &t); ++ ++ t.c_cflag = flags | CREAD | HUPCL | CLOCAL; ++ t.c_iflag = IGNBRK | IGNPAR; ++ t.c_oflag = 0; ++ t.c_lflag = 0; ++ t.c_cc[VMIN ] = 1; ++ t.c_cc[VTIME] = 0; ++ ++ cfsetispeed(&t, speed); ++ cfsetospeed(&t, speed); ++ ++ tcsetattr(fd, TCSANOW, &t); ++} ++ ++int logitech_command(int fd, char *c) ++{ ++ int i; ++ unsigned char d; ++ for (i = 0; c[i]; i++) { ++ write(fd, c + i, 1); ++ if (readchar(fd, &d, 1000)) ++ return -1; ++ if (c[i] != d) ++ return -1; ++ } ++ return 0; ++} ++ ++int magellan_init(int fd, long *id, long *extra) ++{ ++ write(fd, "m3\rpBB\rz\r", 9); ++ return 0; ++} ++ ++int warrior_init(int fd, long *id, long *extra) ++{ ++ if (logitech_command(fd, "*S")) return -1; ++ setline(fd, CS8, B4800); ++ return 0; ++} ++ ++int spaceball_waitchar(int fd, unsigned char c, unsigned char *d, int timeout) ++{ ++ unsigned char b = 0; ++ ++ while (!readchar(fd, &b, timeout)) { ++ if (b == 0x0a) continue; ++ *d++ = b; ++ if (b == c) break; ++ } ++ ++ *d = 0; ++ ++ return -(b != c); ++} ++ ++int spaceball_waitcmd(int fd, char c, char *d) ++{ ++ int i; ++ ++ for (i = 0; i < 8; i++) { ++ if (spaceball_waitchar(fd, 0x0d, d, 1000)) ++ return -1; ++ if (d[0] == c) ++ return 0; ++ } ++ ++ return -1; ++} ++ ++int spaceball_cmd(int fd, char *c, char *d) ++{ ++ int i; ++ ++ for (i = 0; c[i]; i++) ++ write(fd, c + i, 1); ++ write(fd, "\r", 1); ++ ++ i = spaceball_waitcmd(fd, toupper(c[0]), d); ++ ++ return i; ++} ++ ++#define SPACEBALL_1003 1 ++#define SPACEBALL_2003B 3 ++#define SPACEBALL_2003C 4 ++#define SPACEBALL_3003C 7 ++#define SPACEBALL_4000FLX 8 ++#define SPACEBALL_4000FLX_L 9 ++ ++int spaceball_init(int fd, long *id, long *extra) ++{ ++ char r[64]; ++ ++ if (spaceball_waitchar(fd, 0x11, r, 4000) || ++ spaceball_waitchar(fd, 0x0d, r, 1000)) ++ return -1; ++ ++ if (spaceball_waitcmd(fd, '@', r)) ++ return -1; ++ ++ if (strncmp("@1 Spaceball alive", r, 18)) ++ return -1; ++ ++ if (spaceball_waitcmd(fd, '@', r)) ++ return -1; ++ ++ if (spaceball_cmd(fd, "hm", r)) ++ return -1; ++ ++ if (!strncmp("Hm2003B", r, 7)) ++ *id = SPACEBALL_2003B; ++ if (!strncmp("Hm2003C", r, 7)) ++ *id = SPACEBALL_2003C; ++ if (!strncmp("Hm3003C", r, 7)) ++ *id = SPACEBALL_3003C; ++ ++ if (!strncmp("HvFirmware", r, 10)) { ++ ++ if (spaceball_cmd(fd, "\"", r)) ++ return -1; ++ ++ if (strncmp("\"1 Spaceball 4000 FLX", r, 21)) ++ return -1; ++ ++ if (spaceball_waitcmd(fd, '"', r)) ++ return -1; ++ ++ if (strstr(r, " L ")) ++ *id = SPACEBALL_4000FLX_L; ++ else ++ *id = SPACEBALL_4000FLX; ++ ++ if (spaceball_waitcmd(fd, '"', r)) ++ return -1; ++ ++ if (spaceball_cmd(fd, "YS", r)) ++ return -1; ++ ++ if (spaceball_cmd(fd, "M", r)) ++ return -1; ++ ++ return 0; ++ } ++ ++ if (spaceball_cmd(fd, "P@A@A", r) || ++ spaceball_cmd(fd, "FT@", r) || ++ spaceball_cmd(fd, "MSS", r)) ++ return -1; ++ ++ return 0; ++} ++ ++int stinger_init(int fd, long *id, long *extra) ++{ ++ int i; ++ unsigned char c; ++ unsigned char *response = "\r\n0600520058C272"; ++ ++ if (write(fd, " E5E5", 5) != 5) /* Enable command */ ++ return -1; ++ ++ for (i = 0; i < 16; i++) /* Check for Stinger */ ++ if (readchar(fd, &c, 200) || (c != response[i])) ++ return -1; ++ ++ return 0; ++} ++ ++int mzp_init(int fd, long *id, long *extra) ++{ ++ if (logitech_command(fd, "*X*q")) return -1; ++ setline(fd, CS8, B9600); ++ return 0; ++} ++ ++int newton_init(int fd, long *id, long *extra) ++{ ++ int i; ++ unsigned char c; ++ unsigned char response[35] = ++ { 0x16, 0x10, 0x02, 0x64, 0x5f, 0x69, 0x64, 0x00, ++ 0x00, 0x00, 0x0c, 0x6b, 0x79, 0x62, 0x64, 0x61, ++ 0x70, 0x70, 0x6c, 0x00, 0x00, 0x00, 0x01, 0x6e, ++ 0x6f, 0x66, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10, ++ 0x03, 0xdd, 0xe7 }; ++ ++ for (i = 0; i < 35; i++) ++ if (readchar(fd, &c, 400) || (c != response[i])) ++ return -1; ++ ++ return 0; ++} ++ ++int twiddler_init(int fd, long *id, long *extra) ++{ ++ unsigned char c[10]; ++ int count, line; ++ ++ /* Turn DTR off, otherwise the Twiddler won't send any data. */ ++ if (ioctl(fd, TIOCMGET, &line)) return -1; ++ line &= ~TIOCM_DTR; ++ if (ioctl(fd, TIOCMSET, &line)) return -1; ++ ++ /* Check whether the device on the serial line is the Twiddler. ++ * ++ * The Twiddler sends data packets of 5 bytes which have the following ++ * properties: the MSB is 0 on the first and 1 on all other bytes, and ++ * the high order nibble of the last byte is always 0x8. ++ * ++ * We read and check two of those 5 byte packets to be sure that we ++ * are indeed talking to a Twiddler. */ ++ ++ /* Read at most 5 bytes until we find one with the MSB set to 0 */ ++ for (count = 0; count < 5; count++) { ++ if (readchar(fd, c+0, 500)) return -1; ++ if ((c[0] & 0x80) == 0) break; ++ } ++ ++ if (count == 5) { ++ /* Could not find header byte in data stream */ ++ return -1; ++ } ++ ++ /* Read remaining 4 bytes plus the full next data packet */ ++ for (count = 1; count < 10; count++) { ++ if (readchar(fd, c+count, 500)) return -1; ++ } ++ ++ /* Check whether the bytes of both data packets obey the rules */ ++ for (count = 1; count < 10; count++) { ++ if ((count % 5 == 0 && (c[count] & 0x80) != 0) ++ || (count % 5 == 4 && (c[count] & 0xF0) != 0x80) ++ || (count % 5 != 0 && (c[count] & 0x80) != 0x80)) { ++ /* Invalid byte in data packet */ ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++int penmount_init(int fd, long *id, long *extra) ++{ ++ unsigned char init_cmd[5] = { 0xF2, 0x00, 0x00, 0x00, 0x00 }; ++ unsigned char start_cmd[5] = { 0xF1, 0x00, 0x00, 0x00, 0x00 }; ++ unsigned char c[10]; ++ int count; ++ ++ /* try to initialize device */ ++ if (write( fd, init_cmd, 5 ) != 5) ++ return -1; ++ ++ /* read the responce */ ++ for (count = 0; count < 5; count ++) { ++ if (readchar(fd, c+0, 500)) return -1; ++ if (c[0] == 0xf2) break; ++ } ++ ++ if (readchar(fd, c+1, 500)) return -1; ++ if (c[1] != 0xd9) return -1; ++ ++ if (readchar(fd, c+2, 500)) return -1; ++ if (c[2] != 0x0a) return -1; ++ ++ /* the device is present! start it! */ ++ if (write( fd, start_cmd, 5 ) != 5) ++ return -1; ++ ++ return 0; ++} ++ ++int dump_init(int fd, long *id, long *extra) ++{ ++ unsigned char c, o = 0; ++ ++ c = 0x80; ++ ++ if (write(fd, &c, 1) != 1) /* Enable command */ ++ return -1; ++ ++ while (1) ++ if (!readchar(fd, &c, 1)) { ++ printf("%02x (%c) ", c, ((c > 32) && (c < 127)) ? c : 'x'); ++ o = 1; ++ } else { ++ if (o) { ++ printf("\n"); ++ o = 0; ++ } ++ } ++} ++ ++struct input_types { ++ char name[16]; ++ char name2[16]; ++ int speed; ++ int flags; ++ unsigned long type; ++ unsigned long id; ++ unsigned long extra; ++ int flush; ++ int (*init)(int fd, long *id, long *extra); ++}; ++ ++struct input_types input_types[] = { ++ ++{ "--sunkbd", "-skb", B1200, CS8, SERIO_SUNKBD, 0, 0, 1, NULL }, ++{ "--lkkbd", "-lk", B4800, CS8|CSTOPB, SERIO_LKKBD, 0, 0, 1, NULL }, ++{ "--vsxxx-aa", "-vs", B4800, CS8|CSTOPB|PARENB|PARODD,SERIO_VSXXXAA, 0, 0, 1, NULL }, ++{ "--spaceorb", "-orb", B9600, CS8, SERIO_SPACEORB, 0, 0, 1, NULL }, ++{ "--spaceball", "-sbl", B9600, CS8, SERIO_SPACEBALL,0, 0, 0, spaceball_init }, ++{ "--magellan", "-mag", B9600, CS8 | CSTOPB | CRTSCTS, SERIO_MAGELLAN, 0, 0, 1, magellan_init }, ++{ "--warrior", "-war", B1200, CS7 | CSTOPB, SERIO_WARRIOR, 0, 0, 1, warrior_init }, ++{ "--stinger", "-sting", B1200, CS8, SERIO_STINGER, 0, 0, 1, stinger_init }, ++{ "--mousesystems", "-msc", B1200, CS8, SERIO_MSC, 0, 0x01, 1, NULL }, ++{ "--sunmouse", "-sun", B1200, CS8, SERIO_SUN, 0, 0x01, 1, NULL }, ++{ "--microsoft", "-bare", B1200, CS7, SERIO_MS, 0, 0, 1, NULL }, ++{ "--mshack", "-ms", B1200, CS7, SERIO_MS, 0, 0x01, 1, NULL }, ++{ "--mouseman", "-mman", B1200, CS7, SERIO_MP, 0, 0x01, 1, NULL }, ++{ "--intellimouse", "-ms3", B1200, CS7, SERIO_MZ, 0, 0x11, 1, NULL }, ++{ "--mmwheel", "-mmw", B1200, CS7 | CSTOPB, SERIO_MZP, 0, 0x13, 1, mzp_init }, ++{ "--iforce", "-ifor", B38400, CS8, SERIO_IFORCE, 0, 0, 0, NULL }, ++{ "--newtonkbd", "-newt", B9600, CS8, SERIO_NEWTON, 0, 0, 0, newton_init }, ++{ "--h3600ts", "-ipaq", B115200, CS8, SERIO_H3600, 0, 0, 0, NULL }, ++{ "--stowawaykbd", "-ipaqkbd", B115200, CS8, SERIO_STOWAWAY, 0, 0, 0, NULL }, ++{ "--ps2serkbd", "-ps2ser", B1200, CS8, SERIO_PS2SER, 0, 0, 1, NULL }, ++{ "--twiddler", "-twid", B2400, CS8, SERIO_TWIDKBD, 0, 0, 0, twiddler_init }, ++{ "--twiddler-joy", "-twidjoy", B2400, CS8, SERIO_TWIDJOY, 0, 0, 0, twiddler_init }, ++{ "--elotouch", "-elo", B9600, CS8 | CRTSCTS, SERIO_ELO, 0, 0, 0, NULL }, ++{ "--elo4002", "-elo6b", B9600, CS8 | CRTSCTS, SERIO_ELO, 1, 0, 0, NULL }, ++{ "--elo271-140", "-elo4b", B9600, CS8 | CRTSCTS, SERIO_ELO, 2, 0, 0, NULL }, ++{ "--elo261-280", "-elo3b", B9600, CS8 | CRTSCTS, SERIO_ELO, 3, 0, 0, NULL }, ++{ "--dump", "-dump", B2400, CS8, 0, 0, 0, 0, dump_init }, ++{ "--dmc9000", "-dmc", B19200, CS8, SERIO_PENMOUNT, 0, 0, 0, penmount_init }, ++{ "", "", 0, 0 } ++ ++}; ++ ++int main(int argc, char **argv) ++{ ++ unsigned long devt; ++ int ldisc; ++ int type; ++ long id, extra; ++ int fd; ++ char c; ++ ++ if (argc < 2 || argc > 3 || !strcmp("--help", argv[1])) { ++ puts(""); ++ puts("Usage: inputttach "); ++ puts(""); ++ puts("Modes:"); ++ puts(" --sunkbd -skb Sun Type 4 and Type 5 keyboards"); ++ puts(" --lkkbd -lk DEC LK201 / LK401 keyboards"); ++ puts(" --vsxxx-aa -vs DEC VSXXX-AA / VSXXX-GA mouse and VSXXX-AB tablet"); ++ puts(" --spaceorb -orb SpaceOrb 360 / SpaceBall Avenger"); ++ puts(" --spaceball -sbl SpaceBall 2003 / 3003 / 4000 FLX"); ++ puts(" --magellan -mag Magellan / SpaceMouse"); ++ puts(" --warrior -war WingMan Warrior"); ++ puts(" --stinger -stng Gravis Stinger"); ++ puts(" --mousesystems -msc 3-button Mouse Systems mice"); ++ puts(" --sunmouse -sun 3-button Sun mice"); ++ puts(" --microsoft -bare 2-button Microsoft mice"); ++ puts(" --mshack -ms 3-button mice in Microsoft mode"); ++ puts(" --mouseman -mman 3-button Logitech and Genius mice"); ++ puts(" --intellimouse -ms3 Microsoft IntelliMouse"); ++ puts(" --mmwheel -mmw Logitech mice with 4-5 buttons or wheel"); ++ puts(" --iforce -ifor I-Force joysticks and wheels"); ++ puts(" --h3600ts -ipaq Ipaq h3600 touchscreen"); ++ puts(" --stowawaykbd -ipaqkbd Stowaway keyboard"); ++ puts(" --ps2serkbd -ps2ser PS/2 via serial keyboard"); ++ puts(" --twiddler -twid Handykey Twiddler chording keyboard"); ++ puts(" --twiddler-joy -twidjoy Handykey Twiddler used as a joystick"); ++ puts(" --dmc9000 -dmc DMC9000/Penpount touchscreen"); ++ puts(""); ++ return 1; ++ } ++ ++ for (type = 0; input_types[type].speed; type++) { ++ if (!strncasecmp(argv[1], input_types[type].name, 16) || ++ !strncasecmp(argv[1], input_types[type].name2, 16)) ++ break; ++ } ++ ++ if (!input_types[type].speed) { ++ fprintf(stderr, "inputattach: invalid mode\n"); ++ return 1; ++ } ++ ++ if ((fd = open(argv[2], O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) { ++ perror("inputattach"); ++ return 1; ++ } ++ ++ setline(fd, input_types[type].flags, input_types[type].speed); ++ ++ if (input_types[type].flush) ++ while (!readchar(fd, &c, 100)); ++ ++ id = input_types[type].id; ++ extra = input_types[type].extra; ++ ++ if (input_types[type].init && input_types[type].init(fd, &id, &extra)) { ++ fprintf(stderr, "inputattach: device initialization failed\n"); ++ return 1; ++ } ++ ++ ldisc = N_MOUSE; ++ if(ioctl(fd, TIOCSETD, &ldisc)) { ++ fprintf(stderr, "inputattach: can't set line discipline\n"); ++ return 1; ++ } ++ ++ devt = input_types[type].type | (id << 8) | (extra << 16); ++ ++ if(ioctl(fd, SPIOCSTYPE, &devt)) { ++ fprintf(stderr, "inputattach: can't set device type\n"); ++ return 1; ++ } ++ ++ read(fd, NULL, 0); ++ ++ ldisc = 0; ++ ioctl(fd, TIOCSETD, &ldisc); ++ close(fd); ++ ++ return 0; ++} +diff -Naur tslib-org/tests/ts_finddev.c tslib-1.0/tests/ts_finddev.c +--- tslib-org/tests/ts_finddev.c 1970-01-01 02:00:00.000000000 +0200 ++++ tslib-1.0/tests/ts_finddev.c 2007-05-07 17:36:37.000000000 +0300 +@@ -0,0 +1,75 @@ ++/* ++ * tslib/src/ts_print.c ++ * ++ * Derived from tslib/src/ts_test.c by Douglas Lowder ++ * Just prints touchscreen events -- does not paint them on framebuffer ++ * ++ * This file is placed under the GPL. Please see the file ++ * COPYING for more details. ++ * ++ * Basic test program for touchscreen library. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "tslib.h" ++ ++void usage( int argc, char** argv ) { ++ printf( "Usage: %s device_name wait_for_sec\n", argv[0] ); ++ printf( "\tdevice_name - tdevice to probe, example /dev/input/event0\n" ); ++ printf( "\twait_for_sec - wait seconds for touch event, if 0 - dont wait!\n" ); ++ printf( "\tReturn codes:\n" ); ++ printf( "\t 0 - timeout expired without receiving event.\n" ); ++ printf( "\t But this maybe is TouchScreen.\n" ); ++ printf( "\t -1 - this is NOT TouchScreen device!\n" ); ++ printf( "\t 1 - this is TouchScreen for shure!\n" ); ++ exit(-1); ++} ++ ++void alarm_handler( int sig ) { ++ // time is expired! ++ exit(0); ++} ++ ++int main( int argc, char** argv ) ++{ ++ struct tsdev *ts; ++ struct ts_sample samp; ++ char *tsdevice=NULL; ++ int waitsec; ++ int ret; ++ ++ if (argc != 3) ++ usage( argc, argv ); ++ ++ tsdevice = argv[1]; ++ waitsec = atoi( argv[2] ); ++ if (waitsec < 0) ++ usage( argc, argv ); ++ ++ ts = ts_open( tsdevice, 0 ); ++ if (!ts) ++ return -1; ++ if (ts_config(ts)) ++ return -1; ++ ++ if (!waitsec) { ++ return 0; ++ } ++ ++ printf( "Probe device %s, Please Touch Screen Anywhere in %i seconds! ... \n", tsdevice, waitsec ); ++ signal( SIGALRM, alarm_handler ); ++ alarm( waitsec ); ++ ret = ts_read_raw(ts, &samp, 1 ); ++ if (ret) ++ return 1; ++ ++ return -1; ++} diff --git a/package/tvheadend/0002-ffmpeg-revert-minimum-required-version-numbers.patch b/package/tvheadend/0002-ffmpeg-revert-minimum-required-version-numbers.patch new file mode 100644 index 0000000000..74136fe451 --- /dev/null +++ b/package/tvheadend/0002-ffmpeg-revert-minimum-required-version-numbers.patch @@ -0,0 +1,51 @@ +From 78a7b7365a67fa2f5394c6b4ca39de01b00416dc Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls +Date: Sat, 2 Apr 2016 19:05:52 +0200 +Subject: [PATCH 1/1] ffmpeg: revert minimum required version numbers + +This commit reverts the minimum version numbers required by configure to +the values before +https://github.com/tvheadend/tvheadend/commit/1359effe28a0381b8c9cbd362d6e144fb87b00fc#diff-e2d5a00791bce9a01f99bc6fd613a39dL486 +in order to allow compilation with older versions of ffmpeg again. + +Please note that the previous version numbers of all ffmpeg libs, with +the exception of libavfilter, are those of ffmpeg 2.0.7: +https://ffmpeg.org/olddownload.html + +Therefore I synced the minimum version number required for libavfilter to +3.79.101 and not to 4.0.0 as previous in tvheadend's configure script. + +Signed-off-by: Bernd Kuhls +[Patch sent upstream: https://github.com/tvheadend/tvheadend/pull/838] +--- + configure | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/configure b/configure +index be3d2e2..2ffd280 100755 +--- a/configure ++++ b/configure +@@ -512,13 +512,13 @@ else + if enabled_or_auto libav; then + has_libav=true + +- check_pkg libavfilter ">=6.31.100" || has_libav=false +- check_pkg libswresample ">=2.0.101" || has_libav=false +- check_pkg libavresample ">=3.0.0" || has_libav=false +- check_pkg libswscale ">=4.0.100" || has_libav=false +- check_pkg libavformat ">=57.25.100" || has_libav=false +- check_pkg libavcodec ">=57.24.102" || has_libav=false +- check_pkg libavutil ">=55.17.103" || has_libav=false ++ check_pkg libavfilter ">=3.79.101" || has_libav=false ++ check_pkg libswresample ">=0.17.102" || has_libav=false ++ check_pkg libavresample ">=1.1.0" || has_libav=false ++ check_pkg libswscale ">=2.3.100" || has_libav=false ++ check_pkg libavformat ">=55.12.100" || has_libav=false ++ check_pkg libavcodec ">=55.18.102" || has_libav=false ++ check_pkg libavutil ">=52.38.100" || has_libav=false + + if $has_libav; then + enable libav +-- +2.8.0.rc3 + diff --git a/package/uboot-tools/0003-tools-env-bug-config-structs-must-be-defined-in-tool.patch b/package/uboot-tools/0003-tools-env-bug-config-structs-must-be-defined-in-tool.patch new file mode 100644 index 0000000000..380e8cce3f --- /dev/null +++ b/package/uboot-tools/0003-tools-env-bug-config-structs-must-be-defined-in-tool.patch @@ -0,0 +1,58 @@ +From 43cb65b7a00e4759427a6e4b8a02039e43dab5a5 Mon Sep 17 00:00:00 2001 +From: Andreas Fenkart +Date: Fri, 25 Mar 2016 14:52:19 +0100 +Subject: [PATCH] tools: env: bug: config structs must be defined in tools + library +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +fw_senten/fw_printenv can be compiled as a tools library, excluding the +fw_env_main object. + +Fixes build error when linking with libubootenv: + fw_env.c:(.text+0x94): undefined reference to `common_args' + +Backported from: 43cb65b7a00e4759427a6e4b8a02039e43dab5a5 + +Reported-by: Stefano Babic +Signed-off-by: Andreas Fenkart +Signed-off-by: Jörg Krause +--- + tools/env/fw_env.c | 4 ++++ + tools/env/fw_env_main.c | 4 ---- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c +index 5c7505c..1420ac5 100644 +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -35,6 +35,10 @@ + + #include "fw_env.h" + ++struct common_args common_args; ++struct printenv_args printenv_args; ++struct setenv_args setenv_args; ++ + #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + + #define min(x, y) ({ \ +diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c +index 3bec5b9..3706d8f 100644 +--- a/tools/env/fw_env_main.c ++++ b/tools/env/fw_env_main.c +@@ -49,10 +49,6 @@ static struct option long_options[] = { + {NULL, 0, NULL, 0} + }; + +-struct common_args common_args; +-struct printenv_args printenv_args; +-struct setenv_args setenv_args; +- + void usage_printenv(void) + { + +-- +2.8.2 + diff --git a/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch b/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch new file mode 100644 index 0000000000..10cc3a506e --- /dev/null +++ b/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch @@ -0,0 +1,153 @@ +From 44d733203637666926964957af7af23429ddcecf Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Mon, 18 Apr 2016 09:58:56 -0300 +Subject: [PATCH] Fix libmount build under uClibc + +See https://bugs.gentoo.org/show_bug.cgi?id=406303 +http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?revision=1.2 + +[Gustavo: converted to git format for 2.28] + +Signed-off-by: Gustavo Zacarias +--- + configure.ac | 1 - + libmount/src/tab_parse.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 52 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 5a00403..3422f11 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -948,7 +948,6 @@ AC_ARG_ENABLE([libmount], + ) + UL_BUILD_INIT([libmount]) + UL_REQUIRES_BUILD([libmount], [libblkid]) +-UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier]) + AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes]) + AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes]) + AS_IF([test "x$build_libmount" = xyes], [ +diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c +index 3f5e14a..2ff1795 100644 +--- a/libmount/src/tab_parse.c ++++ b/libmount/src/tab_parse.c +@@ -39,6 +39,10 @@ static void parser_cleanup(struct libmnt_parser *pa) + memset(pa, 0, sizeof(*pa)); + } + ++#ifndef HAVE_SCANF_MS_MODIFIER ++# define UL_SCNsA "%s" ++#endif ++ + static int next_number(char **s, int *num) + { + char *end = NULL; +@@ -69,16 +73,31 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, char *s) + int rc, n = 0, xrc; + char *src = NULL, *fstype = NULL, *optstr = NULL; + ++#ifndef HAVE_SCANF_MS_MODIFIER ++ size_t len = strlen(s) + 1; ++ src = malloc(len); ++ fstype = malloc(len); ++ fs->target = malloc(len); ++ optstr = malloc(len); ++#endif ++ + rc = sscanf(s, UL_SCNsA" " /* (1) source */ + UL_SCNsA" " /* (2) target */ + UL_SCNsA" " /* (3) FS type */ + UL_SCNsA" " /* (4) options */ + "%n", /* byte count */ + ++#ifdef HAVE_SCANF_MS_MODIFIER + &src, + &fs->target, + &fstype, + &optstr, ++#else ++ src, ++ fs->target, ++ fstype, ++ optstr, ++#endif + &n); + xrc = rc; + +@@ -144,6 +163,16 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s) + unsigned int maj, min; + char *fstype = NULL, *src = NULL, *p; + ++#ifndef HAVE_SCANF_MS_MODIFIER ++ size_t len = strlen(s) + 1; ++ fs->root = malloc(len); ++ fs->target = malloc(len); ++ fs->vfs_optstr = malloc(len); ++ fs->fs_optstr = malloc(len); ++ fstype = malloc(len); ++ src = malloc(len); ++#endif ++ + rc = sscanf(s, "%d " /* (1) id */ + "%d " /* (2) parent */ + "%u:%u " /* (3) maj:min */ +@@ -155,9 +184,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s) + &fs->id, + &fs->parent, + &maj, &min, ++#ifdef HAVE_SCANF_MS_MODIFIER + &fs->root, + &fs->target, + &fs->vfs_optstr, ++#else ++ fs->root, ++ fs->target, ++ fs->vfs_optstr, ++#endif + &end); + + if (rc >= 7 && end > 0) +@@ -177,9 +212,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s) + UL_SCNsA" " /* (9) source */ + UL_SCNsA, /* (10) fs options (fs specific) */ + ++#ifdef HAVE_SCANF_MS_MODIFIER + &fstype, + &src, + &fs->fs_optstr); ++#else ++ fstype, ++ src, ++ fs->fs_optstr); ++#endif + + if (rc >= 10) { + size_t sz; +@@ -298,14 +339,25 @@ static int mnt_parse_swaps_line(struct libmnt_fs *fs, char *s) + int rc; + char *src = NULL; + ++#ifndef HAVE_SCANF_MS_MODIFIER ++ size_t len = strlen(s) + 1; ++ src = malloc(len); ++ fs->swaptype = malloc(len); ++#endif ++ + rc = sscanf(s, UL_SCNsA" " /* (1) source */ + UL_SCNsA" " /* (2) type */ + "%ju" /* (3) size */ + "%ju" /* (4) used */ + "%d", /* priority */ + ++#ifdef HAVE_SCANF_MS_MODIFIER + &src, + &fs->swaptype, ++#else ++ src, ++ fs->swaptype, ++#endif + &fsz, + &usz, + &fs->priority); +-- +2.7.3 + diff --git a/package/valgrind/0003-mips-replace-addi-with-addiu.patch b/package/valgrind/0003-mips-replace-addi-with-addiu.patch new file mode 100644 index 0000000000..624f6fa39b --- /dev/null +++ b/package/valgrind/0003-mips-replace-addi-with-addiu.patch @@ -0,0 +1,137 @@ +mips: replace addi with addiu + +ADDI instruction has been removed in R6 so let's use ADDIU instead. + +This patch has been sent upstream: + + https://bugs.kde.org/show_bug.cgi?id=356112 + +Signed-off-by: Vicente Olivert Riera + +Index: valgrind/coregrind/m_dispatch/dispatch-mips32-linux.S +=================================================================== +--- valgrind/coregrind/m_dispatch/dispatch-mips32-linux.S (revision 15740) ++++ valgrind/coregrind/m_dispatch/dispatch-mips32-linux.S (working copy) +@@ -196,7 +196,7 @@ + addu $13, $13, $14 + + lw $12, 0($13) /* t3 = VG_(tt_fast)[hash] :: ULong* */ +- addi $13, $13, 4 ++ addiu $13, $13, 4 + lw $25, 0($13) /* little-endian, so comparing 1st 32bit word */ + nop + +Index: valgrind/coregrind/m_dispatch/dispatch-mips64-linux.S +=================================================================== +--- valgrind/coregrind/m_dispatch/dispatch-mips64-linux.S (revision 15740) ++++ valgrind/coregrind/m_dispatch/dispatch-mips64-linux.S (working copy) +@@ -196,7 +196,7 @@ + daddu $13, $13, $14 + + ld $12, 0($13) /* t3 = VG_(tt_fast)[hash] :: ULong* */ +- daddi $13, $13, 8 ++ daddiu $13, $13, 8 + ld $25, 0($13) /* little-endian, so comparing 1st 32bit word */ + nop + +Index: valgrind/coregrind/m_libcsetjmp.c +=================================================================== +--- valgrind/coregrind/m_libcsetjmp.c (revision 15740) ++++ valgrind/coregrind/m_libcsetjmp.c (working copy) +@@ -594,7 +594,7 @@ + /* Checking whether second argument is zero. */ + " bnez $a1, 1f \n\t" + " nop \n\t" +-" addi $a1, $a1, 1 \n\t" /* We must return 1 if val=0. */ ++" addiu $a1, $a1, 1 \n\t" /* We must return 1 if val=0. */ + "1: \n\t" + " move $v0, $a1 \n\t" /* Return value of second argument. */ + " j $ra \n\t" +Index: valgrind/coregrind/m_syswrap/syswrap-mips64-linux.c +=================================================================== +--- valgrind/coregrind/m_syswrap/syswrap-mips64-linux.c (revision 15740) ++++ valgrind/coregrind/m_syswrap/syswrap-mips64-linux.c (working copy) +@@ -173,7 +173,7 @@ + " ld $30, 8($29)\n" + " ld $28, 16($29)\n" + " jr $31\n" +-" daddi $29,$29, 32\n" ++" daddiu $29,$29, 32\n" + ".previous\n" + ); + +Index: valgrind/coregrind/m_trampoline.S +=================================================================== +--- valgrind/coregrind/m_trampoline.S (revision 15740) ++++ valgrind/coregrind/m_trampoline.S (working copy) +@@ -1254,8 +1254,8 @@ + //la $a0, string + j strlen_cond + strlen_loop: +- addi $v0, $v0, 1 +- addi $a0, $a0, 1 ++ addiu $v0, $v0, 1 ++ addiu $a0, $a0, 1 + strlen_cond: + lbu $t0, ($a0) + bne $t0, $zero, strlen_loop +Index: valgrind/helgrind/tests/tc08_hbl2.c +=================================================================== +--- valgrind/helgrind/tests/tc08_hbl2.c (revision 15740) ++++ valgrind/helgrind/tests/tc08_hbl2.c (working copy) +@@ -125,11 +125,11 @@ + # define INC(_lval,_lqual) \ + __asm__ __volatile__ ( \ + "L1xyzzy1" _lqual":\n" \ +- " move $t0, %0\n" \ +- " ll $t1, 0($t0)\n" \ +- " addi $t1, $t1, 1\n" \ +- " sc $t1, 0($t0)\n" \ +- " beqz $t1, L1xyzzy1" _lqual \ ++ " move $t0, %0\n" \ ++ " ll $t1, 0($t0)\n" \ ++ " addiu $t1, $t1, 1\n" \ ++ " sc $t1, 0($t0)\n" \ ++ " beqz $t1, L1xyzzy1" _lqual \ + : /*out*/ : /*in*/ "r"(&(_lval)) \ + : /*trash*/ "t0", "t1", "memory" \ + ) +Index: valgrind/VEX/priv/guest_mips_toIR.c +=================================================================== +--- valgrind/VEX/priv/guest_mips_toIR.c (revision 3206) ++++ valgrind/VEX/priv/guest_mips_toIR.c (working copy) +@@ -16794,6 +16794,7 @@ + mkU64(0x0) : mkU32(0x0)))), imm); + break; + ++#if defined(__mips__) && ((defined(__mips_isa_rev) && __mips_isa_rev < 6)) + case 0x08: { /* ADDI */ + DIP("addi r%u, r%u, %u", rt, rs, imm); + IRTemp tmpRs32 = newTemp(Ity_I32); +@@ -16831,6 +16832,8 @@ + putIReg(rt, mkWidenFrom32(ty, mkexpr(t0), True)); + break; + } ++#endif ++ + case 0x09: /* ADDIU */ + DIP("addiu r%u, r%u, %u", rt, rs, imm); + if (mode64) { +@@ -16888,7 +16891,8 @@ + mkU32(extend_s_16to32(imm))))); + break; + +- case 0x18: { /* Doubleword Add Immidiate - DADD; MIPS64 */ ++#if defined(__mips__) && ((defined(__mips_isa_rev) && __mips_isa_rev < 6)) ++ case 0x18: { /* Doubleword Add Immidiate - DADDI; MIPS64 */ + DIP("daddi r%u, r%u, %u", rt, rs, imm); + IRTemp tmpRs64 = newTemp(Ity_I64); + assign(tmpRs64, getIReg(rs)); +@@ -16926,6 +16930,7 @@ + putIReg(rt, mkexpr(t0)); + break; + } ++#endif + + case 0x19: /* Doubleword Add Immidiate Unsigned - DADDIU; MIPS64 */ + DIP("daddiu r%u, r%u, %u", rt, rs, imm); diff --git a/package/vpnc/0001-Misc.-Makefile-cleanup-and-fix-the-VERSION-definitio.patch b/package/vpnc/0001-Misc.-Makefile-cleanup-and-fix-the-VERSION-definitio.patch new file mode 100644 index 0000000000..cad3e1ad08 --- /dev/null +++ b/package/vpnc/0001-Misc.-Makefile-cleanup-and-fix-the-VERSION-definitio.patch @@ -0,0 +1,59 @@ +From 40b35a82ea581f5dfb1b0b20c4ba3e9f01f35107 Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Mon, 8 Feb 2016 23:02:45 +0100 +Subject: [PATCH] Misc. Makefile cleanup and fix the VERSION definition. + +Signed-off-by: Samuel Martin +Signed-off-by: Thomas Petazzoni +--- + Makefile | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index 9b96d83..62742d0 100644 +--- a/Makefile ++++ b/Makefile +@@ -20,7 +20,7 @@ + # $Id$ + + DESTDIR= +-PREFIX=/usr/local ++PREFIX?=/usr/local + ETCDIR=/etc/vpnc + BINDIR=$(PREFIX)/bin + SBINDIR=$(PREFIX)/sbin +@@ -32,8 +32,6 @@ BINS = vpnc cisco-decrypt + OBJS = $(addsuffix .o,$(basename $(SRCS))) + BINOBJS = $(addsuffix .o,$(BINS)) + BINSRCS = $(addsuffix .c,$(BINS)) +-VERSION := $(shell sh mk-version) +-RELEASE_VERSION := $(shell cat VERSION) + + # The license of vpnc (Gpl >= 2) is quite likely incompatible with the + # openssl license. Openssl is currently used to provide certificate +@@ -50,11 +48,11 @@ RELEASE_VERSION := $(shell cat VERSION) + #OPENSSL_GPL_VIOLATION = -DOPENSSL_GPL_VIOLATION + #OPENSSLLIBS = -lcrypto + +-CC=gcc ++CC ?= gcc + CFLAGS ?= -O3 -g + CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings + CFLAGS += $(shell libgcrypt-config --cflags) +-CPPFLAGS += -DVERSION=\"$(VERSION)\" $(OPENSSL_GPL_VIOLATION) ++CPPFLAGS += $(OPENSSL_GPL_VIOLATION) + LDFLAGS ?= -g + LDFLAGS += $(shell libgcrypt-config --libs) $(OPENSSLLIBS) + +@@ -81,7 +79,7 @@ cisco-decrypt : cisco-decrypt.o decrypt-utils.o + $(CC) -o $@ $^ $(LDFLAGS) + + .depend: $(SRCS) $(BINSRCS) +- $(CC) -MM $(SRCS) $(BINSRCS) $(CFLAGS) $(CPPFLAGS) > $@ ++ $(CC) -MM $(SRCS) $(BINSRCS) $(CPPFLAGS) $(CFLAGS) > $@ + + vpnc-debug.c vpnc-debug.h : isakmp.h enum2debug.pl + LC_ALL=C perl -w ./enum2debug.pl isakmp.h >vpnc-debug.c 2>vpnc-debug.h +-- +2.6.4 + diff --git a/package/vpnc/0002-Don-t-build-manpages.patch b/package/vpnc/0002-Don-t-build-manpages.patch new file mode 100644 index 0000000000..be4414e3fb --- /dev/null +++ b/package/vpnc/0002-Don-t-build-manpages.patch @@ -0,0 +1,31 @@ +From 6bbd03ec8928fd2a3056fc55ee48900fc88d3061 Mon Sep 17 00:00:00 2001 +From: Ulf Samuelsson +Date: Mon, 8 Feb 2016 23:03:48 +0100 +Subject: [PATCH] Don't build manpages + +Patch originally from Ulf Samuelsson . + +Signed-off-by: Thomas Petazzoni +--- + Makefile | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 1ca6459..857bf8d 100644 +--- a/Makefile ++++ b/Makefile +@@ -70,7 +70,10 @@ vpnc : $(OBJS) vpnc.o + $(CC) -o $@ $^ $(LDFLAGS) + + vpnc.8 : vpnc.8.template makeman.pl vpnc +- ./makeman.pl ++ @echo "Cannot make manual when cross compiling" ++ touch $@ ++ ++# ./makeman.pl + + vpnc-script : vpnc-script.in + sed -e 's,@''PREFIX''@,$(PREFIX),g' $< > $@ && chmod 755 $@ +-- +2.6.4 + diff --git a/package/vpnc/0003-Replace-deprecated-SUSv3-functions-with-POSIX-equiva.patch b/package/vpnc/0003-Replace-deprecated-SUSv3-functions-with-POSIX-equiva.patch new file mode 100644 index 0000000000..4b8446ff34 --- /dev/null +++ b/package/vpnc/0003-Replace-deprecated-SUSv3-functions-with-POSIX-equiva.patch @@ -0,0 +1,32 @@ +From ca1a9ad59ae07345720e315b928bb014a8aeea4c Mon Sep 17 00:00:00 2001 +From: Bernhard Reutner-Fischer +Date: Mon, 8 Feb 2016 23:05:23 +0100 +Subject: [PATCH] Replace deprecated SUSv3 functions with POSIX equivalents + +Replace the deprecated SUSv3 function index() by its POSIX equivalent +strchr(). + +Patch originally from Bernhard Reutner-Fischer +. + +Signed-off-by: Thomas Petazzoni +--- + config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config.c b/config.c +index bdd0833..d1750ca 100644 +--- a/config.c ++++ b/config.c +@@ -456,7 +456,7 @@ static char *get_config_filename(const char *name, int add_dot_conf) + { + char *realname; + +- asprintf(&realname, "%s%s%s", index(name, '/') ? "" : "/etc/vpnc/", name, add_dot_conf ? ".conf" : ""); ++ asprintf(&realname, "%s%s%s", strchr(name, '/') ? "" : "/etc/vpnc/", name, add_dot_conf ? ".conf" : ""); + return realname; + } + +-- +2.6.4 + diff --git a/package/webkit/0001-build-fix-for-32-bit-autotools.patch b/package/webkit/0001-build-fix-for-32-bit-autotools.patch new file mode 100644 index 0000000000..d7765ead0e --- /dev/null +++ b/package/webkit/0001-build-fix-for-32-bit-autotools.patch @@ -0,0 +1,34 @@ +Add missing symbol for WebCore::TextIterator::getLocationAndLengthFromRange + +Signed-off-by: Markos Chandras + +From f5bb58f9096061f00c948e668335811d364ba360 Mon Sep 17 00:00:00 2001 +From: "kov@webkit.org" +Date: Thu, 7 Feb 2013 13:48:46 +0000 +Subject: [PATCH] Unreviewed build fix after r141196 for 32 bits autotools. + +* Source/autotools/symbols.filter: restore 32 bits version of the +WebCore::TextIterator::getLocationAndLengthFromRange(WebCore::Node*, +WebCore::Range const*, unsigned int&, unsigned int&) symbol. + +git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142105 268f45cc-cd09-0410-ab3c-d52691b4dbfc +--- + ChangeLog | 8 ++++++++ + Source/autotools/symbols.filter | 1 + + 2 files changed, 9 insertions(+) + +diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter +index 9d730b3..2edefaf 100644 +--- a/Source/autotools/symbols.filter ++++ b/Source/autotools/symbols.filter +@@ -57,6 +57,7 @@ _ZN7WebCore11HistoryItem16setDocumentStateERKN3WTF6VectorINS1_6StringELj0EEE; + _ZN7WebCore11HistoryItem16setDocumentStateERKN3WTF6VectorINS1_6StringELm0EEE; + _ZN7WebCore11MemoryCache14resourceForURLERKNS_4KURLE; + _ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_13ContainerNodeEiib; ++_ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_4NodeEPKNS_5RangeERjS6_; + _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_4NodeEPKNS_5RangeERmS6_; + _ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE; + _ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE; +-- +1.8.3.2 + diff --git a/package/webkit/0002-build-fix-for-gtklauncher.patch b/package/webkit/0002-build-fix-for-gtklauncher.patch new file mode 100644 index 0000000000..9a840b62fe --- /dev/null +++ b/package/webkit/0002-build-fix-for-gtklauncher.patch @@ -0,0 +1,51 @@ +Make gstreamer support conditional + +Signed-off-by: Markos Chandras + +From f1055f61bce46eccf8dc0aa017113a08d3d71944 Mon Sep 17 00:00:00 2001 +From: "commit-queue@webkit.org" + +Date: Fri, 15 Mar 2013 07:13:51 +0000 +Subject: [PATCH] Build fix for Tools/GtkLauncher/Programs_GtkLauncher-main.o + if gstreamer is not installed https://bugs.webkit.org/show_bug.cgi?id=112394 + +Patch by Tobias Mueller on 2013-03-15 +Reviewed by Philippe Normand. + +* GtkLauncher/main.c: +(main): Guard using the gstreamer function with #ifdef WTF_USE_GSTREAMER + +git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145881 268f45cc-cd09-0410-ab3c-d52691b4dbfc +--- + Tools/ChangeLog | 10 ++++++++++ + Tools/GtkLauncher/main.c | 5 ++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/Tools/GtkLauncher/main.c b/Tools/GtkLauncher/main.c +index 32baf4a..84c8833 100644 +--- a/Tools/GtkLauncher/main.c ++++ b/Tools/GtkLauncher/main.c +@@ -28,7 +28,9 @@ + #include "autotoolsconfig.h" + #include "LauncherInspectorWindow.h" + #include ++#ifdef WTF_USE_GSTREAMER + #include ++#endif + #include + #include + #include +@@ -489,8 +491,9 @@ int main(int argc, char* argv[]) + GOptionContext *context = g_option_context_new(0); + g_option_context_add_main_entries(context, commandLineOptions, 0); + g_option_context_add_group(context, gtk_get_option_group(TRUE)); ++#ifdef WTF_USE_GSTREAMER + g_option_context_add_group(context, gst_init_get_option_group()); +- ++#endif + webkitSettings = webkit_web_settings_new(); + g_object_set(webkitSettings, "enable-developer-extras", TRUE, NULL); + if (!addWebSettingsGroupToContext(context, webkitSettings)) { +-- +1.8.3.2 + diff --git a/package/webkit/0003-detect-harfbuzz-icu.patch b/package/webkit/0003-detect-harfbuzz-icu.patch new file mode 100644 index 0000000000..dc93c67e33 --- /dev/null +++ b/package/webkit/0003-detect-harfbuzz-icu.patch @@ -0,0 +1,28 @@ +harfbuzz-icu detections based on the following upstream commits + +- 5f3ae29ffb29c499c1825578ba7f3ffcbf1aa8b9 +- ad2a23ec44b692bde43a13b658990770caa8dfc5 +- 22b4786377142424bfb6562ff029997acd0846d1 + +Signed-off-by: Markos Chandras + +Index: webkit-1.11.5/configure.ac +=================================================================== +--- webkit-1.11.5.orig/configure.ac ++++ webkit-1.11.5/configure.ac +@@ -938,6 +938,15 @@ PKG_CHECK_MODULES([FREETYPE], + freetype2 >= $FREETYPE2_REQUIRED_VERSION + harfbuzz]) + fi ++# HarfBuzz 0.9.18 splits harbuzz-icu into a separate library. ++# Since we support earlier HarfBuzz versions we keep this conditional for now. ++m4_define([harfbuzz_required_version], [0.9.7]) ++if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then ++ PKG_CHECK_MODULES([HARFBUZZ_ICU], [harfbuzz-icu >= $harfbuzz_required_version]) ++ FREETYPE_CFLAGS+=" $HARFBUZZ_ICU_CFLAGS" ++ FREETYPE_LIBS+=" $HARFBUZZ_ICU_LIBS" ++fi ++ + AC_SUBST([FREETYPE_CFLAGS]) + AC_SUBST([FREETYPE_LIBS]) + diff --git a/package/webkit/0004-disable-docrebase.patch b/package/webkit/0004-disable-docrebase.patch new file mode 100644 index 0000000000..2692d617a4 --- /dev/null +++ b/package/webkit/0004-disable-docrebase.patch @@ -0,0 +1,27 @@ +This patch prevents documentation from being rebased or installed. This +prevents an error when gtk-doc --rebase is called. + +Signed-off-by: Spenser Gilliland +Signed-off-by: Markos Chandras + +Index: webkit-1.11.5/Tools/GNUmakefile.am +=================================================================== +--- webkit-1.11.5.orig/Tools/GNUmakefile.am ++++ webkit-1.11.5/Tools/GNUmakefile.am +@@ -308,6 +308,8 @@ EXTRA_DIST += \ + Tools/Scripts/webkit-build-directory \ + Tools/Scripts/webkitdirs.pm + ++if ENABLE_GTK_DOC ++ + docs: docs-build.stamp + .PHONY : docs + DISTCLEANFILES += docs-build.stamp +@@ -412,7 +414,6 @@ if ENABLE_WEBKIT2 + rm -rf $${installdir} + endif + +-if ENABLE_GTK_DOC + all: docs-build.stamp + endif + diff --git a/package/webkit/0005-disable-tests.patch b/package/webkit/0005-disable-tests.patch new file mode 100644 index 0000000000..6fa6daae6b --- /dev/null +++ b/package/webkit/0005-disable-tests.patch @@ -0,0 +1,80 @@ +This prevents the Webkit test suites from being built. + +Signed-off-by: Spenser Gilliland +---- +Index: webkit-1.9.6/GNUmakefile.am +=================================================================== +--- webkit-1.9.6.orig/GNUmakefile.am 2012-08-06 03:17:24.000000000 -0500 ++++ webkit-1.9.6/GNUmakefile.am 2013-05-28 10:08:53.645129501 -0500 +@@ -282,11 +282,14 @@ + include Tools/DumpRenderTree/gtk/GNUmakefile.ImageDiff.am + + include Source/WebKit2/GNUmakefile.am +-include Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am + include Tools/MiniBrowser/gtk/GNUmakefile.am ++ ++if ENABLE_TESTS ++include Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am + include Tools/WebKitTestRunner/GNUmakefile.am + include Source/ThirdParty/gtest/GNUmakefile.am + include Tools/TestWebKitAPI/GNUmakefile.am ++endif # ENABLE_TESTS + # [GTK] Refactor the translations now that we have webkit2 + # https://bugs.webkit.org/show_bug.cgi?id=55153 + +Index: webkit-1.9.6/Source/WebKit/gtk/GNUmakefile.am +=================================================================== +--- webkit-1.9.6.orig/Source/WebKit/gtk/GNUmakefile.am 2012-07-19 05:02:29.000000000 -0500 ++++ webkit-1.9.6/Source/WebKit/gtk/GNUmakefile.am 2013-05-28 10:09:49.277130516 -0500 +@@ -413,6 +413,7 @@ + dist_resources_DATA = \ + $(shell ls $(srcdir)/Source/WebKit/gtk/resources/*.html) + ++if ENABLE_TESTS + # Build unit tests + webkit_tests_cflags = \ + -fno-strict-aliasing \ +@@ -613,6 +614,8 @@ + Programs_unittests_testcopyandpaste_LDADD = $(webkit_tests_ldadd) + Programs_unittests_testcopyandpaste_LDFLAGS = $(webkit_tests_ldflags) + ++endif # ENABLE_TESTS ++ + # Project-wide clean rules + # Files that will be cleaned + CLEANFILES += \ +Index: webkit-1.9.6/configure.ac +=================================================================== +--- webkit-1.9.6.orig/configure.ac 2012-08-06 08:45:10.000000000 -0500 ++++ webkit-1.9.6/configure.ac 2013-05-28 10:07:55.817128445 -0500 +@@ -516,6 +516,14 @@ + AC_SUBST(CAIRO_CFLAGS) + AC_SUBST(CAIRO_LIBS) + ++# check wheter to build tests ++AC_MSG_CHECKING([wheter to build tests]) ++AC_ARG_ENABLE(tests, ++ AC_HELP_STRING([--enable-tests], ++ [turn on tests [default=no]]), ++ [],[enable_debug="no"]) ++AC_MSG_RESULT([$enable_tests]) ++ + # check whether to build with debugging enabled + AC_MSG_CHECKING([whether to do a debug build]) + AC_ARG_ENABLE(debug, +@@ -1423,6 +1431,7 @@ + AM_CONDITIONAL([USE_FARSTREAM], [test "$have_farstream" = "yes"]) + + # WebKit feature conditionals ++AM_CONDITIONAL([ENABLE_TESTS],[test "$enable_tests" = "yes"]) + AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug_features" = "yes"]) + AM_CONDITIONAL([ENABLE_UNSTABLE_FEATURES],[test "$enable_unstable_features" = "yes"]) + AM_CONDITIONAL([ENABLE_WEBGL],[test "$enable_webgl" = "yes"]) +@@ -1534,6 +1543,7 @@ + WebKit was configured with the following options: + + Build configuration: ++ Enable tests (slow) : $enable_tests + Enable debugging (slow) : $enable_debug + Compile with debug symbols (slow) : $enable_debug_symbols + Enable debug features (slow) : $enable_debug_features diff --git a/package/webkit/0006-execinfo_h.patch b/package/webkit/0006-execinfo_h.patch new file mode 100644 index 0000000000..f5508a1cb1 --- /dev/null +++ b/package/webkit/0006-execinfo_h.patch @@ -0,0 +1,20 @@ +Fixes uclibc build as uclibc does not include backtrace functionality + +Signed-of-by: Spenser Gilliland +Signed-of-by: Markos Chandras + +Index: webkit-1.11.5/Source/WTF/wtf/Assertions.cpp +=================================================================== +--- webkit-1.11.5.orig/Source/WTF/wtf/Assertions.cpp ++++ webkit-1.11.5/Source/WTF/wtf/Assertions.cpp +@@ -61,8 +61,10 @@ + #if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID) + #include + #include ++#if !defined(__UCLIBC__) + #include + #endif ++#endif + + #if OS(ANDROID) + #include "android/log.h" diff --git a/package/webkit/0007-mips-dfg.patch b/package/webkit/0007-mips-dfg.patch new file mode 100644 index 0000000000..39259514b9 --- /dev/null +++ b/package/webkit/0007-mips-dfg.patch @@ -0,0 +1,1490 @@ +Upstream patch for DFG implementation for MIPS + +Signed-off-by: Markos Chandras + +From c921d19863ccf66bdd0ffa5d38eaf05efab6b136 Mon Sep 17 00:00:00 2001 +From: "commit-queue@webkit.org" + +Date: Mon, 18 Feb 2013 19:25:23 +0000 +Subject: [PATCH] MIPS DFG implementation. + https://bugs.webkit.org/show_bug.cgi?id=101328 + +Patch by Balazs Kilvady on 2013-02-18 +Reviewed by Oliver Hunt. + +DFG implementation for MIPS. + +Source/JavaScriptCore: + +* assembler/MIPSAssembler.h: +(JSC::MIPSAssembler::MIPSAssembler): +(JSC::MIPSAssembler::sllv): +(JSC::MIPSAssembler::movd): +(MIPSAssembler): +(JSC::MIPSAssembler::negd): +(JSC::MIPSAssembler::labelForWatchpoint): +(JSC::MIPSAssembler::label): +(JSC::MIPSAssembler::vmov): +(JSC::MIPSAssembler::linkDirectJump): +(JSC::MIPSAssembler::maxJumpReplacementSize): +(JSC::MIPSAssembler::revertJumpToMove): +(JSC::MIPSAssembler::replaceWithJump): +* assembler/MacroAssembler.h: +(MacroAssembler): +(JSC::MacroAssembler::poke): +* assembler/MacroAssemblerMIPS.h: +(JSC::MacroAssemblerMIPS::add32): +(MacroAssemblerMIPS): +(JSC::MacroAssemblerMIPS::and32): +(JSC::MacroAssemblerMIPS::lshift32): +(JSC::MacroAssemblerMIPS::mul32): +(JSC::MacroAssemblerMIPS::or32): +(JSC::MacroAssemblerMIPS::rshift32): +(JSC::MacroAssemblerMIPS::urshift32): +(JSC::MacroAssemblerMIPS::sub32): +(JSC::MacroAssemblerMIPS::xor32): +(JSC::MacroAssemblerMIPS::store32): +(JSC::MacroAssemblerMIPS::jump): +(JSC::MacroAssemblerMIPS::branchAdd32): +(JSC::MacroAssemblerMIPS::branchMul32): +(JSC::MacroAssemblerMIPS::branchSub32): +(JSC::MacroAssemblerMIPS::branchNeg32): +(JSC::MacroAssemblerMIPS::call): +(JSC::MacroAssemblerMIPS::loadDouble): +(JSC::MacroAssemblerMIPS::moveDouble): +(JSC::MacroAssemblerMIPS::swapDouble): +(JSC::MacroAssemblerMIPS::subDouble): +(JSC::MacroAssemblerMIPS::mulDouble): +(JSC::MacroAssemblerMIPS::divDouble): +(JSC::MacroAssemblerMIPS::negateDouble): +(JSC::MacroAssemblerMIPS::branchEqual): +(JSC::MacroAssemblerMIPS::branchNotEqual): +(JSC::MacroAssemblerMIPS::branchTruncateDoubleToInt32): +(JSC::MacroAssemblerMIPS::branchTruncateDoubleToUint32): +(JSC::MacroAssemblerMIPS::truncateDoubleToInt32): +(JSC::MacroAssemblerMIPS::truncateDoubleToUint32): +(JSC::MacroAssemblerMIPS::branchDoubleNonZero): +(JSC::MacroAssemblerMIPS::branchDoubleZeroOrNaN): +(JSC::MacroAssemblerMIPS::invert): +(JSC::MacroAssemblerMIPS::replaceWithJump): +(JSC::MacroAssemblerMIPS::maxJumpReplacementSize): +* dfg/DFGAssemblyHelpers.h: +(AssemblyHelpers): +(JSC::DFG::AssemblyHelpers::preserveReturnAddressAfterCall): +(JSC::DFG::AssemblyHelpers::restoreReturnAddressBeforeReturn): +(JSC::DFG::AssemblyHelpers::debugCall): +* dfg/DFGCCallHelpers.h: +(CCallHelpers): +(JSC::DFG::CCallHelpers::setupArguments): +(JSC::DFG::CCallHelpers::setupArgumentsWithExecState): +* dfg/DFGFPRInfo.h: +(DFG): +(FPRInfo): +(JSC::DFG::FPRInfo::toRegister): +(JSC::DFG::FPRInfo::toIndex): +(JSC::DFG::FPRInfo::debugName): +* dfg/DFGGPRInfo.h: +(DFG): +(GPRInfo): +(JSC::DFG::GPRInfo::toRegister): +(JSC::DFG::GPRInfo::toIndex): +(JSC::DFG::GPRInfo::debugName): +* dfg/DFGSpeculativeJIT.h: +(SpeculativeJIT): +* jit/JSInterfaceJIT.h: +(JSInterfaceJIT): +* runtime/JSGlobalData.h: +(JSC::ScratchBuffer::allocationSize): +(ScratchBuffer): + +Source/WTF: + +* wtf/Platform.h: + +git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143247 268f45cc-cd09-0410-ab3c-d52691b4dbfc +--- + Source/JavaScriptCore/ChangeLog | 90 ++++ + Source/JavaScriptCore/assembler/MIPSAssembler.h | 109 ++++- + Source/JavaScriptCore/assembler/MacroAssembler.h | 7 + + .../JavaScriptCore/assembler/MacroAssemblerMIPS.h | 480 +++++++++++++++++++-- + Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h | 19 +- + Source/JavaScriptCore/dfg/DFGCCallHelpers.h | 92 ++-- + Source/JavaScriptCore/dfg/DFGFPRInfo.h | 68 +++ + Source/JavaScriptCore/dfg/DFGGPRInfo.h | 67 +++ + Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h | 4 +- + Source/JavaScriptCore/jit/JSInterfaceJIT.h | 4 + + Source/JavaScriptCore/runtime/JSGlobalData.h | 6 +- + Source/WTF/ChangeLog | 11 + + Source/WTF/wtf/Platform.h | 4 + + 13 files changed, 888 insertions(+), 73 deletions(-) + +diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h +index 026f87e..7f553bb 100644 +--- a/Source/JavaScriptCore/assembler/MIPSAssembler.h ++++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h +@@ -152,6 +152,8 @@ public: + typedef SegmentedVector Jumps; + + MIPSAssembler() ++ : m_indexOfLastWatchpoint(INT_MIN) ++ , m_indexOfTailOfLastWatchpoint(INT_MIN) + { + } + +@@ -325,7 +327,7 @@ public: + emitInst(0x00000000 | (rd << OP_SH_RD) | (rt << OP_SH_RT) | ((shamt & 0x1f) << OP_SH_SHAMT)); + } + +- void sllv(RegisterID rd, RegisterID rt, int rs) ++ void sllv(RegisterID rd, RegisterID rt, RegisterID rs) + { + emitInst(0x00000004 | (rd << OP_SH_RD) | (rt << OP_SH_RT) | (rs << OP_SH_RS)); + } +@@ -527,6 +529,16 @@ public: + emitInst(0x46200004 | (fd << OP_SH_FD) | (fs << OP_SH_FS)); + } + ++ void movd(FPRegisterID fd, FPRegisterID fs) ++ { ++ emitInst(0x46200006 | (fd << OP_SH_FD) | (fs << OP_SH_FS)); ++ } ++ ++ void negd(FPRegisterID fd, FPRegisterID fs) ++ { ++ emitInst(0x46200007 | (fd << OP_SH_FD) | (fs << OP_SH_FS)); ++ } ++ + void truncwd(FPRegisterID fd, FPRegisterID fs) + { + emitInst(0x4620000d | (fd << OP_SH_FD) | (fs << OP_SH_FS)); +@@ -619,9 +631,24 @@ public: + return m_buffer.label(); + } + ++ AssemblerLabel labelForWatchpoint() ++ { ++ AssemblerLabel result = m_buffer.label(); ++ if (static_cast(result.m_offset) != m_indexOfLastWatchpoint) ++ result = label(); ++ m_indexOfLastWatchpoint = result.m_offset; ++ m_indexOfTailOfLastWatchpoint = result.m_offset + maxJumpReplacementSize(); ++ return result; ++ } ++ + AssemblerLabel label() + { +- return m_buffer.label(); ++ AssemblerLabel result = m_buffer.label(); ++ while (UNLIKELY(static_cast(result.m_offset) < m_indexOfTailOfLastWatchpoint)) { ++ nop(); ++ result = m_buffer.label(); ++ } ++ return result; + } + + AssemblerLabel align(int alignment) +@@ -664,14 +691,24 @@ public: + // Assembly helpers for moving data between fp and registers. + void vmov(RegisterID rd1, RegisterID rd2, FPRegisterID rn) + { ++#if WTF_MIPS_ISA_REV(2) && WTF_MIPS_FP64 ++ mfc1(rd1, rn); ++ mfhc1(rd2, rn); ++#else + mfc1(rd1, rn); + mfc1(rd2, FPRegisterID(rn + 1)); ++#endif + } + + void vmov(FPRegisterID rd, RegisterID rn1, RegisterID rn2) + { ++#if WTF_MIPS_ISA_REV(2) && WTF_MIPS_FP64 ++ mtc1(rn1, rd); ++ mthc1(rn2, rd); ++#else + mtc1(rn1, rd); + mtc1(rn2, FPRegisterID(rd + 1)); ++#endif + } + + static unsigned getCallReturnOffset(AssemblerLabel call) +@@ -688,6 +725,35 @@ public: + // writable region of memory; to modify the code in an execute-only execuable + // pool the 'repatch' and 'relink' methods should be used. + ++ static size_t linkDirectJump(void* code, void* to) ++ { ++ MIPSWord* insn = reinterpret_cast(reinterpret_cast(code)); ++ size_t ops = 0; ++ int32_t slotAddr = reinterpret_cast(insn) + 4; ++ int32_t toAddr = reinterpret_cast(to); ++ ++ if ((slotAddr & 0xf0000000) != (toAddr & 0xf0000000)) { ++ // lui ++ *insn = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((toAddr >> 16) & 0xffff); ++ ++insn; ++ // ori ++ *insn = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (toAddr & 0xffff); ++ ++insn; ++ // jr ++ *insn = 0x00000008 | (MIPSRegisters::t9 << OP_SH_RS); ++ ++insn; ++ ops = 4 * sizeof(MIPSWord); ++ } else { ++ // j ++ *insn = 0x08000000 | ((toAddr & 0x0fffffff) >> 2); ++ ++insn; ++ ops = 2 * sizeof(MIPSWord); ++ } ++ // nop ++ *insn = 0x00000000; ++ return ops; ++ } ++ + void linkJump(AssemblerLabel from, AssemblerLabel to) + { + ASSERT(to.isSet()); +@@ -825,29 +891,36 @@ public: + #endif + } + +- static void revertJumpToMove(void* instructionStart, RegisterID rt, int imm) ++ static ptrdiff_t maxJumpReplacementSize() + { +- MIPSWord* insn = static_cast(instructionStart) + 1; +- ASSERT((*insn & 0xfc000000) == 0x34000000); +- *insn = (*insn & 0xfc1f0000) | (imm & 0xffff); +- cacheFlush(insn, sizeof(MIPSWord)); ++ return sizeof(MIPSWord) * 4; + } + +- static void replaceWithJump(void* instructionStart, void* to) ++ static void revertJumpToMove(void* instructionStart, RegisterID rt, int imm) + { +- MIPSWord* instruction = reinterpret_cast(instructionStart); +- intptr_t jumpTo = reinterpret_cast(to); ++ MIPSWord* insn = static_cast(instructionStart); ++ size_t codeSize = 2 * sizeof(MIPSWord); + + // lui +- instruction[0] = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((jumpTo >> 16) & 0xffff); ++ *insn = 0x3c000000 | (rt << OP_SH_RT) | ((imm >> 16) & 0xffff); ++ ++insn; + // ori +- instruction[1] = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (jumpTo & 0xffff); +- // jr +- instruction[2] = 0x00000008 | (MIPSRegisters::t9 << OP_SH_RS); +- // nop +- instruction[3] = 0x0; ++ *insn = 0x34000000 | (rt << OP_SH_RS) | (rt << OP_SH_RT) | (imm & 0xffff); ++ ++insn; ++ // if jr $t9 ++ if (*insn == 0x03200008) { ++ *insn = 0x00000000; ++ codeSize += sizeof(MIPSWord); ++ } ++ cacheFlush(insn, codeSize); ++ } + +- cacheFlush(instruction, sizeof(MIPSWord) * 4); ++ static void replaceWithJump(void* instructionStart, void* to) ++ { ++ ASSERT(!(bitwise_cast(instructionStart) & 3)); ++ ASSERT(!(bitwise_cast(to) & 3)); ++ size_t ops = linkDirectJump(instructionStart, to); ++ cacheFlush(instructionStart, ops); + } + + static void replaceWithLoad(void* instructionStart) +@@ -1023,6 +1096,8 @@ private: + + AssemblerBuffer m_buffer; + Jumps m_jumps; ++ int m_indexOfLastWatchpoint; ++ int m_indexOfTailOfLastWatchpoint; + }; + + } // namespace JSC +diff --git a/Source/JavaScriptCore/assembler/MacroAssembler.h b/Source/JavaScriptCore/assembler/MacroAssembler.h +index 60a93db..1f0c3de 100644 +--- a/Source/JavaScriptCore/assembler/MacroAssembler.h ++++ b/Source/JavaScriptCore/assembler/MacroAssembler.h +@@ -200,6 +200,13 @@ public: + } + #endif + ++#if CPU(MIPS) ++ void poke(FPRegisterID src, int index = 0) ++ { ++ ASSERT(!(index & 1)); ++ storeDouble(src, addressForPoke(index)); ++ } ++#endif + + // Backwards banches, these are currently all implemented using existing forwards branch mechanisms. + void branchPtr(RelationalCondition cond, RegisterID op1, TrustedImmPtr imm, Label target) +diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h +index 43ad434..4f14960 100644 +--- a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h ++++ b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h +@@ -114,6 +114,11 @@ public: + m_assembler.addu(dest, dest, src); + } + ++ void add32(RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ m_assembler.addu(dest, op1, op2); ++ } ++ + void add32(TrustedImm32 imm, RegisterID dest) + { + add32(imm, dest, dest); +@@ -267,6 +272,11 @@ public: + m_assembler.andInsn(dest, dest, src); + } + ++ void and32(RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ m_assembler.andInsn(dest, op1, op2); ++ } ++ + void and32(TrustedImm32 imm, RegisterID dest) + { + if (!imm.m_value && !m_fixedWidth) +@@ -283,9 +293,16 @@ public: + } + } + +- void lshift32(TrustedImm32 imm, RegisterID dest) ++ void and32(TrustedImm32 imm, RegisterID src, RegisterID dest) + { +- m_assembler.sll(dest, dest, imm.m_value); ++ if (!imm.m_value && !m_fixedWidth) ++ move(MIPSRegisters::zero, dest); ++ else if (imm.m_value > 0 && imm.m_value < 65535 && !m_fixedWidth) ++ m_assembler.andi(dest, src, imm.m_value); ++ else { ++ move(imm, immTempRegister); ++ m_assembler.andInsn(dest, src, immTempRegister); ++ } + } + + void lshift32(RegisterID shiftAmount, RegisterID dest) +@@ -293,11 +310,33 @@ public: + m_assembler.sllv(dest, dest, shiftAmount); + } + ++ void lshift32(RegisterID src, RegisterID shiftAmount, RegisterID dest) ++ { ++ m_assembler.sllv(dest, src, shiftAmount); ++ } ++ ++ void lshift32(TrustedImm32 imm, RegisterID dest) ++ { ++ move(imm, immTempRegister); ++ m_assembler.sllv(dest, dest, immTempRegister); ++ } ++ ++ void lshift32(RegisterID src, TrustedImm32 imm, RegisterID dest) ++ { ++ move(imm, immTempRegister); ++ m_assembler.sllv(dest, src, immTempRegister); ++ } ++ + void mul32(RegisterID src, RegisterID dest) + { + m_assembler.mul(dest, dest, src); + } + ++ void mul32(RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ m_assembler.mul(dest, op1, op2); ++ } ++ + void mul32(TrustedImm32 imm, RegisterID src, RegisterID dest) + { + if (!imm.m_value && !m_fixedWidth) +@@ -348,6 +387,24 @@ public: + m_assembler.orInsn(dest, dest, dataTempRegister); + } + ++ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) ++ { ++ if (!imm.m_value && !m_fixedWidth) ++ return; ++ ++ if (imm.m_value > 0 && imm.m_value < 65535 && !m_fixedWidth) { ++ m_assembler.ori(dest, src, imm.m_value); ++ return; ++ } ++ ++ /* ++ li dataTemp, imm ++ or dest, src, dataTemp ++ */ ++ move(imm, dataTempRegister); ++ m_assembler.orInsn(dest, src, dataTempRegister); ++ } ++ + void or32(RegisterID src, AbsoluteAddress dest) + { + load32(dest.m_ptr, dataTempRegister); +@@ -360,6 +417,11 @@ public: + m_assembler.srav(dest, dest, shiftAmount); + } + ++ void rshift32(RegisterID src, RegisterID shiftAmount, RegisterID dest) ++ { ++ m_assembler.srav(dest, src, shiftAmount); ++ } ++ + void rshift32(TrustedImm32 imm, RegisterID dest) + { + m_assembler.sra(dest, dest, imm.m_value); +@@ -375,16 +437,31 @@ public: + m_assembler.srlv(dest, dest, shiftAmount); + } + ++ void urshift32(RegisterID src, RegisterID shiftAmount, RegisterID dest) ++ { ++ m_assembler.srlv(dest, src, shiftAmount); ++ } ++ + void urshift32(TrustedImm32 imm, RegisterID dest) + { + m_assembler.srl(dest, dest, imm.m_value); + } + ++ void urshift32(RegisterID src, TrustedImm32 imm, RegisterID dest) ++ { ++ m_assembler.srl(dest, src, imm.m_value); ++ } ++ + void sub32(RegisterID src, RegisterID dest) + { + m_assembler.subu(dest, dest, src); + } + ++ void sub32(RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ m_assembler.subu(dest, op1, op2); ++ } ++ + void sub32(TrustedImm32 imm, RegisterID dest) + { + if (imm.m_value >= -32767 && imm.m_value <= 32768 +@@ -495,6 +572,11 @@ public: + m_assembler.xorInsn(dest, dest, src); + } + ++ void xor32(RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ m_assembler.xorInsn(dest, op1, op2); ++ } ++ + void xor32(TrustedImm32 imm, RegisterID dest) + { + if (imm.m_value == -1) { +@@ -510,6 +592,21 @@ public: + m_assembler.xorInsn(dest, dest, immTempRegister); + } + ++ void xor32(TrustedImm32 imm, RegisterID src, RegisterID dest) ++ { ++ if (imm.m_value == -1) { ++ m_assembler.nor(dest, src, MIPSRegisters::zero); ++ return; ++ } ++ ++ /* ++ li immTemp, imm ++ xor dest, dest, immTemp ++ */ ++ move(imm, immTempRegister); ++ m_assembler.xorInsn(dest, src, immTempRegister); ++ } ++ + void sqrtDouble(FPRegisterID src, FPRegisterID dst) + { + m_assembler.sqrtd(dst, src); +@@ -989,6 +1086,44 @@ public: + } + } + ++ void store32(TrustedImm32 imm, BaseIndex address) ++ { ++ if (address.offset >= -32768 && address.offset <= 32767 && !m_fixedWidth) { ++ /* ++ sll addrTemp, address.index, address.scale ++ addu addrTemp, addrTemp, address.base ++ sw src, address.offset(addrTemp) ++ */ ++ m_assembler.sll(addrTempRegister, address.index, address.scale); ++ m_assembler.addu(addrTempRegister, addrTempRegister, address.base); ++ if (!imm.m_value) ++ m_assembler.sw(MIPSRegisters::zero, addrTempRegister, address.offset); ++ else { ++ move(imm, immTempRegister); ++ m_assembler.sw(immTempRegister, addrTempRegister, address.offset); ++ } ++ } else { ++ /* ++ sll addrTemp, address.index, address.scale ++ addu addrTemp, addrTemp, address.base ++ lui immTemp, (address.offset + 0x8000) >> 16 ++ addu addrTemp, addrTemp, immTemp ++ sw src, (address.offset & 0xffff)(at) ++ */ ++ m_assembler.sll(addrTempRegister, address.index, address.scale); ++ m_assembler.addu(addrTempRegister, addrTempRegister, address.base); ++ m_assembler.lui(immTempRegister, (address.offset + 0x8000) >> 16); ++ m_assembler.addu(addrTempRegister, addrTempRegister, immTempRegister); ++ if (!imm.m_value && !m_fixedWidth) ++ m_assembler.sw(MIPSRegisters::zero, addrTempRegister, address.offset); ++ else { ++ move(imm, immTempRegister); ++ m_assembler.sw(immTempRegister, addrTempRegister, address.offset); ++ } ++ } ++ } ++ ++ + void store32(RegisterID src, const void* address) + { + /* +@@ -1336,6 +1471,15 @@ public: + m_fixedWidth = false; + } + ++ void jump(AbsoluteAddress address) ++ { ++ m_fixedWidth = true; ++ load32(address.m_ptr, MIPSRegisters::t9); ++ m_assembler.jr(MIPSRegisters::t9); ++ m_assembler.nop(); ++ m_fixedWidth = false; ++ } ++ + void moveDoubleToInts(FPRegisterID src, RegisterID dest1, RegisterID dest2) + { + m_assembler.vmov(dest1, dest2, src); +@@ -1404,6 +1548,53 @@ public: + return Jump(); + } + ++ Jump branchAdd32(ResultCondition cond, RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); ++ if (cond == Overflow) { ++ /* ++ move dataTemp, op1 ++ xor cmpTemp, dataTemp, op2 ++ bltz cmpTemp, No_overflow # diff sign bit -> no overflow ++ addu dest, dataTemp, op2 ++ xor cmpTemp, dest, dataTemp ++ bgez cmpTemp, No_overflow # same sign big -> no overflow ++ nop ++ b Overflow ++ nop ++ nop ++ nop ++ nop ++ nop ++ No_overflow: ++ */ ++ move(op1, dataTempRegister); ++ m_assembler.xorInsn(cmpTempRegister, dataTempRegister, op2); ++ m_assembler.bltz(cmpTempRegister, 10); ++ m_assembler.addu(dest, dataTempRegister, op2); ++ m_assembler.xorInsn(cmpTempRegister, dest, dataTempRegister); ++ m_assembler.bgez(cmpTempRegister, 7); ++ m_assembler.nop(); ++ return jump(); ++ } ++ if (cond == Signed) { ++ add32(op1, op2, dest); ++ // Check if dest is negative. ++ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero); ++ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero); ++ } ++ if (cond == Zero) { ++ add32(op1, op2, dest); ++ return branchEqual(dest, MIPSRegisters::zero); ++ } ++ if (cond == NonZero) { ++ add32(op1, op2, dest); ++ return branchNotEqual(dest, MIPSRegisters::zero); ++ } ++ ASSERT(0); ++ return Jump(); ++ } ++ + Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, RegisterID dest) + { + move(imm, immTempRegister); +@@ -1417,6 +1608,111 @@ public: + return branchAdd32(cond, immTempRegister, dest); + } + ++ Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, AbsoluteAddress dest) ++ { ++ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); ++ if (cond == Overflow) { ++ /* ++ move dataTemp, dest ++ xori cmpTemp, dataTemp, imm ++ bltz cmpTemp, No_overflow # diff sign bit -> no overflow ++ addiu dataTemp, dataTemp, imm ++ move dest, dataTemp ++ xori cmpTemp, dataTemp, imm ++ bgez cmpTemp, No_overflow # same sign big -> no overflow ++ nop ++ b Overflow ++ nop ++ nop ++ nop ++ nop ++ nop ++ No_overflow: ++ */ ++ if (imm.m_value >= -32768 && imm.m_value <= 32767 && !m_fixedWidth) { ++ load32(dest.m_ptr, dataTempRegister); ++ m_assembler.xori(cmpTempRegister, dataTempRegister, imm.m_value); ++ m_assembler.bltz(cmpTempRegister, 10); ++ m_assembler.addiu(dataTempRegister, dataTempRegister, imm.m_value); ++ store32(dataTempRegister, dest.m_ptr); ++ m_assembler.xori(cmpTempRegister, dataTempRegister, imm.m_value); ++ m_assembler.bgez(cmpTempRegister, 7); ++ m_assembler.nop(); ++ } else { ++ load32(dest.m_ptr, dataTempRegister); ++ move(imm, immTempRegister); ++ m_assembler.xorInsn(cmpTempRegister, dataTempRegister, immTempRegister); ++ m_assembler.bltz(cmpTempRegister, 10); ++ m_assembler.addiu(dataTempRegister, dataTempRegister, immTempRegister); ++ store32(dataTempRegister, dest.m_ptr); ++ m_assembler.xori(cmpTempRegister, dataTempRegister, immTempRegister); ++ m_assembler.bgez(cmpTempRegister, 7); ++ m_assembler.nop(); ++ } ++ return jump(); ++ } ++ move(imm, immTempRegister); ++ load32(dest.m_ptr, dataTempRegister); ++ add32(immTempRegister, dataTempRegister); ++ store32(dataTempRegister, dest.m_ptr); ++ if (cond == Signed) { ++ // Check if dest is negative. ++ m_assembler.slt(cmpTempRegister, dataTempRegister, MIPSRegisters::zero); ++ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero); ++ } ++ if (cond == Zero) ++ return branchEqual(dataTempRegister, MIPSRegisters::zero); ++ if (cond == NonZero) ++ return branchNotEqual(dataTempRegister, MIPSRegisters::zero); ++ ASSERT(0); ++ return Jump(); ++ } ++ ++ Jump branchMul32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) ++ { ++ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); ++ if (cond == Overflow) { ++ /* ++ mult src, dest ++ mfhi dataTemp ++ mflo dest ++ sra addrTemp, dest, 31 ++ beq dataTemp, addrTemp, No_overflow # all sign bits (bit 63 to bit 31) are the same -> no overflow ++ nop ++ b Overflow ++ nop ++ nop ++ nop ++ nop ++ nop ++ No_overflow: ++ */ ++ m_assembler.mult(src1, src2); ++ m_assembler.mfhi(dataTempRegister); ++ m_assembler.mflo(dest); ++ m_assembler.sra(addrTempRegister, dest, 31); ++ m_assembler.beq(dataTempRegister, addrTempRegister, 7); ++ m_assembler.nop(); ++ return jump(); ++ } ++ if (cond == Signed) { ++ mul32(src1, src2, dest); ++ // Check if dest is negative. ++ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero); ++ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero); ++ } ++ if (cond == Zero) { ++ mul32(src1, src2, dest); ++ return branchEqual(dest, MIPSRegisters::zero); ++ } ++ if (cond == NonZero) { ++ mul32(src1, src2, dest); ++ return branchNotEqual(dest, MIPSRegisters::zero); ++ } ++ ASSERT(0); ++ return Jump(); ++ } ++ + Jump branchMul32(ResultCondition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); +@@ -1465,8 +1761,7 @@ public: + Jump branchMul32(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest) + { + move(imm, immTempRegister); +- move(src, dest); +- return branchMul32(cond, immTempRegister, dest); ++ return branchMul32(cond, immTempRegister, src, dest); + } + + Jump branchSub32(ResultCondition cond, RegisterID src, RegisterID dest) +@@ -1525,8 +1820,60 @@ public: + Jump branchSub32(ResultCondition cond, RegisterID src, TrustedImm32 imm, RegisterID dest) + { + move(imm, immTempRegister); +- move(src, dest); +- return branchSub32(cond, immTempRegister, dest); ++ return branchSub32(cond, src, immTempRegister, dest); ++ } ++ ++ Jump branchSub32(ResultCondition cond, RegisterID op1, RegisterID op2, RegisterID dest) ++ { ++ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); ++ if (cond == Overflow) { ++ /* ++ move dataTemp, op1 ++ xor cmpTemp, dataTemp, op2 ++ bgez cmpTemp, No_overflow # same sign bit -> no overflow ++ subu dest, dataTemp, op2 ++ xor cmpTemp, dest, dataTemp ++ bgez cmpTemp, No_overflow # same sign bit -> no overflow ++ nop ++ b Overflow ++ nop ++ nop ++ nop ++ nop ++ nop ++ No_overflow: ++ */ ++ move(op1, dataTempRegister); ++ m_assembler.xorInsn(cmpTempRegister, dataTempRegister, op2); ++ m_assembler.bgez(cmpTempRegister, 10); ++ m_assembler.subu(dest, dataTempRegister, op2); ++ m_assembler.xorInsn(cmpTempRegister, dest, dataTempRegister); ++ m_assembler.bgez(cmpTempRegister, 7); ++ m_assembler.nop(); ++ return jump(); ++ } ++ if (cond == Signed) { ++ sub32(op1, op2, dest); ++ // Check if dest is negative. ++ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero); ++ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero); ++ } ++ if (cond == Zero) { ++ sub32(op1, op2, dest); ++ return branchEqual(dest, MIPSRegisters::zero); ++ } ++ if (cond == NonZero) { ++ sub32(op1, op2, dest); ++ return branchNotEqual(dest, MIPSRegisters::zero); ++ } ++ ASSERT(0); ++ return Jump(); ++ } ++ ++ Jump branchNeg32(ResultCondition cond, RegisterID srcDest) ++ { ++ m_assembler.li(dataTempRegister, -1); ++ return branchMul32(cond, dataTempRegister, srcDest); + } + + Jump branchOr32(ResultCondition cond, RegisterID src, RegisterID dest) +@@ -1578,7 +1925,8 @@ public: + + Call call(RegisterID target) + { +- m_assembler.jalr(target); ++ move(target, MIPSRegisters::t9); ++ m_assembler.jalr(MIPSRegisters::t9); + m_assembler.nop(); + return Call(m_assembler.label(), Call::None); + } +@@ -1822,7 +2170,7 @@ public: + lui immTemp, (address.offset + 0x8000) >> 16 + addu addrTemp, addrTemp, immTemp + lwc1 dest, (address.offset & 0xffff)(at) +- lwc1 dest+4, (address.offset & 0xffff + 4)(at) ++ lwc1 dest+1, (address.offset & 0xffff + 4)(at) + */ + m_assembler.sll(addrTempRegister, address.index, address.scale); + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); +@@ -2009,6 +2357,19 @@ public: + #endif + } + ++ void moveDouble(FPRegisterID src, FPRegisterID dest) ++ { ++ if (src != dest || m_fixedWidth) ++ m_assembler.movd(dest, src); ++ } ++ ++ void swapDouble(FPRegisterID fr1, FPRegisterID fr2) ++ { ++ moveDouble(fr1, fpTempRegister); ++ moveDouble(fr2, fr1); ++ moveDouble(fpTempRegister, fr2); ++ } ++ + void addDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.addd(dest, dest, src); +@@ -2036,6 +2397,11 @@ public: + m_assembler.subd(dest, dest, src); + } + ++ void subDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) ++ { ++ m_assembler.subd(dest, op1, op2); ++ } ++ + void subDouble(Address src, FPRegisterID dest) + { + loadDouble(src, fpTempRegister); +@@ -2053,11 +2419,32 @@ public: + m_assembler.muld(dest, dest, fpTempRegister); + } + ++ void mulDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) ++ { ++ m_assembler.muld(dest, op1, op2); ++ } ++ + void divDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.divd(dest, dest, src); + } + ++ void divDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) ++ { ++ m_assembler.divd(dest, op1, op2); ++ } ++ ++ void divDouble(Address src, FPRegisterID dest) ++ { ++ loadDouble(src, fpTempRegister); ++ m_assembler.divd(dest, dest, fpTempRegister); ++ } ++ ++ void negateDouble(FPRegisterID src, FPRegisterID dest) ++ { ++ m_assembler.negd(dest, src); ++ } ++ + void convertInt32ToDouble(RegisterID src, FPRegisterID dest) + { + m_assembler.mtc1(src, fpTempRegister); +@@ -2117,6 +2504,8 @@ public: + + Jump branchEqual(RegisterID rs, RegisterID rt) + { ++ m_assembler.nop(); ++ m_assembler.nop(); + m_assembler.appendJump(); + m_assembler.beq(rs, rt, 0); + m_assembler.nop(); +@@ -2126,6 +2515,8 @@ public: + + Jump branchNotEqual(RegisterID rs, RegisterID rt) + { ++ m_assembler.nop(); ++ m_assembler.nop(); + m_assembler.appendJump(); + m_assembler.bne(rs, rt, 0); + m_assembler.nop(); +@@ -2192,11 +2583,33 @@ public: + // If the result is not representable as a 32 bit value, branch. + // May also branch for some values that are representable in 32 bits + // (specifically, in this case, INT_MAX 0x7fffffff). +- Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest) ++ enum BranchTruncateType { BranchIfTruncateFailed, BranchIfTruncateSuccessful }; ++ Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed) ++ { ++ m_assembler.truncwd(fpTempRegister, src); ++ m_assembler.mfc1(dest, fpTempRegister); ++ return branch32(branchType == BranchIfTruncateFailed ? Equal : NotEqual, dest, TrustedImm32(0x7fffffff)); ++ } ++ ++ Jump branchTruncateDoubleToUint32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed) ++ { ++ m_assembler.truncwd(fpTempRegister, src); ++ m_assembler.mfc1(dest, fpTempRegister); ++ return branch32(branchType == BranchIfTruncateFailed ? Equal : NotEqual, dest, TrustedImm32(0)); ++ } ++ ++ // Result is undefined if the value is outside of the integer range. ++ void truncateDoubleToInt32(FPRegisterID src, RegisterID dest) ++ { ++ m_assembler.truncwd(fpTempRegister, src); ++ m_assembler.mfc1(dest, fpTempRegister); ++ } ++ ++ // Result is undefined if src > 2^31 ++ void truncateDoubleToUint32(FPRegisterID src, RegisterID dest) + { + m_assembler.truncwd(fpTempRegister, src); + m_assembler.mfc1(dest, fpTempRegister); +- return branch32(Equal, dest, TrustedImm32(0x7fffffff)); + } + + // Convert 'src' to an integer, and places the resulting 'dest'. +@@ -2218,28 +2631,43 @@ public: + + Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch) + { +-#if WTF_MIPS_ISA_REV(2) && WTF_MIPS_FP64 +- m_assembler.mtc1(MIPSRegisters::zero, scratch); +- m_assembler.mthc1(MIPSRegisters::zero, scratch); +-#else +- m_assembler.mtc1(MIPSRegisters::zero, scratch); +- m_assembler.mtc1(MIPSRegisters::zero, FPRegisterID(scratch + 1)); +-#endif ++ m_assembler.vmov(scratch, MIPSRegisters::zero, MIPSRegisters::zero); + return branchDouble(DoubleNotEqual, reg, scratch); + } + + Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch) + { +-#if WTF_MIPS_ISA_REV(2) && WTF_MIPS_FP64 +- m_assembler.mtc1(MIPSRegisters::zero, scratch); +- m_assembler.mthc1(MIPSRegisters::zero, scratch); +-#else +- m_assembler.mtc1(MIPSRegisters::zero, scratch); +- m_assembler.mtc1(MIPSRegisters::zero, FPRegisterID(scratch + 1)); +-#endif ++ m_assembler.vmov(scratch, MIPSRegisters::zero, MIPSRegisters::zero); + return branchDouble(DoubleEqualOrUnordered, reg, scratch); + } + ++ // Invert a relational condition, e.g. == becomes !=, < becomes >=, etc. ++ static RelationalCondition invert(RelationalCondition cond) ++ { ++ RelationalCondition r; ++ if (cond == Equal) ++ r = NotEqual; ++ else if (cond == NotEqual) ++ r = Equal; ++ else if (cond == Above) ++ r = BelowOrEqual; ++ else if (cond == AboveOrEqual) ++ r = Below; ++ else if (cond == Below) ++ r = AboveOrEqual; ++ else if (cond == BelowOrEqual) ++ r = Above; ++ else if (cond == GreaterThan) ++ r = LessThanOrEqual; ++ else if (cond == GreaterThanOrEqual) ++ r = LessThan; ++ else if (cond == LessThan) ++ r = GreaterThanOrEqual; ++ else if (cond == LessThanOrEqual) ++ r = GreaterThan; ++ return r; ++ } ++ + void nop() + { + m_assembler.nop(); +@@ -2252,12 +2680,12 @@ public: + + static void replaceWithJump(CodeLocationLabel instructionStart, CodeLocationLabel destination) + { +- RELEASE_ASSERT_NOT_REACHED(); ++ MIPSAssembler::replaceWithJump(instructionStart.dataLocation(), destination.dataLocation()); + } + + static ptrdiff_t maxJumpReplacementSize() + { +- RELEASE_ASSERT_NOT_REACHED(); ++ MIPSAssembler::maxJumpReplacementSize(); + return 0; + } + +diff --git a/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h b/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h +index fa0f5e0..573d8dc 100644 +--- a/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h ++++ b/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h +@@ -93,6 +93,23 @@ public: + } + #endif + ++#if CPU(MIPS) ++ ALWAYS_INLINE void preserveReturnAddressAfterCall(RegisterID reg) ++ { ++ move(returnAddressRegister, reg); ++ } ++ ++ ALWAYS_INLINE void restoreReturnAddressBeforeReturn(RegisterID reg) ++ { ++ move(reg, returnAddressRegister); ++ } ++ ++ ALWAYS_INLINE void restoreReturnAddressBeforeReturn(Address address) ++ { ++ loadPtr(address, returnAddressRegister); ++ } ++#endif ++ + void emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry entry, GPRReg to) + { + loadPtr(Address(GPRInfo::callFrameRegister, entry * sizeof(Register)), to); +@@ -193,7 +210,7 @@ public: + move(TrustedImmPtr(scratchBuffer->activeLengthPtr()), GPRInfo::regT0); + storePtr(TrustedImmPtr(scratchSize), GPRInfo::regT0); + +-#if CPU(X86_64) || CPU(ARM) ++#if CPU(X86_64) || CPU(ARM) || CPU(MIPS) + move(TrustedImmPtr(buffer), GPRInfo::argumentGPR2); + move(TrustedImmPtr(argument), GPRInfo::argumentGPR1); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); +diff --git a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h +index 8adde05..3d99f6f 100644 +--- a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h ++++ b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h +@@ -576,6 +576,39 @@ public: + poke(GPRInfo::nonArgGPR0); + } + #endif // CPU(ARM_HARDFP) ++#elif CPU(MIPS) ++ ALWAYS_INLINE void setupArguments(FPRReg arg1) ++ { ++ moveDouble(arg1, FPRInfo::argumentFPR0); ++ } ++ ++ ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) ++ { ++ if (arg2 != FPRInfo::argumentFPR0) { ++ moveDouble(arg1, FPRInfo::argumentFPR0); ++ moveDouble(arg2, FPRInfo::argumentFPR1); ++ } else if (arg1 != FPRInfo::argumentFPR1) { ++ moveDouble(arg2, FPRInfo::argumentFPR1); ++ moveDouble(arg1, FPRInfo::argumentFPR0); ++ } else { ++ // Swap arg1, arg2. ++ swapDouble(FPRInfo::argumentFPR0, FPRInfo::argumentFPR1); ++ } ++ } ++ ++ ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) ++ { ++ assembler().vmov(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3, arg1); ++ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); ++ poke(arg2, 4); ++ } ++ ++ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) ++ { ++ setupStubArguments(arg1, arg2); ++ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); ++ poke(arg3, 4); ++ } + #else + #error "DFG JIT not supported on this platform." + #endif +@@ -803,119 +836,126 @@ public: + // These methods are suitable for any calling convention that provides for + // exactly 4 argument registers, e.g. ARMv7. + #if NUMBER_OF_ARGUMENT_REGISTERS == 4 ++ ++#if CPU(MIPS) ++#define POKE_ARGUMENT_OFFSET 4 ++#else ++#define POKE_ARGUMENT_OFFSET 0 ++#endif ++ + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, GPRReg arg3, GPRReg arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4) + { +- poke(arg4); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, TrustedImm32 arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) + { +- poke(arg5, 1); +- poke(arg4); ++ poke(arg5, POKE_ARGUMENT_OFFSET + 1); ++ poke(arg4, POKE_ARGUMENT_OFFSET); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + +diff --git a/Source/JavaScriptCore/dfg/DFGFPRInfo.h b/Source/JavaScriptCore/dfg/DFGFPRInfo.h +index 17aaa7d..e18ec06 100644 +--- a/Source/JavaScriptCore/dfg/DFGFPRInfo.h ++++ b/Source/JavaScriptCore/dfg/DFGFPRInfo.h +@@ -164,6 +164,74 @@ public: + + #endif + ++#if CPU(MIPS) ++ ++class FPRInfo { ++public: ++ typedef FPRReg RegisterType; ++ static const unsigned numberOfRegisters = 6; ++ ++ // Temporary registers. ++ static const FPRReg fpRegT0 = MIPSRegisters::f0; ++ static const FPRReg fpRegT1 = MIPSRegisters::f4; ++ static const FPRReg fpRegT2 = MIPSRegisters::f6; ++ static const FPRReg fpRegT3 = MIPSRegisters::f8; ++ static const FPRReg fpRegT4 = MIPSRegisters::f10; ++ static const FPRReg fpRegT5 = MIPSRegisters::f18; ++ ++ static const FPRReg returnValueFPR = MIPSRegisters::f0; ++ ++ static const FPRReg argumentFPR0 = MIPSRegisters::f12; ++ static const FPRReg argumentFPR1 = MIPSRegisters::f14; ++ ++ static FPRReg toRegister(unsigned index) ++ { ++ static const FPRReg registerForIndex[numberOfRegisters] = { ++ fpRegT0, fpRegT1, fpRegT2, fpRegT3, fpRegT4, fpRegT5 }; ++ ++ ASSERT(index < numberOfRegisters); ++ return registerForIndex[index]; ++ } ++ ++ static unsigned toIndex(FPRReg reg) ++ { ++ ASSERT(reg != InvalidFPRReg); ++ ASSERT(reg < 20); ++ static const unsigned indexForRegister[20] = { ++ 0, InvalidIndex, InvalidIndex, InvalidIndex, ++ 1, InvalidIndex, 2, InvalidIndex, ++ 3, InvalidIndex, 4, InvalidIndex, ++ InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, ++ InvalidIndex, InvalidIndex, 5, InvalidIndex, ++ }; ++ unsigned result = indexForRegister[reg]; ++ ASSERT(result != InvalidIndex); ++ return result; ++ } ++ ++ static const char* debugName(FPRReg reg) ++ { ++ ASSERT(reg != InvalidFPRReg); ++ ASSERT(reg < 32); ++ static const char* nameForRegister[32] = { ++ "f0", "f1", "f2", "f3", ++ "f4", "f5", "f6", "f7", ++ "f8", "f9", "f10", "f11", ++ "f12", "f13", "f14", "f15" ++ "f16", "f17", "f18", "f19" ++ "f20", "f21", "f22", "f23" ++ "f24", "f25", "f26", "f27" ++ "f28", "f29", "f30", "f31" ++ }; ++ return nameForRegister[reg]; ++ } ++private: ++ ++ static const unsigned InvalidIndex = 0xffffffff; ++}; ++ ++#endif ++ + typedef RegisterBank::iterator fpr_iterator; + + } } // namespace JSC::DFG +diff --git a/Source/JavaScriptCore/dfg/DFGGPRInfo.h b/Source/JavaScriptCore/dfg/DFGGPRInfo.h +index 3d07556..aa634cd 100644 +--- a/Source/JavaScriptCore/dfg/DFGGPRInfo.h ++++ b/Source/JavaScriptCore/dfg/DFGGPRInfo.h +@@ -461,6 +461,73 @@ private: + + #endif + ++#if CPU(MIPS) ++#define NUMBER_OF_ARGUMENT_REGISTERS 4 ++ ++class GPRInfo { ++public: ++ typedef GPRReg RegisterType; ++ static const unsigned numberOfRegisters = 6; ++ ++ // Temporary registers. ++ static const GPRReg regT0 = MIPSRegisters::v0; ++ static const GPRReg regT1 = MIPSRegisters::v1; ++ static const GPRReg regT2 = MIPSRegisters::t4; ++ static const GPRReg regT3 = MIPSRegisters::t5; ++ static const GPRReg regT4 = MIPSRegisters::t6; ++ static const GPRReg regT5 = MIPSRegisters::t7; ++ // These registers match the baseline JIT. ++ static const GPRReg cachedResultRegister = regT0; ++ static const GPRReg cachedResultRegister2 = regT1; ++ static const GPRReg callFrameRegister = MIPSRegisters::s0; ++ // These constants provide the names for the general purpose argument & return value registers. ++ static const GPRReg argumentGPR0 = MIPSRegisters::a0; ++ static const GPRReg argumentGPR1 = MIPSRegisters::a1; ++ static const GPRReg argumentGPR2 = MIPSRegisters::a2; ++ static const GPRReg argumentGPR3 = MIPSRegisters::a3; ++ static const GPRReg nonArgGPR0 = regT2; ++ static const GPRReg nonArgGPR1 = regT3; ++ static const GPRReg nonArgGPR2 = regT4; ++ static const GPRReg returnValueGPR = regT0; ++ static const GPRReg returnValueGPR2 = regT1; ++ static const GPRReg nonPreservedNonReturnGPR = regT5; ++ ++ static GPRReg toRegister(unsigned index) ++ { ++ ASSERT(index < numberOfRegisters); ++ static const GPRReg registerForIndex[numberOfRegisters] = { regT0, regT1, regT2, regT3, regT4, regT5 }; ++ return registerForIndex[index]; ++ } ++ ++ static unsigned toIndex(GPRReg reg) ++ { ++ ASSERT(reg != InvalidGPRReg); ++ ASSERT(reg < 16); ++ static const unsigned indexForRegister[16] = { InvalidIndex, InvalidIndex, 0, 1, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, 2, 3, 4, 5 }; ++ unsigned result = indexForRegister[reg]; ++ ASSERT(result != InvalidIndex); ++ return result; ++ } ++ ++ static const char* debugName(GPRReg reg) ++ { ++ ASSERT(reg != InvalidGPRReg); ++ ASSERT(reg < 16); ++ static const char* nameForRegister[16] = { ++ "zero", "at", "v0", "v1", ++ "a0", "a1", "a2", "a3", ++ "t0", "t1", "t2", "t3", ++ "t4", "t5", "t6", "t7" ++ }; ++ return nameForRegister[reg]; ++ } ++private: ++ ++ static const unsigned InvalidIndex = 0xffffffff; ++}; ++ ++#endif ++ + typedef RegisterBank::iterator gpr_iterator; + + } } // namespace JSC::DFG +diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +index ea33f38..247274b 100644 +--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h ++++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +@@ -1241,7 +1241,7 @@ public: + + // EncodedJSValue in JSVALUE32_64 is a 64-bit integer. When being compiled in ARM EABI, it must be aligned even-numbered register (r0, r2 or [sp]). + // To avoid assemblies from using wrong registers, let's occupy r1 or r3 with a dummy argument when necessary. +-#if COMPILER_SUPPORTS(EABI) && CPU(ARM) ++#if (COMPILER_SUPPORTS(EABI) && CPU(ARM)) || CPU(MIPS) + #define EABI_32BIT_DUMMY_ARG TrustedImm32(0), + #else + #define EABI_32BIT_DUMMY_ARG +@@ -1691,7 +1691,7 @@ public: + } + #endif + +-#if !defined(NDEBUG) && !CPU(ARM) ++#if !defined(NDEBUG) && !CPU(ARM) && !CPU(MIPS) + void prepareForExternalCall() + { + // We're about to call out to a "native" helper function. The helper +diff --git a/Source/JavaScriptCore/jit/JSInterfaceJIT.h b/Source/JavaScriptCore/jit/JSInterfaceJIT.h +index 7fdeaf0..48ad6b2 100644 +--- a/Source/JavaScriptCore/jit/JSInterfaceJIT.h ++++ b/Source/JavaScriptCore/jit/JSInterfaceJIT.h +@@ -125,6 +125,10 @@ namespace JSC { + static const RegisterID cachedResultRegister = MIPSRegisters::v0; + static const RegisterID firstArgumentRegister = MIPSRegisters::a0; + ++#if ENABLE(VALUE_PROFILER) ++ static const RegisterID bucketCounterRegister = MIPSRegisters::s3; ++#endif ++ + // regT0 must be v0 for returning a 32-bit value. + static const RegisterID regT0 = MIPSRegisters::v0; + +diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h +index 5d47ab9..c02f336 100644 +--- a/Source/JavaScriptCore/runtime/JSGlobalData.h ++++ b/Source/JavaScriptCore/runtime/JSGlobalData.h +@@ -141,14 +141,18 @@ namespace JSC { + return result; + } + +- static size_t allocationSize(size_t bufferSize) { return sizeof(size_t) + bufferSize; } ++ static size_t allocationSize(size_t bufferSize) { return sizeof(ScratchBuffer) + bufferSize; } + void setActiveLength(size_t activeLength) { m_activeLength = activeLength; } + size_t activeLength() const { return m_activeLength; }; + size_t* activeLengthPtr() { return &m_activeLength; }; + void* dataBuffer() { return m_buffer; } + + size_t m_activeLength; ++#if CPU(MIPS) && (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == 2) ++ void* m_buffer[0] __attribute__((aligned(8))); ++#else + void* m_buffer[0]; ++#endif + }; + #if COMPILER(MSVC) + #pragma warning(pop) +diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h +index 1698247..2d90359 100644 +--- a/Source/WTF/wtf/Platform.h ++++ b/Source/WTF/wtf/Platform.h +@@ -818,6 +818,10 @@ + #if CPU(ARM_TRADITIONAL) + #define ENABLE_DFG_JIT 1 + #endif ++/* Enable the DFG JIT on MIPS. */ ++#if CPU(MIPS) ++#define ENABLE_DFG_JIT 1 ++#endif + #endif + + /* If the jit is not available, enable the LLInt C Loop: */ +-- +1.8.3.2 + diff --git a/package/webkit/0008-support-bison-3.0.patch b/package/webkit/0008-support-bison-3.0.patch new file mode 100644 index 0000000000..c081b207ee --- /dev/null +++ b/package/webkit/0008-support-bison-3.0.patch @@ -0,0 +1,22 @@ +ANGLE doesn't build with bison 3.0 + +Author: allan.jensen@digia.com +​https://bugs.webkit.org/show_bug.cgi?id=119798 +Reviewed by Antti Koivisto. +Make glslang.y compatible with bison 3.0, by using %lex-param +to set YYLEX_PARAM and getting rid of useless YYID macro. + +From upstream: http://trac.webkit.org/changeset/154109 +[Arnout: adapted to our older webkit version] +Signed-off-by: Arnout Vandecaeppelle (Essensium/Mind) +--- +Index: trunk/Source/ThirdParty/ANGLE/src/compiler/glslang.y +=================================================================== +--- trunk/Source/ThirdParty/ANGLE/src/compiler/glslang.y (revision 154108) ++++ trunk/Source/ThirdParty/ANGLE/src/compiler/glslang.y (revision 154109) +@@ -48,4 +48,5 @@ + %pure-parser + %parse-param {TParseContext* context} ++%lex-param {YYLEX_PARAM} + + %union { diff --git a/package/webkit/Config.in b/package/webkit/Config.in new file mode 100644 index 0000000000..c139f5212c --- /dev/null +++ b/package/webkit/Config.in @@ -0,0 +1,53 @@ +config BR2_PACKAGE_WEBKIT_ARCH_SUPPORTS + bool + # ARM needs BLX, so v5t+ + default y if (BR2_arm || BR2_armeb) && !BR2_ARM_CPU_ARMV4 + default y if BR2_i386 || BR2_mips || BR2_mipsel || \ + BR2_sparc || BR2_x86_64 + depends on BR2_USE_MMU # libgail -> pango -> libglib2 + depends on BR2_DEPRECATED_SINCE_2015_08 + +# disabled on powerpc due to bug https://bugs.webkit.org/show_bug.cgi?id=113638 + +config BR2_PACKAGE_WEBKIT + bool "webkit" + depends on BR2_DEPRECATED_SINCE_2015_08 + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_USE_WCHAR # enchant -> libglib2 + depends on BR2_TOOLCHAIN_HAS_THREADS # enchant -> libglib2; icu + depends on BR2_PACKAGE_LIBGTK2 + depends on BR2_PACKAGE_WEBKIT_ARCH_SUPPORTS + depends on !BR2_BINFMT_FLAT # icu + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz + select BR2_PACKAGE_CAIRO + select BR2_PACKAGE_CAIRO_PNG + select BR2_PACKAGE_ENCHANT + select BR2_PACKAGE_HARFBUZZ + select BR2_PACKAGE_ICU + select BR2_PACKAGE_JPEG + select BR2_PACKAGE_LIBCURL + select BR2_PACKAGE_LIBGAIL + select BR2_PACKAGE_LIBSECRET + select BR2_PACKAGE_LIBSOUP + select BR2_PACKAGE_LIBXML2 + select BR2_PACKAGE_LIBXSLT + select BR2_PACKAGE_SQLITE + select BR2_PACKAGE_WEBP + select BR2_PACKAGE_XLIB_LIBXT if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXCOMPOSITE if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_XLIB_LIBXDAMAGE if BR2_PACKAGE_HAS_LIBGL + help + WebKit is an open source, standards compliant web browser engine. + + Note that WebKit does not build with a toolchain using the + old linuxthreads library. + + http://webkit.org/ + +comment "webkit needs libgtk2 and a toolchain w/ C++, wchar, threads" + depends on BR2_DEPRECATED_SINCE_2015_08 + depends on BR2_PACKAGE_WEBKIT_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + depends on !BR2_PACKAGE_LIBGTK2 || !BR2_INSTALL_LIBSTDCPP || \ + !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU diff --git a/package/webkit/webkit.mk b/package/webkit/webkit.mk new file mode 100644 index 0000000000..bbde7f4a26 --- /dev/null +++ b/package/webkit/webkit.mk @@ -0,0 +1,72 @@ +################################################################################ +# +# webkit +# +################################################################################ + +WEBKIT_VERSION = 1.11.5 +WEBKIT_SITE = http://www.webkitgtk.org/releases +WEBKIT_SOURCE = webkitgtk-$(WEBKIT_VERSION).tar.xz +WEBKIT_INSTALL_STAGING = YES +WEBKIT_DEPENDENCIES = host-ruby host-flex host-bison host-gperf enchant harfbuzz \ + icu jpeg libcurl libgail libsecret libsoup libxml2 libxslt libgtk2 sqlite webp + +WEBKIT_DEPENDENCIES += \ + $(if $(BR_PACKAGE_XLIB_LIBXCOMPOSITE),xlib_libXcomposite) \ + $(if $(BR_PACKAGE_XLIB_LIBXDAMAGE),xlib_libXdamage) + +# webkit-disable-tests.patch changes configure.ac therefore autoreconf required +WEBKIT_AUTORECONF = YES +WEBKIT_AUTORECONF_OPTS = -I $(@D)/Source/autotools + +# parallel make install deadlocks with make 3.81 +WEBKIT_INSTALL_STAGING_OPTS = -j1 DESTDIR=$(STAGING_DIR) install +WEBKIT_INSTALL_TARGET_OPTS = -j1 DESTDIR=$(TARGET_DIR) install + +# Does not build and it's disabled by default +# in newer releases +define DISABLE_INDEXED_DATABASE + $(SED) '/ENABLE_INDEXED_DATABASE/s:1:0:' \ + $(@D)/Source/WebCore/GNUmakefile.features.am +endef + +WEBKIT_PRE_CONFIGURE_HOOKS += DISABLE_INDEXED_DATABASE + +# Give explicit path to icu-config, and silence gazillions of warnings +# with recent gcc versions. +WEBKIT_CONF_ENV = ac_cv_path_icu_config=$(STAGING_DIR)/usr/bin/icu-config \ + CFLAGS="$(TARGET_CFLAGS) -Wno-cast-align -Wno-sign-compare" \ + CXXFLAGS="$(TARGET_CXXFLAGS) -Wno-cast-align -Wno-sign-compare" \ + AR_FLAGS="cru" + +WEBKIT_CONF_OPTS += \ + --enable-dependency-tracking \ + --with-gtk=2.0 \ + --disable-geolocation \ + --disable-webkit2 \ + --disable-glibtest \ + --disable-video \ + --disable-tests + +# Xorg Dependencies +WEBKIT_CONF_OPTS += --with-target=x11 +WEBKIT_DEPENDENCIES += xlib_libXt + +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_HAS_LIBGLES),yy) +WEBKIT_CONF_OPTS += --enable-gles2 +WEBKIT_DEPENDENCIES += libegl libgles +else +WEBKIT_CONF_OPTS += --disable-gles2 +endif + +# gles/egl support is prefered over opengl by webkit configure +ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) +WEBKIT_CONF_OPTS += --with-acceleration-backend=opengl +WEBKIT_DEPENDENCIES += libgl +else +# OpenGL/glx is auto-detected due to the presence of gl.h/glx.h, which is not +# enough, so disable glx and the use of the OpenGL acceleration backend here +WEBKIT_CONF_OPTS += --disable-glx --with-acceleration-backend=none +endif + +$(eval $(autotools-package)) diff --git a/package/webkitgtk24/0001-fix-ppc32.patch b/package/webkitgtk24/0001-fix-ppc32.patch new file mode 100644 index 0000000000..c655a0ecf4 --- /dev/null +++ b/package/webkitgtk24/0001-fix-ppc32.patch @@ -0,0 +1,34 @@ +From https://bugs.webkit.org/show_bug.cgi?id=130837 + +Signed-off-by: Gustavo Zacarias + +diff -Nura webkitgtk-2.4.8/Source/WebKit2/Platform/IPC/Connection.h webkitgtk-2.4.8-ppc/Source/WebKit2/Platform/IPC/Connection.h +--- webkitgtk-2.4.8/Source/WebKit2/Platform/IPC/Connection.h 2015-01-07 06:45:43.000000000 -0300 ++++ webkitgtk-2.4.8-ppc/Source/WebKit2/Platform/IPC/Connection.h 2015-04-20 01:55:41.554547510 -0300 +@@ -216,7 +216,11 @@ + + Client* m_client; + bool m_isServer; ++#if CPU(PPC) ++ uint64_t m_syncRequestID; ++#else + std::atomic m_syncRequestID; ++#endif + + bool m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage; + bool m_shouldExitOnSyncMessageSendFailure; +diff -Nura webkitgtk-2.4.8/Source/WebKit2/UIProcess/StatisticsRequest.cpp webkitgtk-2.4.8-ppc/Source/WebKit2/UIProcess/StatisticsRequest.cpp +--- webkitgtk-2.4.8/Source/WebKit2/UIProcess/StatisticsRequest.cpp 2015-01-07 06:45:43.000000000 -0300 ++++ webkitgtk-2.4.8-ppc/Source/WebKit2/UIProcess/StatisticsRequest.cpp 2015-04-20 01:55:41.555547544 -0300 +@@ -44,7 +44,11 @@ + + uint64_t StatisticsRequest::addOutstandingRequest() + { ++#if CPU(PPC) ++ static int64_t uniqueRequestID; ++#else + static std::atomic uniqueRequestID; ++#endif + + uint64_t requestID = ++uniqueRequestID; + m_outstandingRequests.add(requestID); diff --git a/package/webkitgtk24/0003-Pretty-quotes-in-licence-break-Python-stdin.patch b/package/webkitgtk24/0003-Pretty-quotes-in-licence-break-Python-stdin.patch new file mode 100644 index 0000000000..df51078b06 --- /dev/null +++ b/package/webkitgtk24/0003-Pretty-quotes-in-licence-break-Python-stdin.patch @@ -0,0 +1,36 @@ +Pretty quotes in licence break Python stdin. + +This patch was submitted upstream in this bug report: + +https://bugs.webkit.org/show_bug.cgi?id=128971 + +[Vincent: tweak the patch to make it apply on Buildroot] + +Signed-off-by: Vicente Olivert Riera + +Pretty quotes in licence break Python stdin. + +https://bugs.webkit.org/show_bug.cgi?id=128971 + +--- a/Source/WebCore/xml/XMLViewer.css 2014-01-23 16:49:58.000000000 +0000 ++++ b/Source/WebCore/xml/XMLViewer.css +@@ -14,7 +14,7 @@ + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS +- * “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. + * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +--- a/Source/WebCore/xml/XMLViewer.js 2014-01-23 16:49:58.000000000 +0000 ++++ b/Source/WebCore/xml/XMLViewer.js +@@ -15,7 +15,7 @@ + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS +- * “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. + * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/package/webkitgtk24/Config.in b/package/webkitgtk24/Config.in new file mode 100644 index 0000000000..bba3a2b9cc --- /dev/null +++ b/package/webkitgtk24/Config.in @@ -0,0 +1,83 @@ +config BR2_PACKAGE_WEBKITGTK24_ARCH_SUPPORTS + bool + # ARM needs BLX, so v5t+, BE completely untested so disabled + default y if BR2_arm && !BR2_ARM_CPU_ARMV4 + default y if BR2_i386 || BR2_x86_64 + # Disabled on MIPS big endian due to sigbus + default y if BR2_mipsel || BR2_mips64el + # Disabled on PowerPC pending runtime testing + # Disabled on SuperH because of segfault + depends on BR2_USE_MMU # libglib2 + +comment "webkitgtk24 needs libgtk2 and a toolchain w/ C++, wchar, NPTL, gcc >=4.8" + depends on BR2_PACKAGE_WEBKITGTK24_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + depends on !BR2_PACKAGE_LIBGTK2 || !BR2_PACKAGE_XORG7 || \ + !BR2_TOOLCHAIN_HAS_THREADS_NPTL || !BR2_INSTALL_LIBSTDCPP \ + || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + depends on BR2_USE_MMU + depends on BR2_DEPRECATED_SINCE_2016_05 + +config BR2_PACKAGE_WEBKITGTK24 + bool "webkitgtk 2.4.x" + depends on BR2_DEPRECATED_SINCE_2016_05 + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_USE_WCHAR + depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + depends on (BR2_PACKAGE_LIBGTK2 && BR2_PACKAGE_XORG7) + depends on BR2_PACKAGE_WEBKITGTK24_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz + select BR2_PACKAGE_CAIRO + select BR2_PACKAGE_CAIRO_PNG + select BR2_PACKAGE_ENCHANT + select BR2_PACKAGE_HARFBUZZ + select BR2_PACKAGE_ICU + select BR2_PACKAGE_JPEG + select BR2_PACKAGE_LIBCURL + select BR2_PACKAGE_LIBSECRET + select BR2_PACKAGE_LIBSOUP + select BR2_PACKAGE_LIBXML2 + select BR2_PACKAGE_LIBXSLT + select BR2_PACKAGE_SQLITE + select BR2_PACKAGE_WEBP + select BR2_PACKAGE_XLIB_LIBXT if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXCOMPOSITE if BR2_PACKAGE_HAS_LIBGL || \ + (BR2_PACKAGE_HAS_LIBGLES && BR2_PACKAGE_HAS_LIBEGL) + select BR2_PACKAGE_XLIB_LIBXDAMAGE if BR2_PACKAGE_HAS_LIBGL || \ + (BR2_PACKAGE_HAS_LIBGLES && BR2_PACKAGE_HAS_LIBEGL) + help + WebKit is an open source, standards compliant web browser engine. + + http://www.webkitgtk.org/ + +if BR2_PACKAGE_WEBKITGTK24 + +config BR2_PACKAGE_WEBKITGTK24_HTTPS + bool "HTTPS support" + select BR2_PACKAGE_CA_CERTIFICATES # runtime + select BR2_PACKAGE_LIBSOUP_SSL + help + Enable HTTPS protocol support. + +config BR2_PACKAGE_WEBKITGTK24_MULTIMEDIA + bool "multimedia support" + select BR2_PACKAGE_GSTREAMER1 + select BR2_PACKAGE_GST1_PLUGINS_BASE + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_ALSA + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_APP + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_AUDIOCONVERT + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_AUDIORESAMPLE + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_PLAYBACK + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEOCONVERT + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEOSCALE + select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VOLUME + select BR2_PACKAGE_GST1_PLUGINS_GOOD + select BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_ISOMP4 + select BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTSP + select BR2_PACKAGE_GST1_LIBAV + help + This option pulls in all of the required dependencies + to enable basic multimedia (video/audio) support. + +endif diff --git a/package/webkitgtk24/webkitgtk24.hash b/package/webkitgtk24/webkitgtk24.hash new file mode 100644 index 0000000000..d3a9cca0f4 --- /dev/null +++ b/package/webkitgtk24/webkitgtk24.hash @@ -0,0 +1,4 @@ +# From http://www.webkitgtk.org/releases/webkitgtk-2.4.10.tar.xz.sha1 +sha1 7fe2fe07ed21d00d8a8483d68c13a8c7ff0ff320 webkitgtk-2.4.10.tar.xz +# Calculated based on the hash above +sha256 33fda4b20d7fec2d6e9399ba03ef3f6d2a733c628bd77d397880c44e4bf7c614 webkitgtk-2.4.10.tar.xz diff --git a/package/webkitgtk24/webkitgtk24.mk b/package/webkitgtk24/webkitgtk24.mk new file mode 100644 index 0000000000..4b7d6949d4 --- /dev/null +++ b/package/webkitgtk24/webkitgtk24.mk @@ -0,0 +1,124 @@ +################################################################################ +# +# webkitgtk 2.4.x +# +################################################################################ + +WEBKITGTK24_VERSION = 2.4.10 +WEBKITGTK24_SITE = http://www.webkitgtk.org/releases +WEBKITGTK24_SOURCE = webkitgtk-$(WEBKITGTK24_VERSION).tar.xz +WEBKITGTK24_INSTALL_STAGING = YES +WEBKITGTK24_LICENSE = LGPLv2+, BSD-2c +WEBKITGTK24_LICENSE_FILES = \ + Source/WebCore/LICENSE-APPLE \ + Source/WebCore/LICENSE-LGPL-2 +WEBKITGTK24_DEPENDENCIES = host-ruby host-flex host-bison host-gperf \ + host-pkgconf enchant harfbuzz icu jpeg libcurl libgtk2 \ + libsecret libsoup libxml2 libxslt sqlite webp + +WEBKITGTK24_DEPENDENCIES += \ + $(if $(BR_PACKAGE_XLIB_LIBXCOMPOSITE),xlib_libXcomposite) \ + $(if $(BR_PACKAGE_XLIB_LIBXDAMAGE),xlib_libXdamage) + +# make 3.81 loops into oblivion with numjobs > 1 +ifneq ($(findstring x3.81,x$(RUNNING_MAKE_VERSION)),) +WEBKITGTK24_MAKE = $(MAKE1) +endif + +# Give explicit path to icu-config to avoid host leakage +WEBKITGTK24_CONF_ENV = ac_cv_path_icu_config=$(STAGING_DIR)/usr/bin/icu-config + +# Some 32-bit architectures need libatomic support for 64-bit ops +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) +WEBKITGTK24_CONF_ENV += LIBS="-latomic" +endif + +# dependency tracking is to avoid build issues in the GEN/WTF phase +WEBKITGTK24_CONF_OPTS = \ + --enable-dependency-tracking \ + --enable-spellcheck \ + --disable-geolocation \ + --disable-glibtest \ + --disable-gtk-doc-html \ + --disable-wayland-target + +ifeq ($(BR2_PACKAGE_WEBKITGTK24_MULTIMEDIA),y) +WEBKITGTK24_CONF_OPTS += \ + --enable-video \ + --enable-web-audio +WEBKITGTK24_DEPENDENCIES += gstreamer1 gst1-libav gst1-plugins-base gst1-plugins-good +else +WEBKITGTK24_CONF_OPTS += \ + --disable-video \ + --disable-web-audio +endif + +# OpenGL +ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) +WEBKITGTK24_CONF_OPTS += \ + --enable-accelerated-compositing \ + --enable-glx \ + --enable-webgl \ + --disable-gles2 +WEBKITGTK24_DEPENDENCIES += libgl +# EGL + GLES +else ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_HAS_LIBGLES),yy) +WEBKITGTK24_CONF_OPTS += \ + --enable-accelerated-compositing \ + --enable-gles2 \ + --enable-webgl \ + --disable-glx +WEBKITGTK24_DEPENDENCIES += libegl libgles +# Some EGL/GLES implementations needs extra help (eg. rpi-userland) +WEBKITGTK24_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) \ + `$(PKG_CONFIG_HOST_BINARY) --cflags egl` \ + `$(PKG_CONFIG_HOST_BINARY) --clfags glesv2`" +# No GL +else +WEBKITGTK24_CONF_OPTS += \ + --disable-accelerated-compositing \ + --disable-gles2 \ + --disable-glx \ + --disable-webgl +endif + +# X11 target with GTK2 (optionally GTK3) +ifeq ($(BR2_PACKAGE_XLIB_LIBXT),y) +WEBKITGTK24_CONF_OPTS += --enable-x11-target +WEBKITGTK24_DEPENDENCIES += xlib_libXt +else +WEBKITGTK24_CONF_OPTS += --disable-x11-target +endif + +# ARM needs NEON for JIT +# i386 & x86_64 don't seem to have any special requirements +ifeq ($(BR2_ARM_CPU_HAS_NEON)$(BR2_i386)$(BR2_x86_64),y) +WEBKITGTK24_CONF_OPTS += --enable-jit +else +WEBKITGTK24_CONF_OPTS += --disable-jit +# Disabling assembly and JIT needs an extra push sometimes (ppc) +# See https://bugs.webkit.org/show_bug.cgi?format=multiple&id=113638 +WEBKITGTK24_CONF_ENV += \ + CPPFLAGS="$(TARGET_CPPFLAGS) -DENABLE_JIT=0 -DENABLE_YARR_JIT=0 -DENABLE_ASSEMBLER=0" +endif + +# webkit1 (old API) uses gtk2, webkit2 (new API) uses gtk3 +# Both can be built simultaneously, prefer "newer" for size/time savings +# gtk2 is mandatory for plugin support +ifeq ($(BR2_PACKAGE_LIBGTK3_X11),y) +WEBKITGTK24_CONF_OPTS += \ + --with-gtk=3.0 \ + --disable-webkit1 +WEBKITGTK24_DEPENDENCIES += libgtk3 +define WEBKITGTK24_INSTALL_BROWSER + $(INSTALL) -D -m 0755 $(@D)/Programs/MiniBrowser \ + $(TARGET_DIR)/usr/bin/MiniBrowser +endef +WEBKITGTK24_POST_INSTALL_TARGET_HOOKS += WEBKITGTK24_INSTALL_BROWSER +else +WEBKITGTK24_CONF_OPTS += \ + --with-gtk=2.0 \ + --disable-webkit2 +endif + +$(eval $(autotools-package)) diff --git a/package/weston/0002-build-add-check-for-clock_gettime-in-librt.patch b/package/weston/0002-build-add-check-for-clock_gettime-in-librt.patch new file mode 100644 index 0000000000..2c8f54e505 --- /dev/null +++ b/package/weston/0002-build-add-check-for-clock_gettime-in-librt.patch @@ -0,0 +1,101 @@ +From 4c0a6ed01fb1aab578dc6ac29f11524a3883e14f Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Wed, 20 Apr 2016 13:16:58 -0300 +Subject: [PATCH] build: add check for clock_gettime() in librt + +In older versions of glibc (< 2.17) clock_gettime() is in librt, hence +linking against librt is required when using it. +Add a configure check for this and replace all instances of -lrt in +Makefile.am with $(CLOCK_GETTIME_LIBS). + +Signed-off-by: Gustavo Zacarias +--- +Status: submitted upstream + + Makefile.am | 15 ++++++++------- + configure.ac | 5 +++++ + 2 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index d3c3f71..c042c68 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -65,7 +65,7 @@ weston_LDFLAGS = -export-dynamic + weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON + weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) + weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ +- $(DLOPEN_LIBS) -lm -lrt libshared.la ++ $(DLOPEN_LIBS) -lm $(CLOCK_GETTIME_LIBS) libshared.la + + weston_SOURCES = \ + src/git-version.h \ +@@ -270,7 +270,8 @@ drm_backend_la_LIBADD = \ + $(COMPOSITOR_LIBS) \ + $(DRM_COMPOSITOR_LIBS) \ + $(INPUT_BACKEND_LIBS) \ +- libshared.la -lrt \ ++ libshared.la \ ++ $(CLOCK_GETTIME_LIBS) \ + libsession-helper.la + drm_backend_la_CFLAGS = \ + $(COMPOSITOR_CFLAGS) \ +@@ -508,11 +509,11 @@ nodist_weston_presentation_shm_SOURCES = \ + protocol/presentation-time-protocol.c \ + protocol/presentation-time-client-protocol.h + weston_presentation_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS) +-weston_presentation_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la -lm -lrt ++weston_presentation_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la -lm $(CLOCK_GETTIME_LIBS) + + weston_multi_resource_SOURCES = clients/multi-resource.c + weston_multi_resource_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS) +-weston_multi_resource_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la -lrt -lm ++weston_multi_resource_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la $(CLOCK_GETTIME_LIBS) -lm + endif + + if BUILD_SIMPLE_EGL_CLIENTS +@@ -580,7 +581,7 @@ BUILT_SOURCES += $(nodist_libtoytoolkit_la_SOURCES) + libtoytoolkit_la_LIBADD = \ + $(CLIENT_LIBS) \ + $(CAIRO_EGL_LIBS) \ +- libshared-cairo.la -lrt -lm ++ libshared-cairo.la $(CLOCK_GETTIME_LIBS) -lm + libtoytoolkit_la_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) $(CAIRO_EGL_CFLAGS) + + weston_flower_SOURCES = clients/flower.c +@@ -1181,7 +1182,7 @@ vertex_clip_test_SOURCES = \ + shared/helpers.h \ + src/vertex-clipping.c \ + src/vertex-clipping.h +-vertex_clip_test_LDADD = libtest-runner.la -lm -lrt ++vertex_clip_test_LDADD = libtest-runner.la -lm $(CLOCK_GETTIME_LIBS) + + libtest_client_la_SOURCES = \ + tests/weston-test-client-helper.c \ +@@ -1269,7 +1270,7 @@ matrix_test_SOURCES = \ + shared/matrix.c \ + shared/matrix.h + matrix_test_CPPFLAGS = -DUNIT_TEST +-matrix_test_LDADD = -lm -lrt ++matrix_test_LDADD = -lm $(CLOCK_GETTIME_LIBS) + + if ENABLE_IVI_SHELL + module_tests += \ +diff --git a/configure.ac b/configure.ac +index 447cf6b..670200c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -46,6 +46,11 @@ AC_CHECK_FUNC([dlopen], [], + AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl")) + AC_SUBST(DLOPEN_LIBS) + ++# In old glibc versions (< 2.17) clock_gettime() is in librt ++AC_SEARCH_LIBS([clock_gettime], [rt], ++ [CLOCK_GETTIME_LIBS="-lrt"]) ++AC_SUBST([CLOCK_GETTIME_LIBS]) ++ + AC_CHECK_DECL(SFD_CLOEXEC,[], + [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile weston")], + [[#include ]]) +-- +2.7.3 + diff --git a/package/wireshark/0001-configure-do-not-assume-broken-inet_pton-in-case-of-.patch b/package/wireshark/0001-configure-do-not-assume-broken-inet_pton-in-case-of-.patch new file mode 100644 index 0000000000..4d1f680a51 --- /dev/null +++ b/package/wireshark/0001-configure-do-not-assume-broken-inet_pton-in-case-of-.patch @@ -0,0 +1,32 @@ +From a0657feeb2b349ffda895a53e36ea5c992d871cf Mon Sep 17 00:00:00 2001 +From: Peter Seiderer +Date: Sat, 31 Oct 2015 22:38:48 +0100 +Subject: [PATCH] configure: do not assume broken inet_pton in case of cross + compiling + +Patch configure.ac to not assume broken inet_pton in case of cross +compiling. + +Signed-off-by: Peter Seiderer +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index aec0548..d640e0c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2646,8 +2646,8 @@ int main() + #endif + }], [AC_MSG_RESULT(ok); + have_inet_pton=yes], [AC_MSG_RESULT(broken); +-have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken); +-have_inet_pton=no])], ++have_inet_pton=no], [AC_MSG_RESULT([cross compiling, assume it is broken... not here]); ++have_inet_pton=yes])], + have_inet_pton=no) + if test "$have_inet_pton" = no; then + INET_PTON_LO="inet_pton.lo" +-- +2.1.4 + diff --git a/package/wpa_supplicant/0001-fix-readline-libs-ordering.patch b/package/wpa_supplicant/0001-fix-readline-libs-ordering.patch new file mode 100644 index 0000000000..2a9b832797 --- /dev/null +++ b/package/wpa_supplicant/0001-fix-readline-libs-ordering.patch @@ -0,0 +1,26 @@ +commit 631f0893038743cebd2def39df61aceb48bd43a9 +Author: David du Colombier <0intro@gmail.com> +Date: Sun Sep 13 23:40:43 2015 +0200 + + wpa_supplicant: fix static link with readline + + The readline library depends on ncurses, so + it should be set before ncurses on the linker + command line to be able to be statically linked + successfully. + + Signed-off-by: David du Colombier <0intro@gmail.com> + +diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile +index 1597412..581db02 100644 +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1408,7 +1408,7 @@ LIBS += $(DBUS_LIBS) + + ifdef CONFIG_READLINE + OBJS_c += ../src/utils/edit_readline.o +-LIBS_c += -lncurses -lreadline ++LIBS_c += -lreadline -lncurses + else + ifdef CONFIG_WPA_CLI_EDIT + OBJS_c += ../src/utils/edit.o diff --git a/package/wpa_supplicant/0002-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch b/package/wpa_supplicant/0002-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch new file mode 100644 index 0000000000..00e5b7c771 --- /dev/null +++ b/package/wpa_supplicant/0002-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch @@ -0,0 +1,32 @@ +From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 25 Oct 2015 15:45:50 +0200 +Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no + PMF in use + +WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is +enabled. Verify that PMF is in use before using this field on station +side to avoid accepting unauthenticated key updates. (CVE-2015-5310) + +Signed-off-by: Jouni Malinen +--- + wpa_supplicant/wnm_sta.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c +index 954de67..7d79499 100644 +--- a/wpa_supplicant/wnm_sta.c ++++ b/wpa_supplicant/wnm_sta.c +@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s, + end = ptr + key_len_total; + wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total); + ++ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) { ++ wpa_msg(wpa_s, MSG_INFO, ++ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled"); ++ return; ++ } ++ + while (ptr + 1 < end) { + if (ptr + 2 + ptr[1] > end) { + wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element " diff --git a/package/wpa_supplicant/0003-EAP-pwd-peer-Fix-last-fragment-length-validation.patch b/package/wpa_supplicant/0003-EAP-pwd-peer-Fix-last-fragment-length-validation.patch new file mode 100644 index 0000000000..82c26398b6 --- /dev/null +++ b/package/wpa_supplicant/0003-EAP-pwd-peer-Fix-last-fragment-length-validation.patch @@ -0,0 +1,54 @@ +From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Nov 2015 18:18:17 +0200 +Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation + +All but the last fragment had their length checked against the remaining +room in the reassembly buffer. This allowed a suitably constructed last +fragment frame to try to add extra data that would go beyond the buffer. +The length validation code in wpabuf_put_data() prevents an actual +buffer write overflow from occurring, but this results in process +termination. (CVE-2015-5315) + +Signed-off-by: Jouni Malinen +--- + src/eap_peer/eap_pwd.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c +index 1f78544..75ceef1 100644 +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + /* + * buffer and ACK the fragment + */ +- if (EAP_PWD_GET_MORE_BIT(lm_exch)) { ++ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) { + data->in_frag_pos += len; + if (data->in_frag_pos > wpabuf_size(data->inbuf)) { + wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack " +@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + return NULL; + } + wpabuf_put_data(data->inbuf, pos, len); +- ++ } ++ if (EAP_PWD_GET_MORE_BIT(lm_exch)) { + resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, + EAP_PWD_HDR_SIZE, + EAP_CODE_RESPONSE, eap_get_id(reqData)); +@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + * we're buffering and this is the last fragment + */ + if (data->in_frag_pos) { +- wpabuf_put_data(data->inbuf, pos, len); + wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes", + (int) len); +- data->in_frag_pos += len; + pos = wpabuf_head_u8(data->inbuf); + len = data->in_frag_pos; + } +-- +1.9.1 + diff --git a/package/wpa_supplicant/0004-EAP-pwd-server-Fix-last-fragment-length-validation.patch b/package/wpa_supplicant/0004-EAP-pwd-server-Fix-last-fragment-length-validation.patch new file mode 100644 index 0000000000..bfc4c74e95 --- /dev/null +++ b/package/wpa_supplicant/0004-EAP-pwd-server-Fix-last-fragment-length-validation.patch @@ -0,0 +1,51 @@ +From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Nov 2015 18:24:16 +0200 +Subject: [PATCH] EAP-pwd server: Fix last fragment length validation + +All but the last fragment had their length checked against the remaining +room in the reassembly buffer. This allowed a suitably constructed last +fragment frame to try to add extra data that would go beyond the buffer. +The length validation code in wpabuf_put_data() prevents an actual +buffer write overflow from occurring, but this results in process +termination. (CVE-2015-5314) + +Signed-off-by: Jouni Malinen +--- + src/eap_server/eap_server_pwd.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c +index cb83ff7..9f787ab 100644 +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + /* + * the first and all intermediate fragments have the M bit set + */ +- if (EAP_PWD_GET_MORE_BIT(lm_exch)) { ++ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) { + if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) { + wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow " + "attack detected! (%d+%d > %d)", +@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + } + wpabuf_put_data(data->inbuf, pos, len); + data->in_frag_pos += len; ++ } ++ if (EAP_PWD_GET_MORE_BIT(lm_exch)) { + wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment", + (int) len); + return; +@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + * buffering fragments so that's how we know it's the last) + */ + if (data->in_frag_pos) { +- wpabuf_put_data(data->inbuf, pos, len); +- data->in_frag_pos += len; + pos = wpabuf_head_u8(data->inbuf); + len = data->in_frag_pos; + wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes", +-- +1.9.1 + diff --git a/package/wpa_supplicant/0005-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch b/package/wpa_supplicant/0005-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch new file mode 100644 index 0000000000..3088f6a6dc --- /dev/null +++ b/package/wpa_supplicant/0005-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch @@ -0,0 +1,34 @@ +From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Nov 2015 19:35:44 +0200 +Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message + +If the Confirm message is received from the server before the Identity +exchange has been completed, the group has not yet been determined and +data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange() +did not take this corner case into account and could end up +dereferencing a NULL pointer and terminating the process if invalid +message sequence is received. (CVE-2015-5316) + +Signed-off-by: Jouni Malinen +--- + src/eap_peer/eap_pwd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c +index 75ceef1..892b590 100644 +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data, + wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN); + + fin: +- bin_clear_free(cruft, BN_num_bytes(data->grp->prime)); ++ if (data->grp) ++ bin_clear_free(cruft, BN_num_bytes(data->grp->prime)); + BN_clear_free(x); + BN_clear_free(y); + if (data->outbuf == NULL) { +-- +1.9.1 + diff --git a/package/wpa_supplicant/0006-fix-libwpa_client.patch b/package/wpa_supplicant/0006-fix-libwpa_client.patch new file mode 100644 index 0000000000..11c5402374 --- /dev/null +++ b/package/wpa_supplicant/0006-fix-libwpa_client.patch @@ -0,0 +1,39 @@ +From 6f7e0354a9035ce33742a5f869f817a6b39b2f31 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Thu, 29 Oct 2015 11:39:03 +0100 +Subject: [PATCH 1/1] wpa_supplicant/Makefile: fix libwpa_client +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building libwpa_client requires src/utils/common.c for bin_clear_free() else +loading the library fails with: + + Error relocating /usr/lib/libwpa_client.so: bin_clear_free: symbol not found + +Backported from: 736b7cb2daf877a0cb9ad42ff15a2efbbd65fa42 + +Signed-off-by: Jörg Krause +--- + wpa_supplicant/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile +index 61f8f18..0c444b0 100644 +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1706,9 +1706,11 @@ wpa_cli: $(OBJS_c) + + LIBCTRL += ../src/common/wpa_ctrl.o + LIBCTRL += ../src/utils/os_$(CONFIG_OS).o ++LIBCTRL += ../src/utils/common.c + LIBCTRL += ../src/utils/wpa_debug.o + LIBCTRLSO += ../src/common/wpa_ctrl.c + LIBCTRLSO += ../src/utils/os_$(CONFIG_OS).c ++LIBCTRLSO += ../src/utils/common.c + LIBCTRLSO += ../src/utils/wpa_debug.c + + libwpa_client.a: $(LIBCTRL) +-- +2.6.2 + diff --git a/package/wpa_supplicant/0007-systemd-Update-service-files-according-to-dbus-inter.patch b/package/wpa_supplicant/0007-systemd-Update-service-files-according-to-dbus-inter.patch new file mode 100644 index 0000000000..59c54506eb --- /dev/null +++ b/package/wpa_supplicant/0007-systemd-Update-service-files-according-to-dbus-inter.patch @@ -0,0 +1,77 @@ +From b6cea24d6191d9ccdcd1ac38a5322e3da73218db Mon Sep 17 00:00:00 2001 +From: Marcin Niestroj +Date: Mon, 11 Apr 2016 13:23:54 +0200 +Subject: [PATCH] systemd: Update service files according to dbus interface + version used + +systemd service files were supplied with old DBus bus name. After +service activation systemd was waiting for appearance of specified bus +name to consider it started successfully. However, if wpa_supplicant was +compiled only with new dbus interface name, then systemd didn't notice +configured (old) DBus bus name appearance. In the end service was +considered malfunctioning and it was deactivated. + +Update systemd service BusName property according to supported DBus +interface version. + +Signed-off-by: Marcin Niestroj +--- + wpa_supplicant/Makefile | 8 ++++++-- + wpa_supplicant/systemd/wpa_supplicant.service.in | 4 ++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile +index ad9ead9..fbd1b25 100644 +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1374,6 +1374,7 @@ ifndef DBUS_INCLUDE + DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1) + endif + DBUS_CFLAGS += $(DBUS_INCLUDE) ++DBUS_INTERFACE=fi.epitest.hostap.WPASupplicant + endif + + ifdef CONFIG_CTRL_IFACE_DBUS_NEW +@@ -1399,6 +1400,7 @@ DBUS_OBJS += dbus/dbus_new_introspect.o + DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO + endif + DBUS_CFLAGS += $(DBUS_INCLUDE) ++DBUS_INTERFACE=fi.w1.wpa_supplicant1 + endif + + ifdef DBUS +@@ -1760,11 +1762,13 @@ else + endif + + %.service: %.service.in +- $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ ++ $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' \ ++ -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@ + @$(E) " sed" $< + + %@.service: %.service.arg.in +- $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ ++ $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' \ ++ -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@ + @$(E) " sed" $< + + wpa_supplicant.exe: wpa_supplicant +diff --git a/wpa_supplicant/systemd/wpa_supplicant.service.in b/wpa_supplicant/systemd/wpa_supplicant.service.in +index ea964ce..bc5d49a 100644 +--- a/wpa_supplicant/systemd/wpa_supplicant.service.in ++++ b/wpa_supplicant/systemd/wpa_supplicant.service.in +@@ -5,9 +5,9 @@ Wants=network.target + + [Service] + Type=dbus +-BusName=fi.epitest.hostap.WPASupplicant ++BusName=@DBUS_INTERFACE@ + ExecStart=@BINDIR@/wpa_supplicant -u + + [Install] + WantedBy=multi-user.target +-Alias=dbus-fi.epitest.hostap.WPASupplicant.service ++Alias=dbus-@DBUS_INTERFACE@.service +-- +2.8.0 + diff --git a/package/wpa_supplicant/0008-WPS-Reject-a-Credential-with-invalid-passphrase.patch b/package/wpa_supplicant/0008-WPS-Reject-a-Credential-with-invalid-passphrase.patch new file mode 100644 index 0000000000..282aa952b5 --- /dev/null +++ b/package/wpa_supplicant/0008-WPS-Reject-a-Credential-with-invalid-passphrase.patch @@ -0,0 +1,85 @@ +From ecbb0b3dc122b0d290987cf9c84010bbe53e1022 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 4 Mar 2016 17:20:18 +0200 +Subject: [PATCH] WPS: Reject a Credential with invalid passphrase + +WPA/WPA2-Personal passphrase is not allowed to include control +characters. Reject a Credential received from a WPS Registrar both as +STA (Credential) and AP (AP Settings) if the credential is for WPAPSK or +WPA2PSK authentication type and includes an invalid passphrase. + +This fixes an issue where hostapd or wpa_supplicant could have updated +the configuration file PSK/passphrase parameter with arbitrary data from +an external device (Registrar) that may not be fully trusted. Should +such data include a newline character, the resulting configuration file +could become invalid and fail to be parsed. + +Signed-off-by: Jouni Malinen +Signed-off-by: Baruch Siach +--- +Patch status: upstream (ecbb0b3dc122b0d290987cf9c84010bbe53e1022) + + src/utils/common.c | 12 ++++++++++++ + src/utils/common.h | 1 + + src/wps/wps_attr_process.c | 10 ++++++++++ + 3 files changed, 23 insertions(+) + +diff --git a/src/utils/common.c b/src/utils/common.c +index 450e2c6519ba..27b7c02de10b 100644 +--- a/src/utils/common.c ++++ b/src/utils/common.c +@@ -697,6 +697,18 @@ int is_hex(const u8 *data, size_t len) + } + + ++int has_ctrl_char(const u8 *data, size_t len) ++{ ++ size_t i; ++ ++ for (i = 0; i < len; i++) { ++ if (data[i] < 32 || data[i] == 127) ++ return 1; ++ } ++ return 0; ++} ++ ++ + size_t merge_byte_arrays(u8 *res, size_t res_len, + const u8 *src1, size_t src1_len, + const u8 *src2, size_t src2_len) +diff --git a/src/utils/common.h b/src/utils/common.h +index 701dbb236ed5..a97224070385 100644 +--- a/src/utils/common.h ++++ b/src/utils/common.h +@@ -488,6 +488,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len); + + char * wpa_config_parse_string(const char *value, size_t *len); + int is_hex(const u8 *data, size_t len); ++int has_ctrl_char(const u8 *data, size_t len); + size_t merge_byte_arrays(u8 *res, size_t res_len, + const u8 *src1, size_t src1_len, + const u8 *src2, size_t src2_len); +diff --git a/src/wps/wps_attr_process.c b/src/wps/wps_attr_process.c +index eadb22fe2e78..e8c4579309ab 100644 +--- a/src/wps/wps_attr_process.c ++++ b/src/wps/wps_attr_process.c +@@ -229,6 +229,16 @@ static int wps_workaround_cred_key(struct wps_credential *cred) + cred->key_len--; + #endif /* CONFIG_WPS_STRICT */ + } ++ ++ ++ if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) && ++ (cred->key_len < 8 || has_ctrl_char(cred->key, cred->key_len))) { ++ wpa_printf(MSG_INFO, "WPS: Reject credential with invalid WPA/WPA2-Personal passphrase"); ++ wpa_hexdump_ascii_key(MSG_INFO, "WPS: Network Key", ++ cred->key, cred->key_len); ++ return -1; ++ } ++ + return 0; + } + +-- +2.8.1 + diff --git a/package/wpa_supplicant/0009-Reject-psk-parameter-set-with-invalid-passphrase-cha.patch b/package/wpa_supplicant/0009-Reject-psk-parameter-set-with-invalid-passphrase-cha.patch new file mode 100644 index 0000000000..316c0700ce --- /dev/null +++ b/package/wpa_supplicant/0009-Reject-psk-parameter-set-with-invalid-passphrase-cha.patch @@ -0,0 +1,53 @@ +From 73e4abb24a936014727924d8b0b2965edfc117dd Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 4 Mar 2016 18:46:41 +0200 +Subject: [PATCH] Reject psk parameter set with invalid passphrase character + +WPA/WPA2-Personal passphrase is not allowed to include control +characters. Reject a passphrase configuration attempt if that passphrase +includes an invalid passphrase. + +This fixes an issue where wpa_supplicant could have updated the +configuration file psk parameter with arbitrary data from the control +interface or D-Bus interface. While those interfaces are supposed to be +accessible only for trusted users/applications, it may be possible that +an untrusted user has access to a management software component that +does not validate the passphrase value before passing it to +wpa_supplicant. + +This could allow such an untrusted user to inject up to 63 characters of +almost arbitrary data into the configuration file. Such configuration +file could result in wpa_supplicant trying to load a library (e.g., +opensc_engine_path, pkcs11_engine_path, pkcs11_module_path, +load_dynamic_eap) from user controlled location when starting again. +This would allow code from that library to be executed under the +wpa_supplicant process privileges. + +Signed-off-by: Jouni Malinen +Signed-off-by: Baruch Siach +--- +Patch status: upstream (73e4abb24a936014727924d8b0b2965edfc117dd) + + wpa_supplicant/config.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c +index b1c7870dafe0..fdd964356afa 100644 +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -478,6 +478,12 @@ static int wpa_config_parse_psk(const struct parse_data *data, + } + wpa_hexdump_ascii_key(MSG_MSGDUMP, "PSK (ASCII passphrase)", + (u8 *) value, len); ++ if (has_ctrl_char((u8 *) value, len)) { ++ wpa_printf(MSG_ERROR, ++ "Line %d: Invalid passphrase character", ++ line); ++ return -1; ++ } + if (ssid->passphrase && os_strlen(ssid->passphrase) == len && + os_memcmp(ssid->passphrase, value, len) == 0) { + /* No change to the previously configured value */ +-- +2.8.1 + diff --git a/package/wpa_supplicant/0010-Remove-newlines-from-wpa_supplicant-config-network-o.patch b/package/wpa_supplicant/0010-Remove-newlines-from-wpa_supplicant-config-network-o.patch new file mode 100644 index 0000000000..8a40dcecfe --- /dev/null +++ b/package/wpa_supplicant/0010-Remove-newlines-from-wpa_supplicant-config-network-o.patch @@ -0,0 +1,84 @@ +From 0fe5a234240a108b294a87174ad197f6b5cb38e9 Mon Sep 17 00:00:00 2001 +From: Paul Stewart +Date: Thu, 3 Mar 2016 15:40:19 -0800 +Subject: [PATCH] Remove newlines from wpa_supplicant config network output + +Spurious newlines output while writing the config file can corrupt the +wpa_supplicant configuration. Avoid writing these for the network block +parameters. This is a generic filter that cover cases that may not have +been explicitly addressed with a more specific commit to avoid control +characters in the psk parameter. + +Signed-off-by: Paul Stewart +Signed-off-by: Baruch Siach +--- +Patch status: upstream (0fe5a234240a108b294a87174ad197f6b5cb38e9) + + src/utils/common.c | 11 +++++++++++ + src/utils/common.h | 1 + + wpa_supplicant/config.c | 15 +++++++++++++-- + 3 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/src/utils/common.c b/src/utils/common.c +index 27b7c02de10b..9856463242c7 100644 +--- a/src/utils/common.c ++++ b/src/utils/common.c +@@ -709,6 +709,17 @@ int has_ctrl_char(const u8 *data, size_t len) + } + + ++int has_newline(const char *str) ++{ ++ while (*str) { ++ if (*str == '\n' || *str == '\r') ++ return 1; ++ str++; ++ } ++ return 0; ++} ++ ++ + size_t merge_byte_arrays(u8 *res, size_t res_len, + const u8 *src1, size_t src1_len, + const u8 *src2, size_t src2_len) +diff --git a/src/utils/common.h b/src/utils/common.h +index a97224070385..d19927b375bf 100644 +--- a/src/utils/common.h ++++ b/src/utils/common.h +@@ -489,6 +489,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len); + char * wpa_config_parse_string(const char *value, size_t *len); + int is_hex(const u8 *data, size_t len); + int has_ctrl_char(const u8 *data, size_t len); ++int has_newline(const char *str); + size_t merge_byte_arrays(u8 *res, size_t res_len, + const u8 *src1, size_t src1_len, + const u8 *src2, size_t src2_len); +diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c +index fdd964356afa..eb97cd5e4e6e 100644 +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -2699,8 +2699,19 @@ char * wpa_config_get(struct wpa_ssid *ssid, const char *var) + + for (i = 0; i < NUM_SSID_FIELDS; i++) { + const struct parse_data *field = &ssid_fields[i]; +- if (os_strcmp(var, field->name) == 0) +- return field->writer(field, ssid); ++ if (os_strcmp(var, field->name) == 0) { ++ char *ret = field->writer(field, ssid); ++ ++ if (ret && has_newline(ret)) { ++ wpa_printf(MSG_ERROR, ++ "Found newline in value for %s; not returning it", ++ var); ++ os_free(ret); ++ ret = NULL; ++ } ++ ++ return ret; ++ } + } + + return NULL; +-- +2.8.1 + diff --git a/package/wpa_supplicant/0011-Reject-SET_CRED-commands-with-newline-characters-in-.patch b/package/wpa_supplicant/0011-Reject-SET_CRED-commands-with-newline-characters-in-.patch new file mode 100644 index 0000000000..530681faa4 --- /dev/null +++ b/package/wpa_supplicant/0011-Reject-SET_CRED-commands-with-newline-characters-in-.patch @@ -0,0 +1,65 @@ +From b166cd84a77a6717be9600bf95378a0055d6f5a5 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 5 Apr 2016 23:33:10 +0300 +Subject: [PATCH] Reject SET_CRED commands with newline characters in the + string values + +Most of the cred block parameters are written as strings without +filtering and if there is an embedded newline character in the value, +unexpected configuration file data might be written. + +This fixes an issue where wpa_supplicant could have updated the +configuration file cred parameter with arbitrary data from the control +interface or D-Bus interface. While those interfaces are supposed to be +accessible only for trusted users/applications, it may be possible that +an untrusted user has access to a management software component that +does not validate the credential value before passing it to +wpa_supplicant. + +This could allow such an untrusted user to inject almost arbitrary data +into the configuration file. Such configuration file could result in +wpa_supplicant trying to load a library (e.g., opensc_engine_path, +pkcs11_engine_path, pkcs11_module_path, load_dynamic_eap) from user +controlled location when starting again. This would allow code from that +library to be executed under the wpa_supplicant process privileges. + +Signed-off-by: Jouni Malinen +Signed-off-by: Baruch Siach +--- +Patch status: upstream (b166cd84a77a6717be9600bf95378a0055d6f5a5) + + wpa_supplicant/config.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c +index eb97cd5e4e6e..69152efdea1a 100644 +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -2896,6 +2896,8 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var, + + if (os_strcmp(var, "password") == 0 && + os_strncmp(value, "ext:", 4) == 0) { ++ if (has_newline(value)) ++ return -1; + str_clear_free(cred->password); + cred->password = os_strdup(value); + cred->ext_password = 1; +@@ -2946,9 +2948,14 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var, + } + + val = wpa_config_parse_string(value, &len); +- if (val == NULL) { ++ if (val == NULL || ++ (os_strcmp(var, "excluded_ssid") != 0 && ++ os_strcmp(var, "roaming_consortium") != 0 && ++ os_strcmp(var, "required_roaming_consortium") != 0 && ++ has_newline(val))) { + wpa_printf(MSG_ERROR, "Line %d: invalid field '%s' string " + "value '%s'.", line, var, value); ++ os_free(val); + return -1; + } + +-- +2.8.1 + diff --git a/package/wpa_supplicant/0012-Reject-SET-commands-with-newline-characters-in-the-s.patch b/package/wpa_supplicant/0012-Reject-SET-commands-with-newline-characters-in-the-s.patch new file mode 100644 index 0000000000..a29df07912 --- /dev/null +++ b/package/wpa_supplicant/0012-Reject-SET-commands-with-newline-characters-in-the-s.patch @@ -0,0 +1,53 @@ +From 2a3f56502b52375c3bf113cf92adfa99bad6b488 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 5 Apr 2016 23:55:48 +0300 +Subject: [PATCH] Reject SET commands with newline characters in the string + values + +Many of the global configuration parameters are written as strings +without filtering and if there is an embedded newline character in the +value, unexpected configuration file data might be written. + +This fixes an issue where wpa_supplicant could have updated the +configuration file global parameter with arbitrary data from the control +interface or D-Bus interface. While those interfaces are supposed to be +accessible only for trusted users/applications, it may be possible that +an untrusted user has access to a management software component that +does not validate the value of a parameter before passing it to +wpa_supplicant. + +This could allow such an untrusted user to inject almost arbitrary data +into the configuration file. Such configuration file could result in +wpa_supplicant trying to load a library (e.g., opensc_engine_path, +pkcs11_engine_path, pkcs11_module_path, load_dynamic_eap) from user +controlled location when starting again. This would allow code from that +library to be executed under the wpa_supplicant process privileges. + +Signed-off-by: Jouni Malinen +Signed-off-by: Baruch Siach +--- +Patch status: upstream (2a3f56502b52375c3bf113cf92adfa99bad6b488) + + wpa_supplicant/config.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c +index 69152efdea1a..d9a1603f6d7e 100644 +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -3764,6 +3764,12 @@ static int wpa_global_config_parse_str(const struct global_parse_data *data, + return -1; + } + ++ if (has_newline(pos)) { ++ wpa_printf(MSG_ERROR, "Line %d: invalid %s value with newline", ++ line, data->name); ++ return -1; ++ } ++ + tmp = os_strdup(pos); + if (tmp == NULL) + return -1; +-- +2.8.1 + diff --git a/package/wvdial/0001-uClibc-scandir.patch b/package/wvdial/0001-uClibc-scandir.patch new file mode 100644 index 0000000000..b611e94a0b --- /dev/null +++ b/package/wvdial/0001-uClibc-scandir.patch @@ -0,0 +1,23 @@ +Fix wvdial so that it works with scandir as defined in uClibc. + +Signed-off-by: Simon Dawson + +diff -Nurp a/wvmodemscan.cc b/wvmodemscan.cc +--- a/wvmodemscan.cc 2009-09-29 18:27:28.000000000 +0100 ++++ b/wvmodemscan.cc 2012-07-28 14:03:56.359729660 +0100 +@@ -495,13 +495,13 @@ static int fileselect(const struct diren + // (no internal ISDN support) || !strncmp(e->d_name, "ttyI", 4); + } + +-#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 10) ++#if defined(__UCLIBC__) || (defined(__GLIBC__) && __GLIBC_PREREQ(2, 10)) + static int filesort(const dirent **e1, const dirent **e2) + #else + static int filesort(const void *_e1, const void *_e2) + #endif + { +-#if !(defined(__GLIBC__) && __GLIBC_PREREQ(2, 10)) ++#if !(defined(__UCLIBC__) || (defined(__GLIBC__) && __GLIBC_PREREQ(2, 10))) + dirent const * const *e1 = (dirent const * const *)_e1; + dirent const * const *e2 = (dirent const * const *)_e2; + #endif diff --git a/package/wvdial/Config.in b/package/wvdial/Config.in new file mode 100644 index 0000000000..d5458700f2 --- /dev/null +++ b/package/wvdial/Config.in @@ -0,0 +1,15 @@ +config BR2_PACKAGE_WVDIAL + bool "wvdial" + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_USE_MMU # wvstreams + depends on !BR2_STATIC_LIBS # wvstreams + depends on !BR2_TOOLCHAIN_USES_MUSL # wvstreams + select BR2_PACKAGE_WVSTREAMS + help + wvdial is an intelligent Point-to-Point Protocol dialer + + http://wvdial.googlecode.com/ + +comment "wvdial needs a (e)glibc or uClibc toolchain w/ C++, dynamic library" + depends on BR2_USE_MMU + depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_MUSL diff --git a/package/wvdial/wvdial.mk b/package/wvdial/wvdial.mk new file mode 100644 index 0000000000..e89dfc5887 --- /dev/null +++ b/package/wvdial/wvdial.mk @@ -0,0 +1,32 @@ +################################################################################ +# +# wvdial +# +################################################################################ + +WVDIAL_VERSION = 1.61 +WVDIAL_SITE = http://wvdial.googlecode.com/files +WVDIAL_SOURCE = wvdial-$(WVDIAL_VERSION).tar.bz2 +WVDIAL_DEPENDENCIES = wvstreams + +WVDIAL_LICENSE = LGPLv2 +WVDIAL_LICENSE_FILES = COPYING.LIB + +# N.B. parallel make fails +WVDIAL_MAKE = $(MAKE1) + +WVDIAL_MAKE_ENV += $(TARGET_CONFIGURE_OPTS) \ + WVSTREAMS_INC="$(STAGING_DIR)/usr/include" \ + WVSTREAMS_LIB="$(STAGING_DIR)/usr/lib" + +define WVDIAL_BUILD_CMDS + $(TARGET_MAKE_ENV) $(WVDIAL_MAKE_ENV) $(WVDIAL_MAKE) -C $(@D) +endef + +define WVDIAL_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(WVDIAL_MAKE_ENV) $(WVDIAL_MAKE) \ + prefix="$(TARGET_DIR)/usr" PPPDIR="$(TARGET_DIR)/etc/ppp/peers" \ + install -C $(@D) +endef + +$(eval $(generic-package)) diff --git a/package/wvstreams/0001-fix-uClibc-compile-getcontext.patch b/package/wvstreams/0001-fix-uClibc-compile-getcontext.patch new file mode 100644 index 0000000000..c78cc1893c --- /dev/null +++ b/package/wvstreams/0001-fix-uClibc-compile-getcontext.patch @@ -0,0 +1,273 @@ +Fix wvstreams so that it builds with uClibc, which does not have the +getcontext() and setcontext() functions. + +Signed-off-by: Simon Dawson + +diff -Nurp a/include/wvtask.h b/include/wvtask.h +--- a/include/wvtask.h 2008-07-14 20:11:35.000000000 +0100 ++++ b/include/wvtask.h 2012-07-28 12:29:53.559981240 +0100 +@@ -28,6 +28,13 @@ + + #define WVTASK_MAGIC 0x123678 + ++#undef HAVE_GETCONTEXT ++#ifdef HAVE_GETCONTEXT ++typedef ucontext_t TaskContext; ++#else ++typedef jmp_buf TaskContext; ++#endif ++ + class WvTaskMan; + + /** Represents a single thread of control. */ +@@ -54,8 +61,8 @@ class WvTask + bool running, recycled; + + WvTaskMan &man; +- ucontext_t mystate; // used for resuming the task +- ucontext_t func_call, func_return; ++ TaskContext mystate; // used for resuming the task ++ TaskContext func_call, func_return; + + TaskFunc *func; + void *userdata; +@@ -94,13 +101,13 @@ class WvTaskMan + static void call_func(WvTask *task); + + static char *stacktop; +- static ucontext_t stackmaster_task; ++ static TaskContext stackmaster_task; + + static WvTask *stack_target; +- static ucontext_t get_stack_return; ++ static TaskContext get_stack_return; + + static WvTask *current_task; +- static ucontext_t toplevel; ++ static TaskContext toplevel; + + WvTaskMan(); + virtual ~WvTaskMan(); +diff -Nurp a/utils/wvtask.cc b/utils/wvtask.cc +--- a/utils/wvtask.cc 2009-05-13 22:42:52.000000000 +0100 ++++ b/utils/wvtask.cc 2012-07-28 12:32:23.855974538 +0100 +@@ -60,12 +60,14 @@ int WvTask::taskcount, WvTask::numtasks, + WvTaskMan *WvTaskMan::singleton; + int WvTaskMan::links, WvTaskMan::magic_number; + WvTaskList WvTaskMan::all_tasks, WvTaskMan::free_tasks; +-ucontext_t WvTaskMan::stackmaster_task, WvTaskMan::get_stack_return, ++TaskContext WvTaskMan::stackmaster_task, WvTaskMan::get_stack_return, + WvTaskMan::toplevel; + WvTask *WvTaskMan::current_task, *WvTaskMan::stack_target; + char *WvTaskMan::stacktop; + ++#ifdef HAVE_GETCONTEXT + static int context_return; ++#endif + + + static bool use_shared_stack() +@@ -198,9 +200,13 @@ WvTaskMan::WvTaskMan() + + stacktop = (char *)alloca(0); + ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(&get_stack_return) == 0); + if (context_return == 0) ++#else ++ if (setjmp(get_stack_return) == 0) ++#endif + { + // initial setup - start the stackmaster() task (never returns!) + stackmaster(); +@@ -257,22 +263,30 @@ int WvTaskMan::run(WvTask &task, int val + + WvTask *old_task = current_task; + current_task = &task; +- ucontext_t *state; ++ TaskContext *state; + + if (!old_task) + state = &toplevel; // top-level call (not in an actual task yet) + else + state = &old_task->mystate; + ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(state) == 0); + int newval = context_return; ++#else ++ int newval = setjmp(*state); ++#endif + if (newval == 0) + { + // saved the state, now run the task. ++#ifdef HAVE_GETCONTEXT + context_return = val; + setcontext(&task.mystate); + return -1; ++#else ++ longjmp(task.mystate, val); ++#endif + } + else + { +@@ -317,16 +331,24 @@ int WvTaskMan::yield(int val) + (long)current_task->stacksize); + } + #endif +- ++ ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(¤t_task->mystate) == 0); + int newval = context_return; ++#else ++ int newval = setjmp(current_task->mystate); ++#endif + if (newval == 0) + { + // saved the task state; now yield to the toplevel. ++#ifdef HAVE_GETCONTEXT + context_return = val; + setcontext(&toplevel); + return -1; ++#else ++ longjmp(toplevel, val); ++#endif + } + else + { +@@ -340,9 +362,13 @@ int WvTaskMan::yield(int val) + + void WvTaskMan::get_stack(WvTask &task, size_t size) + { ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(&get_stack_return) == 0); + if (context_return == 0) ++#else ++ if (setjmp(get_stack_return) == 0) ++#endif + { + assert(magic_number == -WVTASK_MAGIC); + assert(task.magic_number == WVTASK_MAGIC); +@@ -358,6 +384,7 @@ void WvTaskMan::get_stack(WvTask &task, + static char *next_stack_addr = NULL; + #endif + ++#ifndef HAVE_GETCONTEXT + task.stack = mmap(next_stack_addr, task.stacksize, + PROT_READ | PROT_WRITE, + #ifndef MACOS +@@ -366,12 +393,17 @@ void WvTaskMan::get_stack(WvTask &task, + MAP_PRIVATE, + #endif + -1, 0); ++#endif // !HAVE_GETCONTEXT + } + + // initial setup + stack_target = &task; ++#ifdef HAVE_GETCONTEXT + context_return = size/1024 + (size%1024 > 0); + setcontext(&stackmaster_task); ++#else ++ longjmp(stackmaster_task, size/1024 + (size%1024 > 0)); ++#endif + } + else + { +@@ -408,9 +440,13 @@ void WvTaskMan::_stackmaster() + { + assert(magic_number == -WVTASK_MAGIC); + ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(&stackmaster_task) == 0); + val = context_return; ++#else ++ val = setjmp(stackmaster_task); ++#endif + if (val == 0) + { + assert(magic_number == -WVTASK_MAGIC); +@@ -418,8 +454,12 @@ void WvTaskMan::_stackmaster() + // just did setjmp; save stackmaster's current state (with + // all current stack allocations) and go back to get_stack + // (or the constructor, if that's what called us) ++#ifdef HAVE_GETCONTEXT + context_return = 1; + setcontext(&get_stack_return); ++#else ++ longjmp(get_stack_return, 1); ++#endif + } + else + { +@@ -462,7 +502,9 @@ void WvTaskMan::call_func(WvTask *task) + task->func(task->userdata); + Dprintf("WvTaskMan: returning from task #%d (%s)\n", + task->tid, (const char *)task->name); ++#ifdef HAVE_GETCONTEXT + context_return = 1; ++#endif + } + + +@@ -473,9 +515,13 @@ void WvTaskMan::do_task() + assert(task->magic_number == WVTASK_MAGIC); + + // back here from longjmp; someone wants stack space. ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(&task->mystate) == 0); + if (context_return == 0) ++#else ++ if (setjmp(task->mystate) == 0) ++#endif + { + // done the setjmp; that means the target task now has + // a working jmp_buf all set up. Leave space on the stack +@@ -510,6 +556,7 @@ void WvTaskMan::do_task() + } + else + { ++#ifdef HAVE_GETCONTEXT + assert(getcontext(&task->func_call) == 0); + task->func_call.uc_stack.ss_size = task->stacksize; + task->func_call.uc_stack.ss_sp = task->stack; +@@ -519,11 +566,19 @@ void WvTaskMan::do_task() + task->tid, (const char *)task->name); + makecontext(&task->func_call, + (void (*)(void))call_func, 1, task); ++#else ++ assert(setjmp(task->func_call) == 0); ++#endif + ++#ifdef HAVE_GETCONTEXT + context_return = 0; + assert(getcontext(&task->func_return) == 0); + if (context_return == 0) + setcontext(&task->func_call); ++#else ++ if (setjmp(task->func_return) == 0) ++ longjmp(task->func_call, 0); ++#endif + } + + // the task's function terminated. +@@ -544,8 +599,12 @@ const void *WvTaskMan::current_top_of_st + if (use_shared_stack() || current_task == NULL) + return __libc_stack_end; + else ++#ifdef HAVE_GETCONTEXT + return (const char *)current_task->stack + current_task->stacksize; + #else ++ return 0; ++#endif ++#else + return 0; + #endif + } diff --git a/package/wvstreams/0002-fix-uClibc-compile-execinfo-backtrace.patch b/package/wvstreams/0002-fix-uClibc-compile-execinfo-backtrace.patch new file mode 100644 index 0000000000..c6317da4dc --- /dev/null +++ b/package/wvstreams/0002-fix-uClibc-compile-execinfo-backtrace.patch @@ -0,0 +1,31 @@ +Fix wvstreams so that it builds with uClibc: we don't have execinfo.h, +so we can't do backtrace() stuff. + +Signed-off-by: Simon Dawson + +diff -Nurp a/utils/wvcrash.cc b/utils/wvcrash.cc +--- a/utils/wvcrash.cc 2008-12-17 12:24:20.000000000 +0000 ++++ b/utils/wvcrash.cc 2012-07-27 22:00:15.456502262 +0100 +@@ -28,7 +28,9 @@ + // FIXME: this file mostly only works in Linux + #ifdef __linux + +-# include ++#ifdef HAVE_EXECINFO_H ++#include ++#endif + #include + + #ifdef __USE_GNU +@@ -267,9 +269,11 @@ static void wvcrash_real(int sig, int fd + } + } + ++#ifdef HAVE_EXECINFO_H + wr(fd, "\nBacktrace:\n"); + backtrace_symbols_fd(trace, + backtrace(trace, sizeof(trace)/sizeof(trace[0])), fd); ++#endif + + if (pid > 0) + { diff --git a/package/wvstreams/0003-fix-uClibc-compile-misc.patch b/package/wvstreams/0003-fix-uClibc-compile-misc.patch new file mode 100644 index 0000000000..690a961c12 --- /dev/null +++ b/package/wvstreams/0003-fix-uClibc-compile-misc.patch @@ -0,0 +1,16 @@ +Fix wvstreams so that it builds with uClibc: const cast problem. + +Signed-off-by: Simon Dawson + +diff -Nurp a/crypto/wvx509.cc b/crypto/wvx509.cc +--- a/crypto/wvx509.cc 2008-10-23 21:23:49.000000000 +0100 ++++ b/crypto/wvx509.cc 2012-06-15 18:45:06.605899292 +0100 +@@ -1157,7 +1157,7 @@ WvString WvX509::get_extension(int nid) + + if (ext) + { +- X509V3_EXT_METHOD *method = X509V3_EXT_get(ext); ++ X509V3_EXT_METHOD *method = const_cast(X509V3_EXT_get(ext)); + if (!method) + { + WvDynBuf buf; diff --git a/package/wvstreams/0004-build-fixes.patch b/package/wvstreams/0004-build-fixes.patch new file mode 100644 index 0000000000..21792d7422 --- /dev/null +++ b/package/wvstreams/0004-build-fixes.patch @@ -0,0 +1,40 @@ +Add missing includes for proper build on Linux/glibc + +The current wvstreams code doesn't build on Linux/glibc, with error +about chmod() not being available (for wvunixdgsocket.cc) or umask() +not being available (for wvatomicfile.cc). Those errors turn out to be +missing includes. Those includes were in fact already done, but +conditionally for MacOS. We make them unconditional (it probably +breaks other platforms, but since Buildroot is Linux only, we don't +care). + +Signed-off-by: Thomas Petazzoni + +Index: b/ipstreams/wvunixdgsocket.cc +=================================================================== +--- a/ipstreams/wvunixdgsocket.cc ++++ b/ipstreams/wvunixdgsocket.cc +@@ -1,8 +1,6 @@ + #include "wvunixdgsocket.h" +-#ifdef MACOS + #include + #include +-#endif + + WvUnixDGSocket::WvUnixDGSocket(WvStringParm filename, bool _server, int perms) + : socketfile(filename) +Index: b/streams/wvatomicfile.cc +=================================================================== +--- a/streams/wvatomicfile.cc ++++ b/streams/wvatomicfile.cc +@@ -10,10 +10,7 @@ + #include "wvatomicfile.h" + #include "wvfileutils.h" + #include "wvstrutils.h" +- +-#ifdef MACOS + #include +-#endif + + WvAtomicFile::WvAtomicFile(WvStringParm filename, int flags, mode_t create_mode) + : tmp_file(WvString::null) diff --git a/package/wvstreams/0005-getuid.patch b/package/wvstreams/0005-getuid.patch new file mode 100644 index 0000000000..60150665ce --- /dev/null +++ b/package/wvstreams/0005-getuid.patch @@ -0,0 +1,25 @@ +[PATCH] wvuid.cc: getuid needs sys/types.h + unistd.h + +Otherwise the build fails with: + +utils/wvuid.cc: In function 'wvuid_t wvgetuid()': +utils/wvuid.cc:63:19: error: 'getuid' was not declared in this scope + +Signed-off-by: Peter Korsgaard +--- + utils/wvuid.cc | 2 ++ + 1 file changed, 2 insertions(+) + +Index: wvstreams-4.6.1/utils/wvuid.cc +=================================================================== +--- wvstreams-4.6.1.orig/utils/wvuid.cc ++++ wvstreams-4.6.1/utils/wvuid.cc +@@ -33,6 +33,8 @@ + + #else // not WIN32 + ++#include ++#include + + WvString wv_username_from_uid(wvuid_t uid) + { diff --git a/package/wvstreams/Config.in b/package/wvstreams/Config.in new file mode 100644 index 0000000000..e2edd6d257 --- /dev/null +++ b/package/wvstreams/Config.in @@ -0,0 +1,17 @@ +config BR2_PACKAGE_WVSTREAMS + bool "wvstreams" + depends on BR2_INSTALL_LIBSTDCPP + depends on !BR2_STATIC_LIBS + depends on BR2_USE_MMU # fork() + # musl not supported and no upstream activity since 2011. + depends on !BR2_TOOLCHAIN_USES_MUSL + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_ZLIB + help + C++ Network Programming Library. + + http://wvstreams.googlecode.com/ + +comment "wvstreams needs a (e)glibc or uClibc toolchain w/ C++, dynamic library" + depends on BR2_USE_MMU + depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_MUSL diff --git a/package/wvstreams/wvstreams.mk b/package/wvstreams/wvstreams.mk new file mode 100644 index 0000000000..4d344e2834 --- /dev/null +++ b/package/wvstreams/wvstreams.mk @@ -0,0 +1,62 @@ +################################################################################ +# +# wvstreams +# +################################################################################ + +WVSTREAMS_VERSION = 4.6.1 +WVSTREAMS_SITE = http://wvstreams.googlecode.com/files +WVSTREAMS_DEPENDENCIES = openssl zlib host-pkgconf +WVSTREAMS_INSTALL_STAGING = YES + +WVSTREAMS_LICENSE = LGPLv2+ +WVSTREAMS_LICENSE_FILES = LICENSE + +# N.B. parallel make fails +WVSTREAMS_MAKE = $(MAKE1) + +# Needed to work around problem with wvassert.h +WVSTREAMS_CONF_OPTS += CPPFLAGS=-DNDEBUG + +WVSTREAMS_CONF_OPTS += \ + --with-openssl \ + --with-zlib \ + --without-pam \ + --disable-warnings \ + --without-tcl + +# needed for openssl detection when statically linking (as ssl needs lz) +WVSTREAMS_CONF_ENV += LIBS=-lz + +ifneq ($(BR2_STATIC_LIBS),y) +WVSTREAMS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -fPIC" +endif + +# wvstreams uses argp.h which can be provided by the argp-standalone +# package +ifeq ($(BR2_PACKAGE_ARGP_STANDALONE),y) +WVSTREAMS_DEPENDENCIES += argp-standalone +endif + +ifeq ($(BR2_PACKAGE_DBUS),y) +WVSTREAMS_DEPENDENCIES += dbus +WVSTREAMS_CONF_OPTS += --with-dbus +else +WVSTREAMS_CONF_OPTS += --without-dbus +endif + +ifeq ($(BR2_PACKAGE_QT),y) +WVSTREAMS_DEPENDENCIES += qt +WVSTREAMS_CONF_OPTS += --with-qt +else +WVSTREAMS_CONF_OPTS += --without-qt +endif + +ifeq ($(BR2_PACKAGE_VALGRIND),y) +WVSTREAMS_DEPENDENCIES += valgrind +WVSTREAMS_CONF_OPTS += --with-valgrind +else +WVSTREAMS_CONF_OPTS += --without-valgrind +endif + +$(eval $(autotools-package)) diff --git a/package/x11r7/xdriver_xf86-video-glint/0001-mbstring.patch b/package/x11r7/xdriver_xf86-video-glint/0001-mbstring.patch new file mode 100644 index 0000000000..635600abbf --- /dev/null +++ b/package/x11r7/xdriver_xf86-video-glint/0001-mbstring.patch @@ -0,0 +1,35 @@ +From 073d5b0b392781bf4a6aa7f9e2dbe2ae51caed2c Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 25 Sep 2012 12:54:38 +0000 +Subject: Remove mibstore.h + +Signed-off-by: Adam Jackson +--- +Fetch from: +http://cgit.freedesktop.org/xorg/driver/xf86-video-glint/commit/?id=073d5b0b392781bf4a6aa7f9e2dbe2ae51caed2c + +Signed-off-by: Bernd Kuhls + +diff --git a/src/glint_driver.c b/src/glint_driver.c +index b6d20a9..aa78516 100644 +--- a/src/glint_driver.c ++++ b/src/glint_driver.c +@@ -52,8 +52,6 @@ + #include "compiler.h" + #include "mipointer.h" + +-#include "mibstore.h" +- + #include "pm3_regs.h" + #include "glint_regs.h" + #include "IBM.h" +@@ -2904,7 +2902,6 @@ GLINTScreenInit(SCREEN_INIT_ARGS_DECL) + } + } + +- miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + +-- +cgit v0.9.0.2-2-gbebe diff --git a/package/x11r7/xdriver_xf86-video-imx-viv/0001-Remove-dix-internal-header-usage.patch b/package/x11r7/xdriver_xf86-video-imx-viv/0001-Remove-dix-internal-header-usage.patch new file mode 100644 index 0000000000..f146ba338c --- /dev/null +++ b/package/x11r7/xdriver_xf86-video-imx-viv/0001-Remove-dix-internal-header-usage.patch @@ -0,0 +1,31 @@ +From 80c419dddf6483873503d90694c4b4ae34ffa5e4 Mon Sep 17 00:00:00 2001 +From: Otavio Salvador +Date: Wed, 2 Dec 2015 13:50:57 +0000 +Subject: [PATCH] Remove 'dix' internal header usage +Organization: O.S. Systems Software LTDA. + +The 'swaprep.h' is an internal Xorg header and is not being installed +anymore. The swap features are provided by the 'misc.h' header now. + +Upstream-Status: Pending + +Signed-off-by: Otavio Salvador +--- + EXA/src/vivante_extension/vivante_ext.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/EXA/src/vivante_extension/vivante_ext.c b/EXA/src/vivante_extension/vivante_ext.c +index 0d1085b..1ffbb1b 100644 +--- a/EXA/src/vivante_extension/vivante_ext.c ++++ b/EXA/src/vivante_extension/vivante_ext.c +@@ -40,7 +40,6 @@ + #include "cursorstr.h" + #include "scrnintstr.h" + #include "servermd.h" +-#include "swaprep.h" + #include "drm.h" + #include "xf86Module.h" + #include "globals.h" +-- +2.1.4 + diff --git a/package/x11r7/xdriver_xf86-video-nv/0001-mibstore.patch b/package/x11r7/xdriver_xf86-video-nv/0001-mibstore.patch new file mode 100644 index 0000000000..e71418bc9e --- /dev/null +++ b/package/x11r7/xdriver_xf86-video-nv/0001-mibstore.patch @@ -0,0 +1,86 @@ +From fc78fe98222b0204b8a2872a529763d6fe5048da Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 25 Sep 2012 12:54:49 +0000 +Subject: Remove mibstore.h + +Signed-off-by: Adam Jackson +--- +Fetch from: +http://cgit.freedesktop.org/xorg/driver/xf86-video-nv/commit/?id=fc78fe98222b0204b8a2872a529763d6fe5048da + +Signed-off-by: Bernd Kuhls + +diff --git a/src/g80_driver.c b/src/g80_driver.c +index cc4e197..719b96c 100644 +--- a/src/g80_driver.c ++++ b/src/g80_driver.c +@@ -34,7 +34,6 @@ + #include + #endif + #include +-#include + #include + #include + #include +@@ -833,7 +832,6 @@ G80ScreenInit(SCREEN_INIT_ARGS_DECL) + } + } + +- miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + +diff --git a/src/nv_driver.c b/src/nv_driver.c +index 6dad6e5..8f35334 100644 +--- a/src/nv_driver.c ++++ b/src/nv_driver.c +@@ -2550,7 +2550,6 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL) + if (!pNv->NoAccel) + NVAccelInit(pScreen); + +- miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + +diff --git a/src/nv_include.h b/src/nv_include.h +index fb190bf..f174eef 100644 +--- a/src/nv_include.h ++++ b/src/nv_include.h +@@ -24,9 +24,6 @@ + /* All drivers initialising the SW cursor need this */ + #include "mipointer.h" + +-/* All drivers implementing backing store need this */ +-#include "mibstore.h" +- + #include "micmap.h" + + #include "xf86DDC.h" +diff --git a/src/riva_driver.c b/src/riva_driver.c +index e0667ef..759501e 100644 +--- a/src/riva_driver.c ++++ b/src/riva_driver.c +@@ -1168,7 +1168,6 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL) + if (!pRiva->NoAccel) + RivaAccelInit(pScreen); + +- miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + +diff --git a/src/riva_include.h b/src/riva_include.h +index f2c5302..c7aeef7 100644 +--- a/src/riva_include.h ++++ b/src/riva_include.h +@@ -22,9 +22,6 @@ + /* All drivers initialising the SW cursor need this */ + #include "mipointer.h" + +-/* All drivers implementing backing store need this */ +-#include "mibstore.h" +- + #include "micmap.h" + + #include "xf86DDC.h" +-- +cgit v0.9.0.2-2-gbebe diff --git a/package/x11r7/xdriver_xf86-video-sis/0007-xi.patch b/package/x11r7/xdriver_xf86-video-sis/0007-xi.patch new file mode 100644 index 0000000000..7905248163 --- /dev/null +++ b/package/x11r7/xdriver_xf86-video-sis/0007-xi.patch @@ -0,0 +1,24 @@ +Fetch from: +https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/xf86-video-sis&id=7aaa7a9786ce5654df877311909244e0a6c42fd1 + +Signed-off-by: Bernd Kuhls + +--- xf86-video-sis-0.10.7/src/sis_driver.c 2013-03-10 13:57:50.000000000 +0100 ++++ xf86-video-sis-0.10.7/src/sis_driver.c.new 2013-03-10 13:54:48.645203559 +0100 +@@ -9378,7 +9378,15 @@ + } + if(doit) { + sigstate = xf86BlockSIGIO(); +-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 15 ++#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 18 ++ { ++ double dx = x, dy = y; ++ miPointerSetPosition(inputInfo.pointer, Absolute, &dx, &dy, ++ NULL, NULL); ++ x = (int)dx; ++ y = (int)dy; ++ } ++#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 15 + { + double dx = x, dy = y; + miPointerSetPosition(inputInfo.pointer, Absolute, &dx, &dy); diff --git a/package/x11r7/xlib_libXfixes/0001-remove-fallback-for-xeatdatawords.patch b/package/x11r7/xlib_libXfixes/0001-remove-fallback-for-xeatdatawords.patch new file mode 100644 index 0000000000..cb8c5780a2 --- /dev/null +++ b/package/x11r7/xlib_libXfixes/0001-remove-fallback-for-xeatdatawords.patch @@ -0,0 +1,63 @@ +From 1702cdfe45c9bdd7dacfc8f27a49f89fcd1d02c3 Mon Sep 17 00:00:00 2001 +From: Michael Joost +Date: Mon, 18 Nov 2013 16:11:26 +0100 +Subject: Remove fallback for _XEatDataWords, require libX11 1.6 for it + +_XEatDataWords was orignally introduced with the May 2013 security +patches, and in order to ease the process of delivering those, +fallback versions of _XEatDataWords were included in the X extension +library patches so they could be applied to older versions that didn't +have libX11 1.6 yet. Now that we're past that hurdle, we can drop +the fallbacks and just require libX11 1.6 for building new versions +of the extension libraries. + +Reviewed-by: Alan Coopersmith +Signed-off-by: Alan Coopersmith +Signed-off-by: Bernd Kuhls +(downloaded from upstream commit: + https://cgit.freedesktop.org/xorg/lib/libXfixes/commit/?id=1702cdfe45c9bdd7dacfc8f27a49f89fcd1d02c3) +diff --git a/configure.ac b/configure.ac +index f85bd72..2a59af8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -55,13 +55,7 @@ FIXESEXT_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'` + AC_SUBST(FIXESEXT_VERSION) + + # Obtain compiler/linker options for depedencies +-PKG_CHECK_MODULES(FIXESEXT, xproto [fixesproto >= $FIXESEXT_VERSION] xextproto x11) +- +-# Check for _XEatDataWords function that may be patched into older Xlib releases +-SAVE_LIBS="$LIBS" +-LIBS="$FIXESEXT_LIBS" +-AC_CHECK_FUNCS([_XEatDataWords]) +-LIBS="$SAVE_LIBS" ++PKG_CHECK_MODULES(FIXESEXT, xproto [fixesproto >= $FIXESEXT_VERSION] xextproto [x11 >= 1.6]) + + + AC_CONFIG_FILES([Makefile +diff --git a/src/Xfixesint.h b/src/Xfixesint.h +index 7bf5bfd..8a4d5fd 100644 +--- a/src/Xfixesint.h ++++ b/src/Xfixesint.h +@@ -60,18 +60,4 @@ XFixesFindDisplay (Display *dpy); + #define XFixesSimpleCheckExtension(dpy,i) \ + if (!XFixesHasExtension(i)) { return; } + +-#ifndef HAVE__XEATDATAWORDS +-#include /* for LONG64 on 64-bit platforms */ +-#include +- +-static inline void _XEatDataWords(Display *dpy, unsigned long n) +-{ +-# ifndef LONG64 +- if (n >= (ULONG_MAX >> 2)) +- _XIOError(dpy); +-# endif +- _XEatData (dpy, n << 2); +-} +-#endif +- + #endif /* _XFIXESINT_H_ */ +-- +cgit v0.10.2 + diff --git a/package/x11r7/xserver_xorg-server/0001-modesettings-needs-dri2.patch b/package/x11r7/xserver_xorg-server/0001-modesettings-needs-dri2.patch new file mode 100644 index 0000000000..4ef95efc3e --- /dev/null +++ b/package/x11r7/xserver_xorg-server/0001-modesettings-needs-dri2.patch @@ -0,0 +1,19 @@ +Kernel modesettings support also depends on dri2, see +http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/drivers/modesetting/Makefile.am#n46 + +Patch sent upstream: https://bugs.freedesktop.org/show_bug.cgi?id=91584 + +Signed-off-by: Bernd Kuhls + +diff -uNr xorg-server-1.17.2.org/configure.ac xorg-server-1.17.2/configure.ac +--- xorg-server-1.17.2.org/configure.ac 2015-06-16 17:42:40.000000000 +0200 ++++ xorg-server-1.17.2/configure.ac 2015-08-08 10:44:59.702382624 +0200 +@@ -2036,7 +2036,7 @@ + XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS" + fi + +- if test "x$DRM" = xyes; then ++ if test "x$DRM" = xyes -a "x$DRI2" = xyes; then + dnl 2.4.46 is required for cursor hotspot support. + PKG_CHECK_EXISTS(libdrm >= 2.4.46) + XORG_DRIVER_MODESETTING=yes diff --git a/package/xfsprogs/0002-no-crc32-checks.patch b/package/xfsprogs/0002-no-crc32-checks.patch new file mode 100644 index 0000000000..6f97092475 --- /dev/null +++ b/package/xfsprogs/0002-no-crc32-checks.patch @@ -0,0 +1,32 @@ +libxfs: do not try to run the crc32selftest + +Even though the crc32selftest is natively compiled (because it is to be +executed), it fails in cross-compilation as the host may lack the +required headers, like uuid/uuid.h (e.g. in a minimal environment). + +Moreover, running the crc32selftest natively is completely wrong, +because it passing on the host does not mean it would still pass n the +target (because endianness or bitness or alignment differences). + +So, just disable running the crc32selftest altogether. + +Note that there's a remaining bug-in-hiding, because the crc32 table +generator is natively built, but with the target CFLAGS. + +Signed-off-by: "Yann E. MORIN" + +diff -durN xfsprogs-4.3.0.orig/libxfs/Makefile xfsprogs-4.3.0/libxfs/Makefile +--- xfsprogs-4.3.0.orig/libxfs/Makefile 2015-09-22 03:42:41.000000000 +0200 ++++ xfsprogs-4.3.0/libxfs/Makefile 2015-12-07 18:45:27.190082913 +0100 +@@ -105,9 +105,9 @@ + # don't try linking xfs_repair with a debug libxfs. + DEBUG = -DNDEBUG + +-LDIRT = gen_crc32table crc32table.h crc32selftest ++LDIRT = gen_crc32table crc32table.h + +-default: crc32selftest ltdepend $(LTLIBRARY) ++default: ltdepend $(LTLIBRARY) + + crc32table.h: gen_crc32table.c + @echo " [CC] gen_crc32table" diff --git a/package/xl2tp/0002-musl.patch b/package/xl2tp/0002-musl.patch new file mode 100644 index 0000000000..44238e87d0 --- /dev/null +++ b/package/xl2tp/0002-musl.patch @@ -0,0 +1,19 @@ +Fix musl build + +Downloaded from +http://git.alpinelinux.org/cgit/aports/tree/main/xl2tpd/xl2tpd-compile.patch + +Signed-off-by: Bernd Kuhls + +diff -u --recursive src.orig/xl2tpd-1.3.6/xl2tpd.c src/xl2tpd-1.3.6/xl2tpd.c +--- xl2tpd-1.3.6.orig/xl2tpd.c 2014-01-15 21:58:37.000000000 -0100 ++++ xl2tpd-1.3.6/xl2tpd.c 2014-06-21 07:22:21.195278618 -0200 +@@ -33,8 +33,6 @@ + #if (__GLIBC__ < 2) + # if defined(FREEBSD) || defined(OPENBSD) + # include +-# elif defined(LINUX) +-# include + # elif defined(SOLARIS) + # include + # endif diff --git a/package/xmlstarlet/0001-Fix-static-linking-problem-with-libgcrypt.patch b/package/xmlstarlet/0001-Fix-static-linking-problem-with-libgcrypt.patch new file mode 100644 index 0000000000..ea54c983a2 --- /dev/null +++ b/package/xmlstarlet/0001-Fix-static-linking-problem-with-libgcrypt.patch @@ -0,0 +1,46 @@ +From 8cee09b59a8c1ff2ebfc8c46097825d2eafdc4dd Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 16 May 2015 17:32:13 +0200 +Subject: [PATCH] Fix static linking problem with libgcrypt + +When libgcrypt is used, it is linked with libgpg-error, so we should +also test that libgpg-error is available, and include -lgpg-error in +the LIBS variable. + +This fixes build issues like: + + CCLD xml +/home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libexslt.a(crypto.o): In function `_exsltCryptoGcryptInit': +crypto.c:(.text+0x112): undefined reference to `_gcry_check_version' +/home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libexslt.a(crypto.o): In function `_exsltCryptoRc4DecryptFunction': +crypto.c:(.text+0x316): undefined reference to `_gcry_cipher_open' +crypto.c:(.text+0x32a): undefined reference to `_gcry_strerror' +crypto.c:(.text+0x34c): undefined reference to `_gcry_cipher_setkey' + +Which are caused by the AC_SEARCH_LIBS() test for libgcrypt to fail +due to -lgpg-error not been present in the LIBS variable. + +Note that using PKG_CHECK_MODULES() would be a much much better +replacement than this complicated handling of static libraries, but +it's a much more significant effort. + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configure.ac b/configure.ac +index 4db0129..e378996 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -125,6 +125,7 @@ AS_IF([test "x$STATIC_LIBS" != xno], + [AC_SEARCH_LIBS([libiconv_open], [iconv], [], [], "$USER_LIBS")], "$USER_LIBS") + AC_SEARCH_LIBS([clock_gettime], [rt], [], [], "$USER_LIBS") + AC_SEARCH_LIBS([deflate], [z], [], [], "$USER_LIBS") ++ AC_SEARCH_LIBS([gpg_strerror], [gpg-error], [], [], "$USER_LIBS") + AC_SEARCH_LIBS([gcry_cipher_encrypt], [gcrypt], [], [], "$USER_LIBS") + + # Checks for inet libraries: +-- +2.1.0 + diff --git a/package/zsh/0001-configure-use-user-set-pcre-config.patch b/package/zsh/0001-configure-use-user-set-pcre-config.patch new file mode 100644 index 0000000000..d4cf59bddd --- /dev/null +++ b/package/zsh/0001-configure-use-user-set-pcre-config.patch @@ -0,0 +1,33 @@ +From: Baruch Siach +Date: Thu, 3 Mar 2016 23:14:39 +0200 +Subject: [PATCH] configure: use user set pcre-config + +Setting a non default configuration script location is common practice when +cross compiling, since the target library might need different flags. zsh +configure scripts allows the user to set pcre-config location but doesn't +actually use it. Fix this. + +Signed-off-by: Baruch Siach +--- +Patch status: sent upstream +(http://www.zsh.org/mla/workers/2016/msg00619.html) + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index c3bd713c126a..9947b16066b6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -925,7 +925,7 @@ fi + if test x$enable_pcre = xyes; then + dnl pcre-config should probably be employed here + dnl AC_SEARCH_LIBS(pcre_compile, pcre) +- LIBS="`pcre-config --libs` $LIBS" ++ LIBS="`$ac_cv_prog_PCRECONF --libs` $LIBS" + fi + + dnl --------------------- +-- +2.7.0 +