[PATCH] D139862: [llvm][Object] set SF_Hidden flag for MachO files
Cyndy Ishida via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 14:59:09 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGac20a3a5b530: [llvm][Object] set SF_Hidden flag for MachO files (authored by cishida).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139862/new/
https://reviews.llvm.org/D139862
Files:
lld/test/MachO/alias-symbols.s
lld/test/MachO/lto-explicit-exports.ll
lld/test/MachO/weak-definition-gc.s
llvm/lib/Object/MachOObjectFile.cpp
Index: llvm/lib/Object/MachOObjectFile.cpp
===================================================================
--- llvm/lib/Object/MachOObjectFile.cpp
+++ llvm/lib/Object/MachOObjectFile.cpp
@@ -1880,9 +1880,13 @@
Result |= SymbolRef::SF_Undefined;
}
- if (!(MachOType & MachO::N_PEXT))
+ if (MachOType & MachO::N_PEXT)
+ Result |= SymbolRef::SF_Hidden;
+ else
Result |= SymbolRef::SF_Exported;
- }
+
+ } else if (MachOType & MachO::N_PEXT)
+ Result |= SymbolRef::SF_Hidden;
if (MachOFlags & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF))
Result |= SymbolRef::SF_Weak;
Index: lld/test/MachO/weak-definition-gc.s
===================================================================
--- lld/test/MachO/weak-definition-gc.s
+++ lld/test/MachO/weak-definition-gc.s
@@ -70,10 +70,10 @@
# RUN: %lld -o %t/out -lSystem %t/weak-aligned-1.o %t/weak-aligned-2.o -dead_strip
# RUN: llvm-objdump --syms --section=__const --full-contents %t/out | FileCheck --check-prefixes=ALIGN,ALIGN3 %s
# ALIGN: SYMBOL TABLE:
-# ALIGN-DAG: [[#%x, ADDR:]] l O __DATA_CONST,__const _weak1
-# ALIGN2-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const _weak3
-# ALIGN3-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const _weak2
-# ALIGN2-DAG: {{0*}}[[#ADDR+ 0x8]] l O __DATA_CONST,__const _weak2
+# ALIGN-DAG: [[#%x, ADDR:]] l O __DATA_CONST,__const .hidden _weak1
+# ALIGN2-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const .hidden _weak3
+# ALIGN3-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const .hidden _weak2
+# ALIGN2-DAG: {{0*}}[[#ADDR+ 0x8]] l O __DATA_CONST,__const .hidden _weak2
# ALIGN-DAG: {{0*}}[[#ADDR+0x10]] g O __DATA_CONST,__const _aligned
# ALIGN: Contents of section __DATA_CONST,__const:
# ALIGN2-NEXT: {{0*}}[[#ADDR]] 11111111 33333333 22222222 00000000
Index: lld/test/MachO/lto-explicit-exports.ll
===================================================================
--- lld/test/MachO/lto-explicit-exports.ll
+++ lld/test/MachO/lto-explicit-exports.ll
@@ -46,7 +46,7 @@
; THINLTO-REFS-FOO: declare dso_local void @foo()
; THINLTO-REFS-FOO: define dso_local void @refs_foo()
-; THINLTO-SYMS: l F __TEXT,__text _foo
+; THINLTO-SYMS: l F __TEXT,__text .hidden _foo
; THINLTO-SYMS: g F __TEXT,__text _same_module_caller
; THINLTO-SYMS: g F __TEXT,__text _refs_foo
Index: lld/test/MachO/alias-symbols.s
===================================================================
--- lld/test/MachO/alias-symbols.s
+++ lld/test/MachO/alias-symbols.s
@@ -15,10 +15,10 @@
# CHECK-DAG: [[#%.16x,STRONG:]] g F __TEXT,__text _strong
# CHECK-DAG: [[#%.16x,WEAK_1:]] w F __TEXT,__text _weak_1
-# CHECK-DAG: [[#%.16x,PEXT:]] l F __TEXT,__text _pext
+# CHECK-DAG: [[#%.16x,PEXT:]] l F __TEXT,__text .hidden _pext
# CHECK-DAG: [[#%.16x,DEAD:]] g F __TEXT,__text _dead
-# CHECK-DAG: [[#STRONG]] l F __TEXT,__text _pext_alias
-# CHECK-DAG: [[#PEXT]] l F __TEXT,__text _alias_to_pext
+# CHECK-DAG: [[#STRONG]] l F __TEXT,__text .hidden _pext_alias
+# CHECK-DAG: [[#PEXT]] l F __TEXT,__text .hidden _alias_to_pext
# CHECK-DAG: [[#STRONG]] g F __TEXT,__text _extern_alias_to_strong
# CHECK-DAG: [[#WEAK_1]] w F __TEXT,__text _weak_extern_alias_to_weak
# CHECK-DAG: [[#DEAD]] g F __TEXT,__text _no_dead_strip_alias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139862.482637.patch
Type: text/x-patch
Size: 3450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221213/d7568380/attachment.bin>
More information about the llvm-commits
mailing list