Skip to content

Commit c1ff84b

Browse files
committed
resolve comments
1 parent 52c2831 commit c1ff84b

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

lld/MachO/SectionPriorities.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,11 @@ void macho::PriorityBuilder::parseOrderFile(StringRef path) {
357357
uint32_t hash = 0;
358358
if (to_integer(line, hash))
359359
cStringPriorities[hash].setPriority(prio, objectFile);
360-
} else
361-
priorities[utils::getRootSymbol(line)].setPriority(prio, objectFile);
360+
} else {
361+
StringRef symbol = utils::getRootSymbol(line);
362+
if (!symbol.empty())
363+
priorities[symbol].setPriority(prio, objectFile);
364+
}
362365

363366
++prio;
364367
}

lld/MachO/SectionPriorities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class PriorityBuilder {
9494
std::optional<int> getCStringPriority(uint32_t hash,
9595
const InputFile *f) const;
9696
llvm::DenseMap<llvm::StringRef, SymbolPriorityEntry> priorities;
97-
llvm::DenseMap<int32_t, SymbolPriorityEntry> cStringPriorities;
97+
llvm::DenseMap<uint32_t, SymbolPriorityEntry> cStringPriorities;
9898
llvm::MapVector<SectionPair, uint64_t> callGraphProfile;
9999
};
100100

lld/test/MachO/order-file-cstring.s

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# RUN: llvm-readobj --string-dump=__cstring %t/test-4 | FileCheck %s --check-prefix=FOUR_SEC_ESCAPE
3131

3232
# We expect:
33-
# 1) Covered cstring symbols are reordered
33+
# 1) Covered cstring symbols to be reordered
3434
# 2) the rest of the cstring symbols remain in the original relative order within the cstring section
3535

3636
# ORIGIN_SYM: _local_foo1
@@ -51,27 +51,27 @@
5151

5252
# original order, but only parital covered
5353
#--- ord-1
54-
#bar2
55-
CSTR;1496286555
5654
#foo2
5755
CSTR;1433942677
58-
#foo3
59-
CSTR;1343999025
6056
#bar
6157
CSTR;540201826
58+
#bar2
59+
CSTR;1496286555
60+
#foo3
61+
CSTR;1343999025
6262

63-
# ONE_SYM: _bar2
6463
# ONE_SYM-DAG: _globl_foo2
6564
# ONE_SYM-DAG: _local_foo2
66-
# ONE_SYM: _globl_foo3
6765
# ONE_SYM: _bar
66+
# ONE_SYM: _bar2
67+
# ONE_SYM: _globl_foo3
6868
# ONE_SYM: _baz
6969
# ONE_SYM: _baz_dup
7070

71-
# ONE_SEC: bar2
7271
# ONE_SEC: foo2
73-
# ONE_SEC: foo3
7472
# ONE_SEC: bar
73+
# ONE_SEC: bar2
74+
# ONE_SEC: foo3
7575
# ONE_SEC: baz
7676

7777

0 commit comments

Comments
 (0)