Skip to content

Commit e03669a

Browse files
authored
[profile][test] Build Posix/instrprof-dlopen-norpath.test objects as PIC (#106406)
`Profile-x86_64 :: Posix/instrprof-dlopen-norpath.test` `FAILs` on Solaris/amd64 and similarly on Solaris/sparcv9: ``` RUN: at line 10: ./a.out 2>&1 | FileCheck compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test -check-prefix=CHECK-FOO + ./a.out + FileCheck compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test -check-prefix=CHECK-FOO compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test:24:12: error: CHECK-FOO: expected string not found in input CHECK-FOO: foo: ^ <stdin>:1:1: note: scanning from here unable to lookup symbol 'foo': ld.so.1: a.out: invalid handle: 0x0 ``` The problem turned out to be two-fold: `OPEN_AND_RUN` didn't check the `dlopen` return value and the objects linked into the shared objects to be `dlopen`ed aren't built as PIC. This patch fixes the latter. Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`.
1 parent b978bcc commit e03669a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RUN: rm -rf %t && split-file %s %t && cd %t
2-
RUN: %clang_pgogen foo.c -c -Xclang -fprofile-instrument-path="default_foo_%m.profraw"
3-
RUN: %clang_pgogen foo2.c -c -Xclang -fprofile-instrument-path="default_foo2_%m.profraw"
2+
RUN: %clang_pgogen -fPIC foo.c -c -Xclang -fprofile-instrument-path="default_foo_%m.profraw"
3+
RUN: %clang_pgogen -fPIC foo2.c -c -Xclang -fprofile-instrument-path="default_foo2_%m.profraw"
44
RUN: %clang_pgogen -shared foo.o -o shr_foo.o %if target={{.*aix.*}} %{ -bcdtors:mbr %}
55
RUN: %clang_pgogen -shared foo2.o -o shr_foo2.o
66

0 commit comments

Comments
 (0)