Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build with clang on OSX #62

Open
wants to merge 2 commits into
base: master-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 69 additions & 68 deletions Makefile

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions llvm-2.9/include/llvm/Support/CFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class PredIterator : public std::iterator<std::forward_iterator_tag,
}

public:
typedef typename super::pointer pointer;
typedef Ptr*& reference;
typedef Ptr* pointer;

PredIterator() {}
explicit inline PredIterator(Ptr *bb) : It(bb->use_begin()) {
Expand Down Expand Up @@ -105,7 +106,8 @@ class SuccIterator : public std::iterator<std::bidirectional_iterator_tag,
}

public:
typedef typename super::pointer pointer;
typedef BB_*& reference;
typedef BB_* pointer;
// TODO: This can be random access iterator, only operator[] missing.

explicit inline SuccIterator(Term_ T) : Term(T), idx(0) {// begin iterator
Expand Down
1 change: 1 addition & 0 deletions llvm-2.9/tools/clang/include/clang/AST/StmtIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cassert>
#include <cstddef>
#include <iterator>
#include <utility>

namespace clang {

Expand Down
2 changes: 1 addition & 1 deletion llvm-gcc-4.2-2.9/gcc/toplev.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ read_integral_parameter (const char *p, const char *pname, const int defval)
for floor_log2 and exact_log2; see toplev.h. That construct, however,
conflicts with the ISO C++ One Definition Rule. */

#if GCC_VERSION < 3004 || !defined (__cplusplus)
#if (GCC_VERSION < 3004 || !defined (__cplusplus)) && (__STDC_VERSION__ < 199901L)

/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
If X is 0, return -1. */
Expand Down
16 changes: 16 additions & 0 deletions llvm-gcc-4.2-2.9/gcc/toplev.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ extern void decode_d_option (const char *);
/* Return true iff flags are set as if -ffast-math. */
extern bool fast_math_flags_set_p (void);

#if __STDC_VERSION__ < 199901L
/* Return log2, or -1 if not exact. */
extern int exact_log2 (unsigned HOST_WIDE_INT);

/* Return floor of log2, with -1 for zero. */
extern int floor_log2 (unsigned HOST_WIDE_INT);
#endif /* __STDC_VERSION__ < 199901L */

/* Inline versions of the above for speed. */
#if GCC_VERSION >= 3004
Expand All @@ -176,6 +178,7 @@ extern int floor_log2 (unsigned HOST_WIDE_INT);
# define CTZ_HWI __builtin_ctz
# endif

#if __STDC_VERSION__ < 199901L
extern inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
Expand All @@ -187,6 +190,19 @@ exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
}
#else
static inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
}

static inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
}
#endif /* __STDC_VERSION__ < 199901L */
#endif /* GCC_VERSION >= 3004 */

/* Functions used to get and set GCC's notion of in what directory
Expand Down
Binary file removed packages/pkg-config-0.26.tar.gz
Binary file not shown.
Binary file added packages/pkg-config-0.28.tar.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions patches/avmplus-master/build/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def __init__(self, topsrcdir, options=None, sourcefile=None, objdir=None,
# Hackery! Make assumptions that we want to build with GCC 3.3 on MacPPC
# and GCC4 on MacIntel
elif self._target[0] == 'darwin':
if options.getBoolArg("clang", False):
self._compiler = 'clang'
self._acvars.update({
'DLL_SUFFIX' : 'dylib',
'CPPFLAGS' : '-pipe',
Expand Down
25 changes: 24 additions & 1 deletion patches/avmplus-master/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,27 @@ def _setGCCVersionedFlags(FLAGS, MAJOR_VERSION, MINOR_VERSION, current_cpu):
APP_CXXFLAGS = "-template=no%extdef -erroff"
OPT_CXXFLAGS = "-xO2 "
DEBUG_CXXFLAGS += "-g "
elif config.getCompiler() == 'clang':
APP_CXXFLAGS += "-Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winit-self -Winvalid-pch -Wno-invalid-offsetof -Wno-switch "\
"-Wparentheses -Wpointer-arith -Wreorder -Wsign-compare -Wunused-parameter -Wwrite-strings -Wno-ctor-dtor-privacy -Woverloaded-virtual "\
"-Wsign-promo -Wno-char-subscripts -fmessage-length=0 -fno-exceptions -fno-rtti -fstrict-aliasing -fsigned-char "

FLOAT_ABI = None;
EXTRA_CFLAGS = "";
if EXTRA_CFLAGS != None:
APP_CXXFLAGS += EXTRA_CFLAGS
APP_CFLAGS += EXTRA_CFLAGS
if FLOAT_ABI != None:
APP_CXXFLAGS += FLOAT_ABI
APP_CFLAGS += FLOAT_ABI
AVMSHELL_LDFLAGS += FLOAT_ABI

if config.getDebug():
APP_CXXFLAGS += ""
else:
APP_CXXFLAGS += "-Wuninitialized "
DEBUG_CXXFLAGS += "-g "
DEBUG_LDFLAGS += "-g "
else:
raise Exception('Unrecognized compiler: ' + config.getCompiler())

Expand Down Expand Up @@ -445,7 +466,9 @@ def _setGCCVersionedFlags(FLAGS, MAJOR_VERSION, MINOR_VERSION, current_cpu):
'_MAC': None,
'AVMPLUS_MAC': None,
'TARGET_RT_MAC_MACHO': 1})
APP_CXXFLAGS += "-fpascal-strings -faltivec -fasm-blocks "
APP_CXXFLAGS += "-fpascal-strings -fasm-blocks "
if config.getCompiler() != 'clang':
APP_CXXFLAGS += "-faltivec "

# If an sdk is selected align OS and gcc/g++ versions to it
os_ver,sdk_path = _setSDKParams(o.mac_sdk, os_ver, o.mac_xcode)
Expand Down
2 changes: 1 addition & 1 deletion patches/gdb-7.3/bfd/cpu-avm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,

case BFD_RELOC_386_IRELATIVE:
TRACE ("BFD_RELOC_386_IRELATIVE");
return &elf_howto_table[R_386_IRELATIVE];
return &elf_howto_table[R_386_IRELATIVE - R_386_tls_offset];

case BFD_RELOC_VTABLE_INHERIT:
TRACE ("BFD_RELOC_VTABLE_INHERIT");
Expand Down
Loading