[PATCH] D135884: [lld-macho] Preserve the size of common symbols

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 13:45:17 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG922346ef052f: [lld-macho] Preserve the size of common symbols (authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135884/new/

https://reviews.llvm.org/D135884

Files:
  lld/MachO/Driver.cpp
  lld/test/MachO/dead-strip.s
  lld/test/MachO/map-file.s


Index: lld/test/MachO/map-file.s
===================================================================
--- lld/test/MachO/map-file.s
+++ lld/test/MachO/map-file.s
@@ -40,7 +40,7 @@
 # CHECK-NEXT: # Address           Size        File   Name
 # CHECK-NEXT: 0x[[#%X,MAIN]]      0x00000001  [  1]  _main
 # CHECK-NEXT: 0x[[#%X,FOO]]       0x00000000  [  2]  _foo
-# CHECK-NEXT: 0x[[#%X,NUMBER]]    0x00000000  [  1]  _number
+# CHECK-NEXT: 0x[[#%X,NUMBER]]    0x00000001  [  1]  _number
 
 # RUN: %lld -map %t/c-string-literal-map %t/c-string-literal.o -o %t/c-string-literal-out
 # RUN: FileCheck --check-prefix=CSTRING %s < %t/c-string-literal-map
Index: lld/test/MachO/dead-strip.s
===================================================================
--- lld/test/MachO/dead-strip.s
+++ lld/test/MachO/dead-strip.s
@@ -48,7 +48,7 @@
 
 # MAP: _main
 # MAP-LABEL: Dead Stripped Symbols
-# MAP: <<dead>> 0x00000000 [ 1] _unref_com
+# MAP: <<dead>> 0x00000001 [ 1] _unref_com
 # MAP: <<dead>> 0x00000008 [ 1] _unref_data
 # MAP: <<dead>> 0x00000006 [ 1] _unref_extern
 # MAP: <<dead>> 0x00000001 [ 1] _unref_local
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -577,7 +577,7 @@
     // FIXME: CommonSymbol should store isReferencedDynamically, noDeadStrip
     // and pass them on here.
     replaceSymbol<Defined>(
-        sym, sym->getName(), common->getFile(), isec, /*value=*/0, /*size=*/0,
+        sym, sym->getName(), common->getFile(), isec, /*value=*/0, common->size,
         /*isWeakDef=*/false, /*isExternal=*/true, common->privateExtern,
         /*includeInSymtab=*/true, /*isThumb=*/false,
         /*isReferencedDynamically=*/false, /*noDeadStrip=*/false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135884.467592.patch
Type: text/x-patch
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221013/50928a30/attachment.bin>


More information about the llvm-commits mailing list