# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../dietlibc/ppc-static-ctor-dtor.patch # Copyright (C) 2004 - 2018 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or 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. # --- T2-COPYRIGHT-NOTE-END --- We build dietlibc with WANT_DYNAMIC so we get ctor/dtor handling, even for static programs, as normally needed. The patch zeros register 6 passed for dl_init to _dyn_start since otherwise we end up in an inf. loop calling the _dyn_start (where r6 points to) again and again ... This is NOT intended for upstream merge - just a quick hack to get it working. For ppc64 it is not an inf. loop but segfault on exit due invalid pointed in the atexit array. - Rene Rebe diff -u dietlibc-0.28/ppc/start.S dietlibc-0.28-fixed/ppc/start.S --- dietlibc-0.28/ppc/start.S 2004-09-11 14:37:57.000000000 +0200 +++ dietlibc-0.28-fixed/ppc/start.S 2005-05-03 23:47:09.000000000 +0200 @@ -27,7 +29,7 @@ stw 5,environ@l(14) #ifdef WANT_DYNAMIC - mr 6,7 + xor 6,6,6 bl _dyn_start #else #ifdef WANT_STACKGAP --- dietlibc-0.34/ppc64/start.S.orig 2018-10-23 12:23:43.397399098 +0000 +++ dietlibc-0.34/ppc64/start.S 2018-10-23 12:26:19.301396754 +0000 @@ -71,7 +71,8 @@ #ifdef WANT_DYNAMIC /* #warning dynamic */ - mr 6,7 + xor 6,6,6 +#warning dynamic /* This has not been tested on ppc64le yet... */ bl FN_NAME_DOTIFY(_dyn_start) #else