Skip to content

Commit 95e1709

Browse files
author
Dart CI
committed
Version 2.12.0-147.0.dev
Merge commit '739393b29096e7528df4ac655044e6b2c9475c6d' into 'dev'
2 parents 2553a84 + 739393b commit 95e1709

File tree

6 files changed

+57
-11
lines changed

6 files changed

+57
-11
lines changed

build/toolchain/gcc_toolchain.gni

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ template("gcc_toolchain") {
204204
command += " && " + strip_command
205205
} else if (defined(invoker.llvm_objcopy)) {
206206
strip = invoker.llvm_objcopy
207-
strip_command = "${strip} --strip-all $outfile $stripped_outfile"
207+
if (defined(invoker.llvm_objcopy_extra_args)) {
208+
extra_args = invoker.llvm_objcopy_extra_args
209+
} else {
210+
extra_args = ""
211+
}
212+
strip_command =
213+
"${strip} --strip-all ${extra_args} $outfile $stripped_outfile"
208214
command += " && " + strip_command
209215
}
210216
if (defined(invoker.postlink)) {

build/toolchain/linux/BUILD.gn

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ gcc_toolchain("clang_arm") {
5252
ld = cxx
5353
llvm_objcopy = "${prefix}/llvm-objcopy"
5454

55+
# When producing ARM builds we drop .ARM.exidx/extab sections. These sections
56+
# don't contain any useful information (we don't use exceptions or
57+
# unwind C++ frames and most of the dart binary is in fact not covered by
58+
# them), however they have been seen to break dynamic linker in older glibc
59+
# versions (pre 2.23) because .ARM.exidx ends up being positioned between
60+
# .rel.dyn and .rel.plt sections while older versions of dynamic linker
61+
# expect these two sections to appear one after another in the ELF file.
62+
# See https://github.com/dart-lang/sdk/issues/41644.
63+
llvm_objcopy_extra_args =
64+
"--remove-section .ARM.exidx --remove-section .ARM.extab"
65+
5566
toolchain_cpu = "arm"
5667
toolchain_os = "linux"
5768
is_clang = true

pkg/kernel/bin/size_breakdown.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class WrappedBinaryBuilder extends BinaryBuilder {
6262
linkTableSize += byteOffset;
6363
}
6464

65-
Map<Uri, Source> readUriToSource() {
65+
Map<Uri, Source> readUriToSource(bool readCoverage) {
6666
uriToSourceSize -= byteOffset;
67-
var result = super.readUriToSource();
67+
var result = super.readUriToSource(readCoverage);
6868
uriToSourceSize += byteOffset;
6969
return result;
7070
}

pkg/kernel/lib/binary/ast_from_binary.dart

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,8 @@ class BinaryBuilder {
563563
}
564564

565565
/// Deserializes the source and stores it in [component].
566+
/// Note that the _coverage_ normally included in the source in the
567+
/// uri-to-source mapping is _not_ included.
566568
///
567569
/// The input bytes may contain multiple files concatenated.
568570
void readComponentSource(Component component) {
@@ -724,7 +726,7 @@ class BinaryBuilder {
724726
_ComponentIndex index = _readComponentIndex(componentFileSize);
725727

726728
_byteOffset = index.binaryOffsetForSourceTable;
727-
Map<Uri, Source> uriToSource = readUriToSource();
729+
Map<Uri, Source> uriToSource = readUriToSource(/* readCoverage = */ false);
728730
_mergeUriToSource(component.uriToSource, uriToSource);
729731

730732
_byteOffset = _componentStartOffset + componentFileSize;
@@ -773,7 +775,7 @@ class BinaryBuilder {
773775
_associateMetadata(component, _componentStartOffset);
774776

775777
_byteOffset = index.binaryOffsetForSourceTable;
776-
Map<Uri, Source> uriToSource = readUriToSource();
778+
Map<Uri, Source> uriToSource = readUriToSource(/* readCoverage = */ true);
777779
_mergeUriToSource(component.uriToSource, uriToSource);
778780

779781
_byteOffset = index.binaryOffsetForConstantTable;
@@ -821,7 +823,14 @@ class BinaryBuilder {
821823
return strings;
822824
}
823825

824-
Map<Uri, Source> readUriToSource() {
826+
/// Read the uri-to-source part of the binary.
827+
/// Note that this can include coverage, but that it is only included if
828+
/// [readCoverage] is true, otherwise coverage will be skipped. Note also that
829+
/// if [readCoverage] is true, references are read and that the link table
830+
/// thus has to be read first.
831+
Map<Uri, Source> readUriToSource(bool readCoverage) {
832+
assert(!readCoverage || (readCoverage && _linkTable != null));
833+
825834
int length = readUint32();
826835

827836
// Read data.
@@ -847,10 +856,16 @@ class BinaryBuilder {
847856
Set<Reference> coverageConstructors;
848857
{
849858
int constructorCoverageCount = readUInt30();
850-
coverageConstructors =
851-
constructorCoverageCount == 0 ? null : new Set<Reference>();
852-
for (int j = 0; j < constructorCoverageCount; ++j) {
853-
coverageConstructors.add(readMemberReference());
859+
if (readCoverage) {
860+
coverageConstructors =
861+
constructorCoverageCount == 0 ? null : new Set<Reference>();
862+
for (int j = 0; j < constructorCoverageCount; ++j) {
863+
coverageConstructors.add(readMemberReference());
864+
}
865+
} else {
866+
for (int j = 0; j < constructorCoverageCount; ++j) {
867+
skipMemberReference();
868+
}
854869
}
855870
}
856871

@@ -906,6 +921,10 @@ class BinaryBuilder {
906921
}
907922
}
908923

924+
void skipCanonicalNameReference() {
925+
readUInt30();
926+
}
927+
909928
CanonicalName readCanonicalNameReference() {
910929
int index = readUInt30();
911930
if (index == 0) return null;
@@ -937,6 +956,10 @@ class BinaryBuilder {
937956
return name?.getReference();
938957
}
939958

959+
void skipMemberReference() {
960+
skipCanonicalNameReference();
961+
}
962+
940963
Reference readMemberReference({bool allowNull: false}) {
941964
CanonicalName name = readCanonicalNameReference();
942965
if (name == null && !allowNull) {

pkg/kernel/test/binary/can_read_platform_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ bool canRead(File dill) {
8383
new BinaryBuilderWithMetadata(bytes).readComponent(component);
8484
int libs = component.libraries.length;
8585

86+
component = new Component();
87+
new BinaryBuilderWithMetadata(bytes).readComponentSource(component);
88+
8689
component = new Component();
8790
new BinaryBuilder(bytes).readComponent(component);
8891
if (libs != component.libraries.length) {
@@ -91,6 +94,9 @@ bool canRead(File dill) {
9194
"when reading with BinaryBuilder";
9295
}
9396

97+
component = new Component();
98+
new BinaryBuilder(bytes).readComponentSource(component);
99+
94100
return true;
95101
} catch (e, st) {
96102
print("Error for $dill:");

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 12
2929
PATCH 0
30-
PRERELEASE 146
30+
PRERELEASE 147
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)