Skip to content

Commit fa9cd79

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:1f6eb3ca5cb1 into amd-gfx:8cdc496857f9
Local branch amd-gfx 8cdc496 Merged main:beb702c0ad69 into amd-gfx:70925faeed6a Remote branch main 1f6eb3c [XCOFF]refactor isFunction, NFC (llvm#72232)
2 parents 8cdc496 + 1f6eb3c commit fa9cd79

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

lld/ELF/Arch/LoongArch.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,12 @@ RelExpr LoongArch::getRelExpr(const RelType type, const Symbol &s,
444444
case R_LARCH_TLS_LE64_LO20:
445445
case R_LARCH_TLS_LE64_HI12:
446446
return R_TPREL;
447+
case R_LARCH_ADD6:
447448
case R_LARCH_ADD8:
448449
case R_LARCH_ADD16:
449450
case R_LARCH_ADD32:
450451
case R_LARCH_ADD64:
452+
case R_LARCH_SUB6:
451453
case R_LARCH_SUB8:
452454
case R_LARCH_SUB16:
453455
case R_LARCH_SUB32:
@@ -650,6 +652,9 @@ void LoongArch::relocate(uint8_t *loc, const Relocation &rel,
650652
write32le(loc, setK12(read32le(loc), extractBits(val, 63, 52)));
651653
return;
652654

655+
case R_LARCH_ADD6:
656+
*loc = (*loc & 0xc0) | ((*loc + val) & 0x3f);
657+
return;
653658
case R_LARCH_ADD8:
654659
*loc += val;
655660
return;
@@ -662,6 +667,9 @@ void LoongArch::relocate(uint8_t *loc, const Relocation &rel,
662667
case R_LARCH_ADD64:
663668
write64le(loc, read64le(loc) + val);
664669
return;
670+
case R_LARCH_SUB6:
671+
*loc = (*loc & 0xc0) | ((*loc - val) & 0x3f);
672+
return;
665673
case R_LARCH_SUB8:
666674
*loc -= val;
667675
return;

lld/test/ELF/loongarch-add-sub.s

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# RUN: llvm-readelf -x .rodata %t.la64 | FileCheck --check-prefix=CHECK %s
77
# CHECK: section '.rodata':
88
# CHECK-NEXT: 0x9876543210 10325476 98badcfe 804602be 79ffffff
9-
# CHECK-NEXT: 0x9876543220 804602be 804680
9+
# CHECK-NEXT: 0x9876543220 804602be 80468097
1010

1111
.text
1212
.global _start
@@ -34,3 +34,7 @@ quux:
3434
.byte 0
3535
.reloc quux, R_LARCH_ADD8, 1b
3636
.reloc quux, R_LARCH_SUB8, 2b
37+
qux:
38+
.byte 0b10000000
39+
.reloc qux, R_LARCH_ADD6, qux
40+
.reloc qux, R_LARCH_SUB6, 2b

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 480782
19+
#define LLVM_MAIN_REVISION 480785
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/include/llvm/Object/XCOFFObjectFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ class XCOFFSymbolRef : public SymbolRef {
838838
}
839839

840840
Expected<StringRef> getName() const;
841-
bool isFunction() const;
841+
Expected<bool> isFunction() const;
842842
bool isCsectSymbol() const;
843843
Expected<XCOFFCsectAuxRef> getXCOFFCsectAuxRef() const;
844844

llvm/lib/Object/XCOFFObjectFile.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ Expected<SymbolRef::Type>
299299
XCOFFObjectFile::getSymbolType(DataRefImpl Symb) const {
300300
XCOFFSymbolRef XCOFFSym = toSymbolRef(Symb);
301301

302-
if (XCOFFSym.isFunction())
302+
Expected<bool> IsFunction = XCOFFSym.isFunction();
303+
if (!IsFunction)
304+
return IsFunction.takeError();
305+
306+
if (*IsFunction)
303307
return SymbolRef::ST_Function;
304308

305309
if (XCOFF::C_FILE == XCOFFSym.getStorageClass())
@@ -1225,20 +1229,16 @@ std::optional<StringRef> XCOFFObjectFile::tryGetCPUName() const {
12251229
return StringRef("future");
12261230
}
12271231

1228-
bool XCOFFSymbolRef::isFunction() const {
1232+
Expected<bool> XCOFFSymbolRef::isFunction() const {
12291233
if (!isCsectSymbol())
12301234
return false;
12311235

12321236
if (getSymbolType() & FunctionSym)
12331237
return true;
12341238

12351239
Expected<XCOFFCsectAuxRef> ExpCsectAuxEnt = getXCOFFCsectAuxRef();
1236-
if (!ExpCsectAuxEnt) {
1237-
// If we could not get the CSECT auxiliary entry, then treat this symbol as
1238-
// if it isn't a function. Consume the error and return `false` to move on.
1239-
consumeError(ExpCsectAuxEnt.takeError());
1240-
return false;
1241-
}
1240+
if (!ExpCsectAuxEnt)
1241+
return ExpCsectAuxEnt.takeError();
12421242

12431243
const XCOFFCsectAuxRef CsectAuxRef = ExpCsectAuxEnt.get();
12441244

@@ -1253,12 +1253,8 @@ bool XCOFFSymbolRef::isFunction() const {
12531253

12541254
const int16_t SectNum = getSectionNumber();
12551255
Expected<DataRefImpl> SI = getObject()->getSectionByNum(SectNum);
1256-
if (!SI) {
1257-
// If we could not get the section, then this symbol should not be
1258-
// a function. So consume the error and return `false` to move on.
1259-
consumeError(SI.takeError());
1260-
return false;
1261-
}
1256+
if (!SI)
1257+
return SI.takeError();
12621258

12631259
return (getObject()->getSectionFlags(SI.get()) & XCOFF::STYP_TEXT);
12641260
}

llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ source_set("sources") {
153153
"sanitizer_symbolizer_markup.cpp",
154154
"sanitizer_symbolizer_posix_libcdep.cpp",
155155
"sanitizer_symbolizer_report.cpp",
156+
"sanitizer_symbolizer_report_fuchsia.cpp",
156157
"sanitizer_symbolizer_win.cpp",
157158
"sanitizer_termination.cpp",
158159
"sanitizer_thread_arg_retval.cpp",
@@ -162,6 +163,7 @@ source_set("sources") {
162163
"sanitizer_tls_get_addr.cpp",
163164
"sanitizer_tls_get_addr.h",
164165
"sanitizer_type_traits.cpp",
166+
"sanitizer_unwind_fuchsia.cpp",
165167
"sanitizer_unwind_linux_libcdep.cpp",
166168
"sanitizer_unwind_win.cpp",
167169
"sanitizer_vector.h",

0 commit comments

Comments
 (0)