[vm/test] Fix assumption about dynamic symbol table.
The original code assumed that only the initial symbol in the
dynamic symbol table had an empty name, and so any symbol with an
empty name was checked as if it was the initial symbol.
However, it turns out that in at least one case on our testing
infrastructure, the assembler generates a dynamic symbol with an
empty name.
Thus, we change the test to check the initial symbol separately
from the rest of the symbols in the symbol table.
TEST=vm/dart{,_2}/use_add_readonly_data_symbols_flag
Bug: https://github.com/dart-lang/sdk/issues/50071
Change-Id: Ie5d443ee2a45f8fb3400955d8bdfb3e726ab028a
Fixed: 50071
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261820
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
committed by
Commit Queue
parent
dc7df3218e
commit
ef53c1929d
@@ -94,27 +94,27 @@ void checkElf(String filename, {bool isAssembled = false}) {
|
||||
// dynamic symbol table, have STB_LOCAL binding, and are of type STT_OBJECT.
|
||||
final elf = Elf.fromFile(filename);
|
||||
Expect.isNotNull(elf);
|
||||
final dynamicSymbols = elf!.dynamicSymbols.toList();
|
||||
final dynamicSymbols = elf!.dynamicSymbols;
|
||||
// All symbol tables have an initial entry with zero-valued fields.
|
||||
Expect.isNotEmpty(dynamicSymbols);
|
||||
print('Dynamic symbols:');
|
||||
for (final symbol in dynamicSymbols) {
|
||||
// All symbol tables have an initial entry with zero-valued fields.
|
||||
if (symbol.name == '') {
|
||||
print(symbol);
|
||||
Expect.equals(SymbolBinding.STB_LOCAL, symbol.bind);
|
||||
Expect.equals(SymbolType.STT_NOTYPE, symbol.type);
|
||||
Expect.equals(0, symbol.value);
|
||||
} else {
|
||||
if (!symbol.name.startsWith('_kDart')) {
|
||||
// The VM only adds symbols with names starting with _kDart, so this
|
||||
// must be an assembled snapshot.
|
||||
Expect.isTrue(isAssembled);
|
||||
continue;
|
||||
}
|
||||
Expect.equals(SymbolBinding.STB_GLOBAL, symbol.bind);
|
||||
Expect.equals(SymbolType.STT_OBJECT, symbol.type);
|
||||
// All VM-generated read-only object symbols should have a non-zero size.
|
||||
Expect.notEquals(0, symbol.size);
|
||||
final initialDynamic = dynamicSymbols.first;
|
||||
print(initialDynamic);
|
||||
Expect.equals(SymbolBinding.STB_LOCAL, initialDynamic.bind);
|
||||
Expect.equals(SymbolType.STT_NOTYPE, initialDynamic.type);
|
||||
Expect.equals(0, initialDynamic.value);
|
||||
for (final symbol in dynamicSymbols.skip(1)) {
|
||||
print(symbol);
|
||||
if (!symbol.name.startsWith('_kDart')) {
|
||||
// The VM only adds symbols with names starting with _kDart, so this
|
||||
// must be an assembled snapshot.
|
||||
Expect.isTrue(isAssembled);
|
||||
continue;
|
||||
}
|
||||
Expect.equals(SymbolBinding.STB_GLOBAL, symbol.bind);
|
||||
Expect.equals(SymbolType.STT_OBJECT, symbol.type);
|
||||
// All VM-generated read-only object symbols should have a non-zero size.
|
||||
Expect.notEquals(0, symbol.size);
|
||||
}
|
||||
print("");
|
||||
final onlyStaticSymbols = elf.staticSymbols
|
||||
|
||||
@@ -96,27 +96,27 @@ void checkElf(String filename, {bool isAssembled = false}) {
|
||||
// dynamic symbol table, have STB_LOCAL binding, and are of type STT_OBJECT.
|
||||
final elf = Elf.fromFile(filename);
|
||||
Expect.isNotNull(elf);
|
||||
final dynamicSymbols = elf.dynamicSymbols.toList();
|
||||
final dynamicSymbols = elf.dynamicSymbols;
|
||||
// All symbol tables have an initial entry with zero-valued fields.
|
||||
Expect.isNotEmpty(dynamicSymbols);
|
||||
print('Dynamic symbols:');
|
||||
for (final symbol in dynamicSymbols) {
|
||||
final initialDynamic = dynamicSymbols.first;
|
||||
print(initialDynamic);
|
||||
Expect.equals(SymbolBinding.STB_LOCAL, initialDynamic.bind);
|
||||
Expect.equals(SymbolType.STT_NOTYPE, initialDynamic.type);
|
||||
Expect.equals(0, initialDynamic.value);
|
||||
for (final symbol in dynamicSymbols.skip(1)) {
|
||||
print(symbol);
|
||||
// All symbol tables have an initial entry with zero-valued fields.
|
||||
if (symbol.name == '') {
|
||||
Expect.equals(SymbolBinding.STB_LOCAL, symbol.bind);
|
||||
Expect.equals(SymbolType.STT_NOTYPE, symbol.type);
|
||||
Expect.equals(0, symbol.value);
|
||||
} else {
|
||||
if (!symbol.name.startsWith('_kDart')) {
|
||||
// The VM only adds symbols with names starting with _kDart, so this
|
||||
// must be an assembled snapshot.
|
||||
Expect.isTrue(isAssembled);
|
||||
continue;
|
||||
}
|
||||
Expect.equals(SymbolBinding.STB_GLOBAL, symbol.bind);
|
||||
Expect.equals(SymbolType.STT_OBJECT, symbol.type);
|
||||
// All VM-generated read-only object symbols should have a non-zero size.
|
||||
Expect.notEquals(0, symbol.size);
|
||||
if (!symbol.name.startsWith('_kDart')) {
|
||||
// The VM only adds symbols with names starting with _kDart, so this
|
||||
// must be an assembled snapshot.
|
||||
Expect.isTrue(isAssembled);
|
||||
continue;
|
||||
}
|
||||
Expect.equals(SymbolBinding.STB_GLOBAL, symbol.bind);
|
||||
Expect.equals(SymbolType.STT_OBJECT, symbol.type);
|
||||
// All VM-generated read-only object symbols should have a non-zero size.
|
||||
Expect.notEquals(0, symbol.size);
|
||||
}
|
||||
print("");
|
||||
final onlyStaticSymbols = elf.staticSymbols
|
||||
|
||||
Reference in New Issue
Block a user