[WebAssembly] Add --[no]-export-dynamic to replace --export-default

In a very recent change I introduced a --no-export-default flag
but after conferring with others it seems that this feature already
exists in gnu GNU ld and lld in the form the --export-dynamic flag
which is off by default.

This change replaces export-default with export-dynamic and also
changes the default to match the traditional linker behaviour.

Now, by default, only the entry point is exported.  If other symbols
are required by the embedder then --export-dynamic or --export can
be used to export all visibility hidden symbols or individual
symbols respectively.

This change touches a lot of tests that were relying on symbols
being exported by default.  I imagine it will also effect many
users but do think the change is worth it match of the traditional
behaviour and flag names.

Differential Revision: https://reviews.llvm.org/D52587

llvm-svn: 343265
This commit is contained in:
Sam Clegg 2018-09-27 21:06:25 +00:00
parent 5f1b8181ad
commit 305b0343ce
19 changed files with 64 additions and 56 deletions

View File

@ -1,5 +1,5 @@
; RUN: llc -filetype=obj -o %t.o %s ; RUN: llc -filetype=obj -o %t.o %s
; RUN: wasm-ld %t.o -o %t.wasm ; RUN: wasm-ld --export=start_alias %t.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown" target triple = "wasm32-unknown-unknown"

View File

@ -5,9 +5,9 @@ RUN: llc -filetype=obj %S/Inputs/archive1.ll -o %t.a1.o
RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o
RUN: rm -f %t.a RUN: rm -f %t.a
RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o
RUN: wasm-ld --export=archive2_symbol -o %t.wasm %t.a %t.o RUN: wasm-ld --export-dynamic --export=archive2_symbol -o %t.wasm %t.a %t.o
RUN: obj2yaml %t.wasm | FileCheck %s RUN: obj2yaml %t.wasm | FileCheck %s
RUN: wasm-ld -o %t.wasm %t.a %t.o RUN: wasm-ld --export-dynamic -o %t.wasm %t.a %t.o
RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=NOEXPORT RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=NOEXPORT
CHECK: Exports: CHECK: Exports:

View File

@ -1,6 +1,6 @@
; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o ; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o
; RUN: llc -filetype=obj %s -o %t.o ; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t2.o %t.o ; RUN: wasm-ld --export-dynamic -o %t.wasm %t2.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
; bitcode generated from the following C code: ; bitcode generated from the following C code:

View File

@ -1,7 +1,7 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %p/Inputs/comdat1.ll -o %t1.o ; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %p/Inputs/comdat1.ll -o %t1.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %p/Inputs/comdat2.ll -o %t2.o ; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %p/Inputs/comdat2.ll -o %t2.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %s -o %t.o ; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o ; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown" target triple = "wasm32-unknown-unknown"

View File

@ -1,11 +1,11 @@
; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o ; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o
; RUN: llc -filetype=obj %s -o %t.o ; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t2.o %t.o ; RUN: wasm-ld --export-dynamic -o %t.wasm %t2.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
; RUN: wasm-ld -O2 -o %t-opt.wasm %t2.o %t.o ; RUN: wasm-ld --export-dynamic -O2 -o %t-opt.wasm %t2.o %t.o
; RUN: obj2yaml %t-opt.wasm | FileCheck %s ; RUN: obj2yaml %t-opt.wasm | FileCheck %s
; RUN: not wasm-ld --compress-relocations -o %t-compressed.wasm %t2.o %t.o 2>&1 | FileCheck %s -check-prefix=ERROR ; RUN: not wasm-ld --compress-relocations -o %t-compressed.wasm %t2.o %t.o 2>&1 | FileCheck %s -check-prefix=ERROR
; RUN: wasm-ld --strip-debug --compress-relocations -o %t-compressed.wasm %t2.o %t.o ; RUN: wasm-ld --export-dynamic --strip-debug --compress-relocations -o %t-compressed.wasm %t2.o %t.o
; RUN: obj2yaml %t-compressed.wasm | FileCheck %s -check-prefix=COMPRESS ; RUN: obj2yaml %t-compressed.wasm | FileCheck %s -check-prefix=COMPRESS
target triple = "wasm32-unknown-unknown-wasm" target triple = "wasm32-unknown-unknown-wasm"

View File

