File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -60,17 +60,17 @@ Hexagon::Hexagon() {
60
60
}
61
61
62
62
uint32_t Hexagon::calcEFlags () const {
63
- assert (!ctx. objectFiles . empty ()) ;
63
+ static uint32_t DEFAULT_ARCH_REV = 0x60 ;
64
64
65
65
// The architecture revision must always be equal to or greater than
66
66
// greatest revision in the list of inputs.
67
- uint32_t ret = 0 ;
67
+ std::optional< uint32_t > ret;
68
68
for (InputFile *f : ctx.objectFiles ) {
69
69
uint32_t eflags = cast<ObjFile<ELF32LE>>(f)->getObj ().getHeader ().e_flags ;
70
- if (eflags > ret)
70
+ if (!ret || eflags > * ret)
71
71
ret = eflags;
72
72
}
73
- return ret;
73
+ return ret. value_or (DEFAULT_ARCH_REV) ;
74
74
}
75
75
76
76
static uint32_t applyMask (uint32_t mask, uint32_t data) {
Original file line number Diff line number Diff line change 5
5
# RUN: llvm-readelf -h %t3 | FileCheck %s
6
6
# Verify that the largest arch in the input list is selected.
7
7
# CHECK: Flags: 0x62
8
+
9
+ # RUN: llvm-ar rcsD %t4
10
+ # RUN: ld.lld -m hexagonelf %t4 -o %t5
11
+ # RUN: llvm-readelf -h %t5 | FileCheck --check-prefix=CHECK-EMPTYARCHIVE %s
12
+ # CHECK-EMPTYARCHIVE: Flags: 0x60
You can’t perform that action at this time.
0 commit comments