Skip to content

Instantly share code, notes, and snippets.

View NattyNarwhal's full-sized avatar
🐪
ML stands for metalanguage, not machine learning

Calvin Buckley NattyNarwhal

🐪
ML stands for metalanguage, not machine learning
View GitHub Profile
bash-4.4$ truss -a -f -t kfork,execve,_exit /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../mono -I../../mono/eglib -I../../mono/eglib -fvisibility=hidden -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -Wno-format-zero-length -maix64 -DGC_AIX_THREADS -D_ALL_SOURCE -D_THREAD_SAFE -D_LARGE_FILES -D_REENTRANT -g -D__mono_ppc__ -D__mono_ppc64__ -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -Wno-format-zero-length -g -O2 -std=gnu99 -fno-strict-aliasing -fwrapv -DMONO_DLL_EXPORT -Wno-unused-but-set-variable -g -mminimal-toc -Werror-implicit-function-declaration -MT libmonoutils_la-networking-fallback.lo -M
@NattyNarwhal
NattyNarwhal / gist:5e6dc925ef0056b08564f109ba9219f1
Created June 30, 2018 02:08
Profiling oksh build with gcc options
aix$ gmake
gcc -Q -ftime-report -DEMACS -DVI -w -D_ALL_SOURCE -c -o alloc.o alloc.c
strtold strtoimax select getdtablesize ainit afreeall alloc areallocarray aresize afree
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <build_ssa_passes> <opt_local_passes> <free-inline-summary> <whole-program> <cdtor> <targetclone> <inline>Assembling functions:
<dispachercalls> strtold strtoimax select getdtablesize ainit afreeall alloc areallocarray aresize afree
Execution times (seconds)
phase setup : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 8%) wall 777 kB (28%) ggc
phase parsing : 0.03 (75%) usr 0.02 (100%) sys 0.09 (69%) wall 1573 kB (56%) ggc
@NattyNarwhal
NattyNarwhal / initial-work.diff
Created June 28, 2018 20:33
Initial work for Mono AOT on AIX
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index c5648e9..bab5949 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -948,6 +948,11 @@ emit_code_bytes (MonoAotCompile *acfg, const guint8* buf, int size)
#define EMIT_WIN32_CODEVIEW_INFO
#endif
+#ifdef _AIX
+#undef EMIT_DWARF_INFO
aix$ ldd src/.libs/libgdiplus.so.0
src/.libs/libgdiplus.so.0 needs:
/opt/freeware/lib/libgcc_s.a(shr.o)
/opt/freeware/lib/libglib-2.0.a(libglib-2.0.so.0)
/usr/lib/libc.a(shr_64.o)
/opt/freeware/lib/libcairo.a(libcairo.so.2)
/opt/freeware/lib/libfontconfig.a(libfontconfig.so.1)
/opt/freeware/lib/libfreetype.a(libfreetype.so.6)
/usr/lib/libX11.a(shr_64.o)
/opt/freeware/lib/libjpeg.a(libjpeg.so.9)
@NattyNarwhal
NattyNarwhal / getprocs64-enumeration-test.c
Created June 15, 2018 15:02
Enumerating processes on AIX with the getprocs64 function
#include <stdio.h>
#include <stdlib.h>
#include <procinfo.h>
#include <sys/types.h>
int main(void) {
struct procentry64 *procs;
pid_t pid;
int count, ret, pes, i;
@NattyNarwhal
NattyNarwhal / diff.diff
Created June 12, 2018 02:48
Mono CoreFX PAL patch for feld
diff --git a/src/Native/Unix/System.Native/pal_io.c b/src/Native/Unix/System.Native/pal_io.c
index acb0097347..df9cd45318 100644
--- a/src/Native/Unix/System.Native/pal_io.c
+++ b/src/Native/Unix/System.Native/pal_io.c
@@ -5,6 +5,9 @@
#ifdef _AIX
// For getline (declare this before stdio)
#define _GETDELIM 1
+#elif __FreeBSD__
+// Similar to AIX, FreeBSD needs a definition too.
static int Fail(string msg, int code = 1)
{
Console.Error.WriteLine(msg);
return code;
}
static int Main(string[] args)
{
var outFile = args.Last();
args = args.Take(args.Length - 1).ToArray();
@NattyNarwhal
NattyNarwhal / index.c
Created June 6, 2018 19:27
Attempt at if_nameindex and SIOCGIFADDR based enumeration, standalone
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdlib.h>
#include <unistd.h>
@NattyNarwhal
NattyNarwhal / siocgifconf.frag.c
Created June 6, 2018 18:50
Try 3 of PAL networking hack
// Works on AIX, but doesn't on i because ifr_name is NOT THE DEVICE NAME ON i!
// On i, ifr_name returns the IP address; if_nameindex returns the real OS/400
// names, but SIOCGIFCONF won't, and thus we need a new way to enumerate...
#elif HAVE_SIOCGIFCONF
// Adapted from Mono's networking-posix.c.
packetInfo->InterfaceIndex = 0;
struct ifconf ifc;
struct ifreq *ifr;
int fd;
@NattyNarwhal
NattyNarwhal / test.c
Last active June 1, 2018 20:47
Fragment: SIOCGIFCONF based fallback for pal_networking.c
#elif HAVE_SIOCGIFCONF
// Adapted from Mono's networking-posix.c.
packetInfo->InterfaceIndex = 0;
int fd;
struct ifconf ifc;
struct ifreq *ifr;
int32_t if_count = 0;
fd = socket (AF_INET, SOCK_STREAM, 0);