@ -1,7 +1,7 @@
; RUN: llc -filetype=obj %s -o %t.o ; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld --demangle -o %t_demangle.wasm %t.o ; RUN: wasm-ld --export=_Z3fooi --demangle -o %t_demangle.wasm %t.o
; RUN: obj2yaml %t_demangle.wasm | FileCheck %s ; RUN: obj2yaml %t_demangle.wasm | FileCheck %s
; RUN: wasm-ld --no-demangle -o %t_nodemangle.wasm %t.o ; RUN: wasm-ld --export=_Z3fooi --no-demangle -o %t_nodemangle.wasm %t.o
; RUN: obj2yaml %t_nodemangle.wasm | FileCheck %s ; RUN: obj2yaml %t_nodemangle.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown" target triple = "wasm32-unknown-unknown"

View File

@ -1,5 +1,6 @@
; Test that internal symbols can still be GC'd when with --export-dynamic.
; RUN: llc -filetype=obj %s -o %t.o ; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t.o ; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown" target triple = "wasm32-unknown-unknown"

View File

@ -1,6 +1,6 @@
; RUN: llc -filetype=obj %p/Inputs/locals-duplicate1.ll -o %t1.o ; RUN: llc -filetype=obj %p/Inputs/locals-duplicate1.ll -o %t1.o
; RUN: llc -filetype=obj %p/Inputs/locals-duplicate2.ll -o %t2.o ; RUN: llc -filetype=obj %p/Inputs/locals-duplicate2.ll -o %t2.o
; RUN: wasm-ld --no-entry -o %t.wasm %t1.o %t2.o ; RUN: wasm-ld --export-dynamic --no-entry -o %t.wasm %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
; CHECK: --- !WASM ; CHECK: --- !WASM

View File

@ -2,7 +2,7 @@
; RUN: rm -f %t.a ; RUN: rm -f %t.a
; RUN: llvm-ar rcs %t.a %t1.o ; RUN: llvm-ar rcs %t.a %t1.o
; RUN: llvm-as %s -o %t2.o ; RUN: llvm-as %s -o %t2.o
; RUN: wasm-ld %t2.o %t.a -o %t3 ; RUN: wasm-ld --export-dynamic %t2.o %t.a -o %t3
; RUN: obj2yaml %t3 | FileCheck %s ; RUN: obj2yaml %t3 | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"

View File

@ -1,5 +1,5 @@
; RUN: llc -filetype=obj %s -o %t.o ; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld --no-entry --print-gc-sections %t.o \ ; RUN: wasm-ld --entry=callWeakFuncs --print-gc-sections %t.o \
; RUN: -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-GC %s ; RUN: -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-GC %s
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s

View File

@ -3,14 +3,14 @@
; RUN: rm -f %t2.a ; RUN: rm -f %t2.a
; RUN: llvm-ar rcs %t2.a %t2.o ; RUN: llvm-ar rcs %t2.a %t2.o
; Test that hidden symbols are not exported, whether pulled in from an archive ; Test that symbols with hidden visitiblity are not export, even with
; or directly. ; --export-dynamic
; RUN: wasm-ld %t.o %t2.a -o %t.wasm ; RUN: wasm-ld --export-dynamic %t.o %t2.a -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
; Test that symbols with default visitiblity are not exported when ; Test that symbols with default visitiblity are not exported without
; --no-export-default is passed. ; --export-dynamic
; RUN: wasm-ld --no-export-default %t.o %t2.a -o %t.nodef.wasm ; RUN: wasm-ld %t.o %t2.a -o %t.nodef.wasm
; RUN: obj2yaml %t.nodef.wasm | FileCheck %s -check-prefix=NO-DEFAULT ; RUN: obj2yaml %t.nodef.wasm | FileCheck %s -check-prefix=NO-DEFAULT
@ -66,4 +66,13 @@ entry:
; NO-DEFAULT-NEXT: - Name: memory ; NO-DEFAULT-NEXT: - Name: memory
; NO-DEFAULT-NEXT: Kind: MEMORY ; NO-DEFAULT-NEXT: Kind: MEMORY
; NO-DEFAULT-NEXT: Index: 0 ; NO-DEFAULT-NEXT: Index: 0
; NO-DEFAULT-NEXT: - Name: __heap_base
; NO-DEFAULT-NEXT: Kind: GLOBAL
; NO-DEFAULT-NEXT: Index: 1
; NO-DEFAULT-NEXT: - Name: __data_end
; NO-DEFAULT-NEXT: Kind: GLOBAL
; NO-DEFAULT-NEXT: Index: 2
; NO-DEFAULT-NEXT: - Name: _start
; NO-DEFAULT-NEXT: Kind: FUNCTION
; NO-DEFAULT-NEXT: Index: 3
; NO-DEFAULT-NEXT: - Type: ; NO-DEFAULT-NEXT: - Type:

View File

