Skip to content

Instantly share code, notes, and snippets.

View jroelofs's full-sized avatar

Jon Roelofs jroelofs

View GitHub Profile
@jroelofs
jroelofs / gist:e0562ebf40d83ab6dd5e
Last active August 29, 2015 14:01
-fintegrated-as vs -fno-integrated-as bug
[15:00:32] ✘ jroelofs@build1-lucid-cs arm-none-eabi-lite$ cat foobar.c
#if defined(MACRO_OUTSIDE)
asm(
".macro RETURN cond=\n\t"
"bx\\cond lr\n\t"
".endm\n\t"
);
#endif
char* __attribute__((naked))
@jroelofs
jroelofs / gist:3659bed8c1a7751bc5dc
Last active August 29, 2015 14:02
CLANG: objdump of libcxx/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp built with -Os
rv_value.pass.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <main>:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@jroelofs
jroelofs / gist:dbcdbd23f1c1e7a5f539
Created June 17, 2014 17:11
-ffreestanding memcpy for copy-ctors
$ cat copy_ctor.cpp
struct Foo {
char big[10240];
};
Foo fooCopy(const Foo * const in) {
return Foo(*in);
}
$ ./clang++ -target arm-none-eabi copy_ctor.cpp -c
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 209242)
+++ lib/Basic/Targets.cpp (working copy)
@@ -3751,7 +3751,8 @@
if (!T.isOSLinux() &&
T.getOS() != llvm::Triple::FreeBSD &&
T.getOS() != llvm::Triple::NetBSD &&
- T.getOS() != llvm::Triple::Bitrig)
#include <stdio.h>
int main() {
int Cpsr = 0x40000173;
int armflag_N = (Cpsr >> 31) & 1;
int armflag_Z = (Cpsr >> 30) & 1;
int armflag_C = (Cpsr >> 29) & 1;
int armflag_V = (Cpsr >> 28) & 1;
commit ab92dc0425517575ae49f4771516da15806ffb1a
Author: Jonathan Roelofs <jonathan@codesourcery.com>
Date: Tue Jun 3 12:11:40 2014 -0600
Fix awkward macro clash with newlib
diff --git a/sources/cxx-stl/llvm-libc++/libcxx/include/cmath b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath
index 964c672..d6897f4 100644
--- a/sources/cxx-stl/llvm-libc++/libcxx/include/cmath
+++ b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath
diff --git a/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp b/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
index baa97a7..a30dfdd 100644
--- a/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
+++ b/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
@@ -463,6 +463,7 @@ restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
MachineInstrBuilder MIB = BuildMI(MF, DL, TII.get(ARM::tPOP));
AddDefaultPred(MIB);
+ bool IsReturn = false;
bool NumRegs = false;
commit 0cb5f0beda174e9fae584b90c940d443cfa89a8e
Author: Jonathan Roelofs <jonathan@codesourcery.com>
Date: Thu Aug 14 12:59:50 2014 -0600
[libcxx] Newlib's isprint mask isn't a single bit. Test masking appropriately.
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index d0819ee..4256419 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
commit c77d06fe25dbaf137083db2eb2a590ea5f72d4c9
Author: Jonathan Roelofs <jonathan@codesourcery.com>
Date: Thu Aug 14 11:38:18 2014 -0600
[libcxx] Fix diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp
index d5cb2d4..96a9736 100644
--- a/libcxx/src/system_error.cpp
+++ b/libcxx/src/system_error.cpp
commit 65481e4038c37dc63d068889903640423e5782d4
Author: Jonathan Roelofs <jonathan@codesourcery.com>
Date: Thu Aug 14 11:39:23 2014 -0600
[libcxx] Add Newlib's version of ELAST to libcxx/src/ios.cpp
diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp
index a762a07..c1f83e0 100644
--- a/libcxx/src/ios.cpp
+++ b/libcxx/src/ios.cpp