[PATCH] D123283: [MC] Improve st_size propagation rule
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 23:56:42 PDT 2022
MaskRay created this revision.
MaskRay added reviewers: peter.smith, zatrazz.
Herald added subscribers: StephenFan, dmgreen, hiraditya, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`.symver foo, foo at ver` creates the MCSymbolELF `foo at ver` whose almost all
attributes (including st_size) should inherit from `foo` (GNU as behavior).
a041ef1bd8905f0d58e301c6830b183002ff1847 added st_size propagation which works
for many cases but fails for the following one:
.set __GLIBC_2_12_sys_errlist, _sys_errlist_internal
.type __GLIBC_2_12_sys_errlist, at object
.size __GLIBC_2_12_sys_errlist, 1080
.symver __GLIBC_2_12_sys_errlist, sys_errlist at GLIBC_2.12
...
_sys_errlist_internal:
.size _sys_errlist_internal, 1072
`sys_errlist at GLIBC_2.12`'s st_size is 1072 (incorrect), which does not match
`__GLIBC_2_12_sys_errlist`'s st_size: 1080.
The problem is that `Base` is (the final) `_sys_errlist_internal` while we want
to respect (the intermediate) `__GLIBC_2_12_sys_errlist`'s st_size. Just detect
the `MCSymbolRefExpr` case. We'd still fail for more chained assignments,
but they are obscure enough to matter.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123283
Files:
llvm/lib/MC/ELFObjectWriter.cpp
llvm/test/MC/ELF/offset.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123283.421102.patch
Type: text/x-patch
Size: 3341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220407/a16a248a/attachment.bin>
More information about the llvm-commits
mailing list