@ -1,6 +1,6 @@
; RUN: llc -filetype=obj -o %t.o %s ; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o ; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
; RUN: wasm-ld %t.o %t2.o -o %t.wasm ; RUN: wasm-ld --export-dynamic %t.o %t2.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
; Test that the strongly defined alias_fn from this file is used both here ; Test that the strongly defined alias_fn from this file is used both here

View File

@ -1,6 +1,6 @@
; RUN: llc -filetype=obj -o %t.o %s ; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o ; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
; RUN: wasm-ld %t.o %t2.o -o %t.wasm ; RUN: wasm-ld --export-dynamic %t.o %t2.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
; Test that weak aliases (alias_fn is a weak alias of direct_fn) are linked correctly ; Test that weak aliases (alias_fn is a weak alias of direct_fn) are linked correctly

View File

@ -1,7 +1,7 @@
; RUN: llc -filetype=obj %p/Inputs/weak-symbol1.ll -o %t1.o ; RUN: llc -filetype=obj %p/Inputs/weak-symbol1.ll -o %t1.o
; RUN: llc -filetype=obj %p/Inputs/weak-symbol2.ll -o %t2.o ; RUN: llc -filetype=obj %p/Inputs/weak-symbol2.ll -o %t2.o
; RUN: llc -filetype=obj %s -o %t.o ; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -no-gc-sections -o %t.wasm %t.o %t1.o %t2.o ; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s ; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown" target triple = "wasm32-unknown-unknown"
@ -29,7 +29,7 @@ entry:
; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: - Type: FUNCTION
; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 1, 1 ] ; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE ; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables: ; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC ; CHECK-NEXT: - ElemType: ANYFUNC
@ -59,7 +59,7 @@ entry:
; CHECK-NEXT: Mutable: false ; CHECK-NEXT: Mutable: false
; CHECK-NEXT: InitExpr: ; CHECK-NEXT: InitExpr:
; CHECK-NEXT: Opcode: I32_CONST ; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1032 ; CHECK-NEXT: Value: 1028
; CHECK-NEXT: - Index: 3 ; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Type: I32 ; CHECK-NEXT: Type: I32
; CHECK-NEXT: Mutable: false ; CHECK-NEXT: Mutable: false
@ -91,7 +91,7 @@ entry:
; CHECK-NEXT: Index: 3 ; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: exportWeak2 ; CHECK-NEXT: - Name: exportWeak2
; CHECK-NEXT: Kind: FUNCTION ; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 5 ; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Type: ELEM ; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments: ; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset: ; CHECK-NEXT: - Offset:
@ -114,9 +114,6 @@ entry:
; CHECK-NEXT: Body: 4181808080000B ; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Index: 4 ; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals: ; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4181808080000B ; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Type: DATA ; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments: ; CHECK-NEXT: Segments:
@ -125,7 +122,7 @@ entry:
; CHECK-NEXT: Offset: ; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST ; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1024 ; CHECK-NEXT: Value: 1024
; CHECK-NEXT: Content: '0100000002000000' ; CHECK-NEXT: Content: '01000000'
; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name ; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames: ; CHECK-NEXT: FunctionNames:
@ -138,7 +135,5 @@ entry:
; CHECK-NEXT: - Index: 3 ; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: exportWeak1 ; CHECK-NEXT: Name: exportWeak1
; CHECK-NEXT: - Index: 4 ; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: weakFn
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: exportWeak2 ; CHECK-NEXT: Name: exportWeak2
; CHECK-NEXT: ... ; CHECK-NEXT: ...

View File

@ -22,7 +22,8 @@ define i32* @get_address_of_global_var() #0 {
define void @_start() #0 { define void @_start() #0 {
entry: entry:
%call = call i32* @get_address_of_global_var() %call1 = call i32* @get_address_of_global_var()
%call2 = call i8* @get_address_of_foo()
ret void ret void
} }
@ -81,12 +82,6 @@ entry:
; CHECK-NEXT: - Name: __data_end ; CHECK-NEXT: - Name: __data_end
; CHECK-NEXT: Kind: GLOBAL ; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 2 ; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: get_address_of_foo
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: get_address_of_global_var
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start ; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION ; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 3 ; CHECK-NEXT: Index: 3
@ -103,5 +98,5 @@ entry:
; CHECK-NEXT: Body: 4180808080000B ; CHECK-NEXT: Body: 4180808080000B
; CHECK-NEXT: - Index: 3 ; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals: ; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 1082808080001A0B ; CHECK-NEXT: Body: 1082808080001A1081808080001A0B
; CHECK-NEXT: ... ; CHECK-NEXT: ...

View File

