summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/inifile.cc4
-rw-r--r--base/intmath.hh14
-rw-r--r--base/loader/elf_object.cc5
-rw-r--r--base/stats/text.cc4
4 files changed, 23 insertions, 4 deletions
diff --git a/base/inifile.cc b/base/inifile.cc
index c12b25030..7f6a42dd6 100644
--- a/base/inifile.cc
+++ b/base/inifile.cc
@@ -35,7 +35,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) || defined(__APPLE__)
#include <libgen.h>
#endif
#include <stdio.h>
@@ -146,7 +146,7 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
execvp("g++", args);
- exit(1);
+ exit(0);
}
int retval;
diff --git a/base/intmath.hh b/base/intmath.hh
index cb5a34107..fc28eecef 100644
--- a/base/intmath.hh
+++ b/base/intmath.hh
@@ -119,6 +119,20 @@ FloorLog2(int64_t x)
return FloorLog2((uint64_t)x);
}
+inline int
+FloorLog2(size_t x)
+{
+ assert(x > 0);
+ assert(sizeof(size_t) == 4 || sizeof(size_t) == 8);
+
+ // It's my hope that this is optimized away?
+ if (sizeof(size_t) == 4)
+ return FloorLog2((uint32_t)x);
+ else if (sizeof(size_t) == 8)
+ return FloorLog2((uint64_t)x);
+
+}
+
template <class T>
inline int
CeilLog2(T n)
diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc
index 036363995..b8f46449a 100644
--- a/base/loader/elf_object.cc
+++ b/base/loader/elf_object.cc
@@ -74,8 +74,9 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
else {
if (ehdr.e_ident[EI_CLASS] == ELFCLASS32)
panic("32 bit ELF Binary, Not Supported");
- if (ehdr.e_machine != EM_ALPHA)
- panic("Non Alpha Binary, Not Supported");
+ printf("emachine = %x\n", ehdr.e_machine);
+// if (ehdr.e_machine != EM_ALPHA)
+// panic("Non Alpha Binary, Not Supported");
elf_end(elf);
diff --git a/base/stats/text.cc b/base/stats/text.cc
index 6e80c26d6..f7e82a30f 100644
--- a/base/stats/text.cc
+++ b/base/stats/text.cc
@@ -26,6 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if defined(__APPLE__)
+#define _GLIBCPP_USE_C99 1
+#endif
+
#include <iostream>
#include <fstream>
#include <string>