Skip to content

Commit 00aa056

Browse files
committed
[WIP] Generate weak export table entries for weak function symbols.
1 parent 592752f commit 00aa056

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,8 @@ void RISCVAsmPrinter::emitEndOfAsmFile(Module &M) {
715715
// export different static things.
716716
if (Entry.Fn.hasExternalLinkage() && !Entry.forceLocal)
717717
OutStreamer->emitSymbolAttribute(Sym, MCSA_Global);
718+
else if (Entry.Fn.isWeakForLinker() && !Entry.forceLocal)
719+
OutStreamer->emitSymbolAttribute(Sym, MCSA_Weak);
718720
OutStreamer->emitValueToAlignment(Align(4));
719721
OutStreamer->emitLabel(Sym);
720722
emitLabelDifference(Entry.FnSym, CompartmentStartSym, 2);
@@ -741,6 +743,8 @@ void RISCVAsmPrinter::emitEndOfAsmFile(Module &M) {
741743
OutStreamer->emitSymbolAttribute(AliasExportSym, MCSA_ELF_TypeObject);
742744
if (GA->hasExternalLinkage() && !Entry.forceLocal)
743745
OutStreamer->emitSymbolAttribute(AliasExportSym, MCSA_Global);
746+
else if (GA->isWeakForLinker() && !Entry.forceLocal)
747+
OutStreamer->emitSymbolAttribute(AliasExportSym, MCSA_Weak);
744748
OutStreamer->emitAssignment(AliasExportSym,
745749
MCSymbolRefExpr::create(Sym, C));
746750
OutStreamer->emitELFSize(AliasExportSym, MCConstantExpr::create(4, C));

0 commit comments

Comments
 (0)