Add Fuchsia SDK.

Bug: 120856007
Test: Build walleye.
Change-Id: I6b5ebe9bff4e729783bca67d35c291878fbe16cb
diff --git a/pkg/fidl/builder.cpp b/pkg/fidl/builder.cpp
new file mode 100644
index 0000000..476b7ee
--- /dev/null
+++ b/pkg/fidl/builder.cpp
@@ -0,0 +1,62 @@
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <lib/fidl/cpp/builder.h>
+
+#include <string.h>
+
+#include <lib/fidl/internal.h>
+
+namespace fidl {
+
+Builder::Builder()
+    : capacity_(0u), at_(0u), buffer_(nullptr) {}
+
+Builder::Builder(void* buffer, uint32_t capacity)
+    : capacity_(capacity), at_(0u), buffer_(static_cast<uint8_t*>(buffer)) {
+}
+
+Builder::~Builder() = default;
+
+Builder::Builder(Builder&& other)
+    : capacity_(other.capacity_),
+      at_(other.at_),
+      buffer_(other.buffer_) {
+    other.Reset(nullptr, 0);
+}
+
+Builder& Builder::operator=(Builder&& other) {
+    if (this != &other) {
+        capacity_ = other.capacity_;
+        at_ = other.at_;
+        buffer_ = other.buffer_;
+        other.Reset(nullptr, 0);
+    }
+    return *this;
+}
+
+void* Builder::Allocate(uint32_t size) {
+    uint64_t limit = FidlAlign(at_ + size);
+    if (limit > capacity_)
+        return nullptr;
+    uint8_t* result = &buffer_[at_];
+    memset(buffer_ + at_, 0, limit - at_);
+    at_ = static_cast<uint32_t>(limit);
+    return result;
+}
+
+BytePart Builder::Finalize() {
+    BytePart bytes(buffer_, capacity_, at_);
+    capacity_ = 0u;
+    at_ = 0u;
+    return bytes;
+}
+
+void Builder::Reset(void* buffer, uint32_t capacity) {
+    buffer_ = static_cast<uint8_t*>(buffer);
+    capacity_ = capacity;
+    at_ = 0u;
+}
+
+} // namespace fidl