Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/eld/Driver/HexagonLinkDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class HexagonLinkDriver : public GnuLdDriver {

static bool isValidEmulation(llvm::StringRef Emulation);

static std::optional<llvm::Triple>
ParseEmulation(std::string pEmulation, eld::DiagnosticEngine *DiagEngine);

static std::string getInferredArch(llvm::StringRef Emulation) {
return "hexagon";
}
Expand Down
38 changes: 36 additions & 2 deletions lib/LinkerWrapper/HexagonLinkDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,41 @@ bool HexagonLinkDriver::createInputActions(

template <class T>
bool HexagonLinkDriver::processTargetOptions(llvm::opt::InputArgList &Args) {
return GnuLdDriver::processTargetOptions<T>(Args);
bool result = GnuLdDriver::processTargetOptions<T>(Args);
std::string emulation = Config.options().getEmulation().str();
// If a specific emulation was requested, apply it now.
if (!emulation.empty()) {
llvm::Triple TheTriple = Config.targets().triple();
std::optional<Triple> OptEmulationTriple =
ParseEmulation(emulation, Config.getDiagEngine());
// Report invalid emulation error for unknown emulation.
if (!OptEmulationTriple) {
DiagEngine->raise(eld::Diag::err_invalid_emulation) << emulation;
return false;
}
Triple EmulationTriple = OptEmulationTriple.value();
if (EmulationTriple.getArch() != Triple::UnknownArch)
TheTriple.setArch(EmulationTriple.getArch());
if (EmulationTriple.getOS() != Triple::OSType::UnknownOS)
TheTriple.setOS(EmulationTriple.getOS());
if (EmulationTriple.getEnvironment() != Triple::UnknownEnvironment)
TheTriple.setEnvironment(EmulationTriple.getEnvironment());
Config.targets().setTriple(TheTriple);
}
return result;
}

std::optional<Triple>
HexagonLinkDriver::ParseEmulation(std::string pEmulation,
eld::DiagnosticEngine *DiagEngine) {
std::optional<Triple> result =
StringSwitch<std::optional<Triple>>(pEmulation)
.Case("hexagonlinux", Triple("hexagon", "", "linux", "gnu"))
.Cases({"hexagonelf", "v68", "v69", "v71", "v71t", "v73", "v75",
"v77", "v79", "v81", "v83", "v85", "v87", "v89", "v91"},
Triple("hexagon", "", "", ""))
.Default(std::nullopt);
return result;
}

template <class T>
Expand All @@ -217,7 +251,7 @@ bool HexagonLinkDriver::processLLVMOptions(llvm::opt::InputArgList &Args) {

bool HexagonLinkDriver::isValidEmulation(llvm::StringRef Emulation) {
return llvm::StringSwitch<bool>(Emulation)
.Cases({"hexagonelf", "v68", "v69", "v71", "v71t"}, true)
.Cases({"hexagonelf", "hexagonlinux", "v68", "v69", "v71", "v71t"}, true)
.Cases({"v73", "v75", "v77", "v79", "v81", "v83", "v85", "v87", "v89",
"v91"},
true)
Expand Down
33 changes: 17 additions & 16 deletions lib/Target/Hexagon/HexagonEmulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@ static bool ELDEmulateHexagonELF(LinkerScript &pScript, LinkerConfig &pConfig) {
pConfig.targets().setBitClass(32);
llvm::StringRef Emulation = pConfig.options().getEmulation();
if (!Emulation.empty()) {
llvm::StringRef flag = llvm::StringSwitch<StringRef>(Emulation)
.Cases({"v68", "hexagonelf"}, "hexagonv68")
.Case("v69", "hexagonv69")
.Case("v71", "hexagonv71")
.Case("v71t", "hexagonv71t")
.Case("v73", "hexagonv73")
.Case("v75", "hexagonv75")
.Case("v77", "hexagonv77")
.Case("v79", "hexagonv79")
.Case("v81", "hexagonv81")
.Case("v83", "hexagonv83")
.Case("v85", "hexagonv85")
.Case("v87", "hexagonv87")
.Case("v89", "hexagonv89")
.Case("v91", "hexagonv91")
.Default("invalid");
llvm::StringRef flag =
llvm::StringSwitch<StringRef>(Emulation)
.Cases({"v68", "hexagonelf", "hexagonlinux"}, "hexagonv68")
.Case("v69", "hexagonv69")
.Case("v71", "hexagonv71")
.Case("v71t", "hexagonv71t")
.Case("v73", "hexagonv73")
.Case("v75", "hexagonv75")
.Case("v77", "hexagonv77")
.Case("v79", "hexagonv79")
.Case("v81", "hexagonv81")
.Case("v83", "hexagonv83")
.Case("v85", "hexagonv85")
.Case("v87", "hexagonv87")
.Case("v89", "hexagonv89")
.Case("v91", "hexagonv91")
.Default("invalid");
if (flag == "deprecated") {
pConfig.raise(Diag::deprecated_emulation)
<< pConfig.options().getEmulation();
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/BssLinkOrder/BssLinkOrder.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ RUN: %clang %clangopts -c %clangg0opts %p/Inputs/1.c -o %t1.o
RUN: %clang %clangopts -c %clangg0opts %p/Inputs/2.c -o %t2.o
RUN: %clang %clangopts -c %clangg0opts %p/Inputs/3.c -o %t3.o
RUN: %clang %clangopts -c %clangg0opts %p/Inputs/4.c -o %t4.o
RUN: %link %linkopts %linkg0opts %t1.o %t2.o %t3.o %t4.o -o %t.out
RUN: %link %emulation %linkopts %linkg0opts %t1.o %t2.o %t3.o %t4.o -o %t.out
RUN: %nm -n %t.out | %filecheck %s

#CHECK: B b
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/CommentGC/commentgc.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Check that the .comment section is not garbage collected.
RUN: %clang %clangopts -c %p/Inputs/1.s -o %t1.o
RUN: %link %linkopts %t1.o -o %t2.out -e main --gc-sections
RUN: %link %emulation %linkopts %t1.o -o %t2.out -e main --gc-sections
RUN: %readelf -S %t2.out | %filecheck %s

#CHECK: .comment
2 changes: 1 addition & 1 deletion test/Hexagon/linux/CommonsGC/CommonsGC.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUN: %clang %clangopts -c -ffunction-sections -fdata-sections %p/Inputs/1.c -o %t1.o
RUN: %link %linkopts %t1.o -o %t.out --gc-sections --entry=main 2>&1
RUN: %link %emulation %linkopts %t1.o -o %t.out --gc-sections --entry=main 2>&1
RUN: %readelf -s %t.out | %grep 'common' | %filecheck %s

#CHECK: 1 OBJECT GLOBAL DEFAULT 2 commonChar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUN: %clang %clangopts -c -ffunction-sections -fdata-sections %p/Inputs/1.c -fpic -o %t1.o
RUN: %link %linkopts %t1.o -o %t.out -dy -shared --gc-sections --entry=main 2>&1
RUN: %link %emulation %linkopts %t1.o -o %t.out -dy -shared --gc-sections --entry=main 2>&1
RUN: %readelf -s %t.out | %filecheck %s

#CHECK-DAG: 4 OBJECT GLOBAL DEFAULT 9 commonInt
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/CommonsGnuHash/CommonsGnuHash.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#START_TEST

RUN: %clang %clangopts -c -fpic %p/Inputs/1.c -o %t.o
RUN: %link %linkopts -shared -hash-style=gnu -o %t.so %t.o
RUN: %link %emulation %linkopts -shared -hash-style=gnu -o %t.so %t.o
RUN: %readelf -I %t.so

CHECK: Histogram for `.gnu.hash' bucket list length (total of 3 buckets):
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/CrefTable/CrefTable.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RUN: %clang %clangopts -c -ffunction-sections -fdata-sections %p/Inputs/1.c -o %t1.o
RUN: %clang %clangopts -c -ffunction-sections -fdata-sections %p/Inputs/2.c -o %t2.o
RUN: %clang %clangopts -c -ffunction-sections -fdata-sections %p/Inputs/3.c -o %t3.o
RUN: %link %linkopts %t1.o %t2.o %t3.o --cref -o %t.out --gc-sections --entry=main | %filecheck %s
RUN: %link %emulation %linkopts %t1.o %t2.o %t3.o --cref -o %t.out --gc-sections --entry=main | %filecheck %s

#CHECK: bar {{.*tmp2.o}}
#CHECK: {{.*tmp3.o}}
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/DebugRelocs/debugRelocs.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Check that Debug sections are fixed up properly.
RUN: %clang %clangopts -c %p/Inputs/crap.c -o %t1.o -g
RUN: %clang %clangopts -c %p/Inputs/hello.c -o %t2.o -g
RUN: %link %linkopts %t1.o %t2.o -o %t.out --noinhibit-exec
RUN: %link %emulation %linkopts %t1.o %t2.o -o %t.out --noinhibit-exec
RUN: %dwarfdump -debug-info %t.out | %filecheck %s

#CHECK: DW_AT_producer ("{{.*}}{{[cC]}}lang
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/DefSym/defsym.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This tests defsym functionality by adding two symbols.
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o %clangg0opts
RUN: %link %linkopts --defsym B=10 --defsym A=20 %t1.o -o %t2
RUN: %link %emulation %linkopts --defsym B=10 --defsym A=20 %t1.o -o %t2
RUN: %nm -n %t2 | %filecheck %s

#CHECK: 0000000a A B
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/DiscardWithDebug/DiscardWithDebug.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#END_COMMENT
#
RUN: %clang %clangopts -c -g %p/Inputs/1.c -ffunction-sections -o %t1.o
RUN: %link %linkopts -o %t.out %t1.o -T %p/Inputs/script.t
RUN: %link %emulation %linkopts -o %t.out %t1.o -T %p/Inputs/script.t
RUN: %readelf -s %t.out | %filecheck %s

CHECK-NOT: {{ baz}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# the march is not the same as the arch from the triple.
#END_COMMENT
RUN: %clang %clangopts -c %p/Inputs/1.c -ffunction-sections -o %t1.o
RUN: %link %linkopts -march hexagon-unknown-linux-elf -o %t.out %t1.o
RUN: %link %emulation %linkopts -march hexagon-unknown-linux-elf -o %t.out %t1.o
RUN: %readelf -l -W %t.out | %filecheck %s

#CHECK: LOAD 0x000000 {{.*}} 0x10000
4 changes: 2 additions & 2 deletions test/Hexagon/linux/DynExHiddenSym/DynExHiddenSym.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
RUN: %clang %clangopts -c %clangg0opts %p/Inputs/1.c -o %t1.o -fPIC
RUN: %clang %clangopts -c %clangg0opts %p/Inputs/2.c -o %t2.o -fPIC
RUN: %clang %clangopts -c %clangg0opts %p/Inputs/3.c -o %t3.o -fPIC
RUN: %link %linkopts -shared %t3.o -o %t3.so
RUN: %link %linkopts -Bdynamic %t1.o %t2.o %t3.so -o %t.out
RUN: %link %emulation %linkopts -shared %t3.o -o %t3.so
RUN: %link %emulation %linkopts -Bdynamic %t1.o %t2.o %t3.so -o %t.out
RUN: %readelf -r -W %t.out | %filecheck %s

CHECK: R_HEX_RELATIVE
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/DynExeWithAr/DynExeWithAr.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: rm -rf %t4
RUN: mkdir %t4
RUN: %ar cr %aropts %t4/libfn.a %t3.o
RUN: %ar cr %aropts %t4/libfn1.a %t2.o
RUN: %link %linkopts -dy -Bdynamic %t1.o -L%t4 --start-group -lfn -lfn1 --end-group --force-dynamic -o %t.out
RUN: %link %emulation %linkopts -dy -Bdynamic %t1.o -L%t4 --start-group -lfn -lfn1 --end-group --force-dynamic -o %t.out
RUN: %readelf -s %t.out | %filecheck %s

CHECK: fn1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.1.o
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t1.2.o
RUN: %ar cr %aropts %t1.lib2.a %t1.2.o
RUN: %link %linkopts --force-dynamic %t1.1.o %t1.lib2.a --dynamic-list=%p/Inputs/dynamicList --force-dynamic -t -o %t2.out 2>&1 | %filecheck %s -check-prefix=PULL
RUN: %link %emulation %linkopts --force-dynamic %t1.1.o %t1.lib2.a --dynamic-list=%p/Inputs/dynamicList --force-dynamic -t -o %t2.out 2>&1 | %filecheck %s -check-prefix=PULL
RUN: %readelf --dyn-syms -W %t2.out | %filecheck %s

#PULL-NOT: lib2.a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test that GC works when dynamic list contains undefined symbols.
RUN: %clang %clangopts -c %p/Inputs/1.c -fPIC -o %t1.1.o
RUN: %link %linkopts --dynamic-list=%p/Inputs/dynList %t1.1.o --force-dynamic -o %t2.out
RUN: %link %emulation %linkopts --dynamic-list=%p/Inputs/dynList %t1.1.o --force-dynamic -o %t2.out
RUN: %readelf --dyn-symbols %t2.out | %filecheck %s

#CHECK-NOT: foo
2 changes: 1 addition & 1 deletion test/Hexagon/linux/ExcludeArchieve/Exclude.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
RUN: %clang %clangopts -c %p/1.c -w -ffunction-sections -o %t1.o
RUN: %clang %clangopts -c %p/2.c -w -ffunction-sections -o %t2.o
RUN: %ar cr %aropts %tlib2.a %t2.o
RUN: %link %linkopts %t1.o %tlib2.a -T %p/script.t -o %t.out
RUN: %link %emulation %linkopts %t1.o %tlib2.a -T %p/script.t -o %t.out
RUN: %readelf -a %t.out | %filecheck %s

CHECK: .mybar PROGBITS
4 changes: 2 additions & 2 deletions test/Hexagon/linux/ExportFromExe/ExportFromExe.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#END_COMMENT
RUN: %clang %clangopts -c -fpic -O2 %p/Inputs/dso.c -ffunction-sections -fdata-sections -o %t1.o
RUN: %clang %clangopts -c %p/Inputs/test.c -ffunction-sections -fdata-sections -o %t2.o
RUN: %link %linkopts -shared -o %t.dso.so %t1.o
RUN: %link %linkopts -Bdynamic %t2.o %t.dso.so -o %t.out
RUN: %link %emulation %linkopts -shared -o %t.dso.so %t1.o
RUN: %link %emulation %linkopts -Bdynamic %t2.o %t.dso.so -o %t.out
RUN: %readelf --dyn-syms %t.out | %filecheck %s

#CHECK-NOT: COM
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/ExternList/externList.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t2.o
RUN: %ar cr %tlib.a %t2.o
RUN: %link %linkopts %t1.o %tlib.a -o %t.out --extern-list=%p/Inputs/list --force-dynamic 2>&1
RUN: %link %emulation %linkopts %t1.o %tlib.a -o %t.out --extern-list=%p/Inputs/list --force-dynamic 2>&1
RUN: %readelf -s %t.out | %filecheck %s

#CHECK: {{[0-9a-f]+}}: {{[0-9a-f]+}} 12 FUNC GLOBAL DEFAULT 5 foo
2 changes: 1 addition & 1 deletion test/Hexagon/linux/ExternListUndef/externList.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t2.o
RUN: %ar cr %tlib.a %t2.o
RUN: %link %linkopts %t1.o %tlib.a -o %t.out --extern-list=%p/Inputs/list 2>&1
RUN: %link %emulation %linkopts %t1.o %tlib.a -o %t.out --extern-list=%p/Inputs/list 2>&1
RUN: %readelf -s %t.out | %filecheck %s

#CHECK: UND externSym
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/ForceDynPerm/ForceDynPerm.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test that hidden symbols are not exported.
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o
RUN: %link %linkopts --rosegment -force-dynamic %t1.o -o %t.out -z max-page-size=4096 2>&1
RUN: %link %emulation %linkopts --rosegment -force-dynamic %t1.o -o %t.out -z max-page-size=4096 2>&1
RUN: %readelf -l -W %t.out | %filecheck %s

# CHECK: PHDR {{[x0-9a-z]+}} {{[x0-9a-z]+}} {{[x0-9a-z]+}} {{[x0-9a-z]+}} {{[x0-9a-z]+}} R E {{[x0-9a-z]+}}
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/GCCref/GCCref.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUN: %clang %clangopts -c -ffunction-sections -fdata-sections %p/Inputs/1.c -fpic %clangg0opts -o %t1.o
RUN: %link %linkopts %t1.o -o %t.out --gc-sections --entry=main --gc-cref=.text.bar --trace=garbage-collection 2>&1 | %filecheck %s
RUN: %link %emulation %linkopts %t1.o -o %t.out --gc-sections --entry=main --gc-cref=.text.bar --trace=garbage-collection 2>&1 | %filecheck %s

#CHECK-DAG: .text.main _GLOBAL_OFFSET_TABLE_ (Symbol)
#CHECK-DAG: commonChar (Symbol)
Expand Down
4 changes: 2 additions & 2 deletions test/Hexagon/linux/GCFailOnNoEntry/GCFailOnNoEntry.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o -ffunction-sections -fdata-sections
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t2.o -ffunction-sections -fdata-sections
RUN: %ar cr %tlib.a %t2.o
RUN: %link %linkopts %t1.o %tlib.a -o %t.out --extern-list=%p/Inputs/list --gc-sections -e FOO -u FOO 2>&1 | %filecheck -check-prefix=GCWARN %s
RUN: %link %emulation %linkopts %t1.o %tlib.a -o %t.out --extern-list=%p/Inputs/list --gc-sections -e FOO -u FOO 2>&1 | %filecheck -check-prefix=GCWARN %s
RUN: %clang %clangopts -c %p/Inputs/3.c -o %t3.o -ffunction-sections -fdata-sections
RUN: %not %link %linkopts %t3.o -o %t3.out --gc-sections -u main 2>&1 | %filecheck %s -check-prefix=GCERR
RUN: %not %link %emulation %linkopts %t3.o -o %t3.out --gc-sections -u main 2>&1 | %filecheck %s -check-prefix=GCERR

#GCWARN: Warning: FOO Entry symbol not found

Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/GCexternList/GCexternList.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o -ffunction-sections -fdata-sections
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t2.o -ffunction-sections -fdata-sections
RUN: %ar cr %aropts %tlib.a %t2.o
RUN: %link %linkopts %t1.o %tlib.a --entry main -o %t.out --extern-list=%p/Inputs/list --gc-sections 2>&1
RUN: %link %emulation %linkopts %t1.o %tlib.a --entry main -o %t.out --extern-list=%p/Inputs/list --gc-sections 2>&1
RUN: %nm -n %t.out | %filecheck %s

#CHECK: U externSym
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/HiddenSharedLibrary/hidden.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test that hidden symbols are not exported.
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.o -fPIC
RUN: %link %linkopts -shared %t1.o -o %t.out 2>&1
RUN: %link %emulation %linkopts -shared %t1.o -o %t.out 2>&1
RUN: %readelf --dyn-symbols %t.out | %filecheck %s --check-prefix="SYMS"
RUN: %readelf --section-headers %t.out | %filecheck %s --check-prefix="INTERP"

Expand Down
10 changes: 5 additions & 5 deletions test/Hexagon/linux/LNamespec/lnamespec.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ RUN: %clang %clangopts -c %p/Inputs/2.c -fPIC -o %t2.o
RUN: mkdir -p temp
RUN: %ar cr %aropts temp/mylib.a %t2.o
RUN: %ar cr %aropts temp/mylib.random %t2.o
RUN: %link --no-emit-relocs %linkopts -shared %t2.o -o temp/myshlib.so
RUN: %link --no-emit-relocs %linkopts %t1.o -Ltemp -l:mylib.a -o %t3
RUN: %link --no-emit-relocs %linkopts %t1.o -dy -Ltemp -l:myshlib.so -o %t4
RUN: %link --no-emit-relocs %linkopts %t1.o -static -dy -Ltemp -l:myshlib.so -o %t5
RUN: %link --no-emit-relocs %linkopts %t1.o -Ltemp -l:mylib.random -o %t6
RUN: %link %emulation --no-emit-relocs %linkopts -shared %t2.o -o temp/myshlib.so
RUN: %link %emulation --no-emit-relocs %linkopts %t1.o -Ltemp -l:mylib.a -o %t3
RUN: %link %emulation --no-emit-relocs %linkopts %t1.o -dy -Ltemp -l:myshlib.so -o %t4
RUN: %link %emulation --no-emit-relocs %linkopts %t1.o -static -dy -Ltemp -l:myshlib.so -o %t5
RUN: %link %emulation --no-emit-relocs %linkopts %t1.o -Ltemp -l:mylib.random -o %t6
RUN: %readelf -s -W %t3 | %filecheck %s -check-prefix=AR
RUN: %readelf -a %t4 | %filecheck %s -check-prefix=SO
RUN: %readelf -a %t5 | %filecheck %s -check-prefix=SO
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/LTO/CommonSymbols/commonsyms.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tests that common symbols are preserved.
RUN: %clang %clangopts -c -flto %p/Inputs/1.c -o %t1.o
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t2.o
RUN: %link %linkopts -M %t1.o %t2.o -o %t3.out --trace=lto 2>&1 | %filecheck %s
RUN: %link %emulation %linkopts -M %t1.o %t2.o -o %t3.out --trace=lto 2>&1 | %filecheck %s

#CHECK: common
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: %clang %clangopts -c %p/Inputs/c.c -o %t4
RUN: %ar cr %aropts %t5 %t2
RUN: %ar cr %aropts %t6 %t3
RUN: %ar cr %aropts %t7 %t4
RUN: %link %linkopts -M -flto-options=preserveall %t1 --start-group %t5 %t7 %t6 --end-group -o %t8
RUN: %link %emulation %linkopts -M -flto-options=preserveall %t1 --start-group %t5 %t7 %t6 --end-group -o %t8
RUN: %readelf -s %t8 | %grep "foo" | %filecheck %s -check-prefix YES
RUN: %readelf -s %t8 | %grep "bar" | %filecheck %s -check-prefix YES
RUN: %readelf -s %t8 | %grep "baz" | %filecheck %s -check-prefix YES
Expand Down
2 changes: 1 addition & 1 deletion test/Hexagon/linux/LTO/LTOBitCode/ltobitcode.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
RUN: %clang %clangopts -c %p/Inputs/main.c -o %t1.main.o
RUN: %clang %clangopts -c -flto %p/Inputs/foo.c -o %t1.foo.o
RUN: %clang %clangopts -c -flto %p/Inputs/bar.c -o %t1.bar.o
RUN: %link %linkopts %t1.main.o %t1.foo.o %t1.bar.o -o %t2.out --trace=lto 2>&1 | %filecheck %s -check-prefix=PRESERVE
RUN: %link %emulation %linkopts %t1.main.o %t1.foo.o %t1.bar.o -o %t2.out --trace=lto 2>&1 | %filecheck %s -check-prefix=PRESERVE

#PRESERVE-NOT: bar
#PRESERVE: foo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.1.o -flto
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t1.2.o -flto
RUN: %clang %clangopts -c %p/Inputs/3.c -o %t1.3.o -flto
RUN: %clang %clangopts -c %p/Inputs/4.c -o %t1.4.o
RUN: %link %linkopts %t1.1.o %t1.2.o %t1.3.o %t1.4.o -o %t3.out --trace=symbol=baz --trace=lto 2>&1 | %filecheck %s
RUN: %link %emulation %linkopts %t1.1.o %t1.2.o %t1.3.o %t1.4.o -o %t3.out --trace=symbol=baz --trace=lto 2>&1 | %filecheck %s

#CHECK: Symbol `baz' from Input file `{{[ -\(\)_A-Za-z0-9.~\\/:]+}}' with info `(ELF)(FUNCTION)(DEFINE)[Local]{DEFAULT}' being added to Namepool
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.1.o -flto
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t1.2.o -flto
RUN: %clang %clangopts -c %p/Inputs/3.c -o %t1.3.o
RUN: %link -o %t1.out.1 %linkopts %t1.1.o %t1.2.o %t1.3.o --trace=lto 2>&1 | %filecheck %s
RUN: %link %emulation -o %t1.out.1 %linkopts %t1.1.o %t1.2.o %t1.3.o --trace=lto 2>&1 | %filecheck %s

#CHECK: a
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Checks that commons are selected from the right files even after LTO.
RUN: %clang %clangopts -c -flto -ffunction-sections -fdata-sections %p/Inputs/1.c -o %t1.1.o
RUN: %clang %clangopts -c -flto -ffunction-sections -fdata-sections %p/Inputs/2.c -o %t1.2.o
RUN: %link %linkopts %t1.1.o %t1.2.o -flto-options=codegen="-function-sections -data-sections" -T %p/Inputs/script.t -o %t2.out
RUN: %link %emulation %linkopts %t1.1.o %t1.2.o -flto-options=codegen="-function-sections -data-sections" -T %p/Inputs/script.t -o %t2.out
RUN: %readelf -S -W %t2.out | %filecheck %s

#CHECK-NOT: mysmallcommons1 PROGBITS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -flto -o %t1.1.o
RUN: %clang %clangopts -c %p/Inputs/2.c -o %t1.2.o
RUN: %clang %clangopts -c %p/Inputs/3.c -o %t1.3.o
RUN: %link %linkopts %t1.1.o %t1.2.o %t1.3.o -o %t3.out --trace=lto 2>&1 | %filecheck %s -check-prefix=PRESERVE
RUN: %link %emulation %linkopts %t1.1.o %t1.2.o %t1.3.o -o %t3.out --trace=lto 2>&1 | %filecheck %s -check-prefix=PRESERVE

#PRESERVE-NOT: Preserving symbol baz
2 changes: 1 addition & 1 deletion test/Hexagon/linux/LTO/LTOGroups/ltogroups.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: %clang %clangopts -c %p/Inputs/c.c -o %t4
RUN: %ar cr %aropts %t5 %t2
RUN: %ar cr %aropts %t6 %t3
RUN: %ar cr %aropts %t7 %t4
RUN: %link %linkopts -M -flto-options=preserveall %t1 --start-group %t5 %t7 %t6 --end-group -o %t8
RUN: %link %emulation %linkopts -M -flto-options=preserveall %t1 --start-group %t5 %t7 %t6 --end-group -o %t8
RUN: %readelf -s %t8 | %grep "foo" | %filecheck %s -check-prefix YES
RUN: %readelf -s %t8 | %grep "bar" | %filecheck %s -check-prefix YES
RUN: %readelf -s %t8 | %grep "baz" | %filecheck %s -check-prefix YES
Expand Down
Loading
Loading