mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:21:18 +00:00
1f4671d4b9
Instead of having special cases for the special sections and segments, just add each to the appropriate array prior to calculating file offsets and writing out the ELF file. Also adds various checks to ensure that the contents of sections or segments are not changed after their final size has been used to determine memory and/or file offsets, and that new sections and segments are not added after the section header and program header tables have been finalized. Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try Change-Id: I194b37a65b153a47c947e90930c4fe90d658d4e2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145783 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_ZONE_TEXT_BUFFER_H_
|
|
#define RUNTIME_VM_ZONE_TEXT_BUFFER_H_
|
|
|
|
#include "vm/allocation.h"
|
|
#include "vm/globals.h"
|
|
|
|
namespace dart {
|
|
|
|
class String;
|
|
class Zone;
|
|
|
|
// TextBuffer maintains a dynamic character buffer with a printf-style way to
|
|
// append text.
|
|
class ZoneTextBuffer : ValueObject {
|
|
public:
|
|
explicit ZoneTextBuffer(Zone* zone, intptr_t initial_capacity = 64);
|
|
~ZoneTextBuffer() {}
|
|
|
|
intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
|
void AddChar(char ch);
|
|
void AddString(const char* s);
|
|
void AddString(const String& s);
|
|
|
|
char* buffer() { return buffer_; }
|
|
intptr_t length() const { return length_; }
|
|
|
|
void Clear();
|
|
|
|
private:
|
|
void EnsureCapacity(intptr_t len);
|
|
Zone* zone_;
|
|
char* buffer_;
|
|
intptr_t length_;
|
|
intptr_t capacity_;
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_ZONE_TEXT_BUFFER_H_
|