@ -24,7 +24,7 @@ struct Configuration {
bool Demangle; bool Demangle;
bool DisableVerify; bool DisableVerify;
bool ExportAll; bool ExportAll;
bool ExportDefault; bool ExportDynamic;
bool ExportTable; bool ExportTable;
bool GcSections; bool GcSections;
bool ImportMemory; bool ImportMemory;

View File

@ -373,8 +373,8 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
Config->DisableVerify = Args.hasArg(OPT_disable_verify); Config->DisableVerify = Args.hasArg(OPT_disable_verify);
Config->Entry = getEntry(Args, Args.hasArg(OPT_relocatable) ? "" : "_start"); Config->Entry = getEntry(Args, Args.hasArg(OPT_relocatable) ? "" : "_start");
Config->ExportAll = Args.hasArg(OPT_export_all); Config->ExportAll = Args.hasArg(OPT_export_all);
Config->ExportDefault = Args.hasFlag(OPT_export_default, Config->ExportDynamic = Args.hasFlag(OPT_export_dynamic,
OPT_no_export_default, true); OPT_no_export_dynamic, false);
Config->ExportTable = Args.hasArg(OPT_export_table); Config->ExportTable = Args.hasArg(OPT_export_table);
errorHandler().FatalWarnings = errorHandler().FatalWarnings =
Args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false); Args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false);
@ -473,6 +473,11 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
WasmSym::DsoHandle = Symtab->addSyntheticDataSymbol( WasmSym::DsoHandle = Symtab->addSyntheticDataSymbol(
"__dso_handle", WASM_SYMBOL_VISIBILITY_HIDDEN); "__dso_handle", WASM_SYMBOL_VISIBILITY_HIDDEN);
WasmSym::DataEnd = Symtab->addSyntheticDataSymbol("__data_end", 0); WasmSym::DataEnd = Symtab->addSyntheticDataSymbol("__data_end", 0);
// These two synthetic symbols exist purely for the embedder so we always
// want to export them.
WasmSym::HeapBase->ForceExport = true;
WasmSym::DataEnd->ForceExport = true;
} }
createFiles(Args); createFiles(Args);
@ -507,7 +512,9 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
if (!Config->Entry.empty()) { if (!Config->Entry.empty()) {
EntrySym = handleUndefined(Config->Entry); EntrySym = handleUndefined(Config->Entry);
if (!EntrySym) if (EntrySym && EntrySym->isDefined())
EntrySym->ForceExport = true;
else
error("entry symbol not defined (pass --no-entry to supress): " + error("entry symbol not defined (pass --no-entry to supress): " +
Config->Entry); Config->Entry);
} }

View File

@ -30,9 +30,9 @@ defm demangle: B<"demangle",
"Demangle symbol names", "Demangle symbol names",
"Do not demangle symbol names">; "Do not demangle symbol names">;
defm export_default: B<"export-default", defm export_dynamic: B<"export-dynamic",
"Export symbols marked as 'default' visibility (default)", "Put symbols in the dynamic symbol table",
"Do not export symbols marked as 'default' visibility">; "Do not put symbols in the dynamic symbol table (default)">;
def entry: S<"entry">, MetaVarName<"<entry>">, def entry: S<"entry">, MetaVarName<"<entry>">,
HelpText<"Name of entry point symbol">; HelpText<"Name of entry point symbol">;
@ -144,12 +144,13 @@ defm whole_archive: B<"whole-archive",
"Do not force load of all members in a static library (default)">; "Do not force load of all members in a static library (default)">;
// Aliases // Aliases
def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>; def: JoinedOrSeparate<["-"], "e">, Alias<entry>;
def alias_entry_entry: J<"entry=">, Alias<entry>; def: J<"entry=">, Alias<entry>;
def alias_initial_memory_i: Flag<["-"], "i">, Alias<initial_memory>; def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">;
def alias_max_memory_m: Flag<["-"], "m">, Alias<max_memory>; def: Flag<["-"], "i">, Alias<initial_memory>;
def alias_relocatable_r: Flag<["-"], "r">, Alias<relocatable>; def: Flag<["-"], "m">, Alias<max_memory>;
def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>; def: Flag<["-"], "r">, Alias<relocatable>;
def: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
// LTO-related options. // LTO-related options.
def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">, def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">,

View File

@ -105,10 +105,10 @@ bool Symbol::isExported() const {
if (ForceExport || Config->ExportAll) if (ForceExport || Config->ExportAll)
return true; return true;
if (!Config->ExportDefault) if (Config->ExportDynamic && !isHidden())
return false; return true;
return !isHidden(); return false;
} }
uint32_t FunctionSymbol::getFunctionIndex() const { uint32_t FunctionSymbol::getFunctionIndex() const {