[lld] [LLD] Use uint64_t timestamp to overcome potential overflow (PR #81665)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 16:51:34 PST 2024


================
@@ -1714,7 +1714,8 @@ void elf::postScanRelocations() {
         if (!sym.isDefined()) {
           replaceWithDefined(sym, *in.plt,
                              target->pltHeaderSize +
-                                 target->pltEntrySize * sym.getPltIdx(),
+                                 (uint64_t)target->pltEntrySize *
+                                     sym.getPltIdx(),
----------------
MaskRay wrote:

This seems an unnecessary change. PLT entries are expected to small, much smaller than 2GiB.
If we really want to do something, we could add a check `PltSection::addEntry`, but that feels quite unnecessary.

https://github.com/llvm/llvm-project/pull/81665


More information about the llvm-commits mailing list