PPeter CollingbourneFix more compiler-rt tests after #149015.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[AIX] Add a dummy variable in the __llvm_orderfile section (#81968) to satisfy the __start___llvm_orderfile reference when linking with -bexpfull and -fprofile-generate on AIX. | 2 年前 | |
[AIX][PGO] Teach profile runtime to read build-id On AIX, the build-id can be embedded in a binary using the -mxcoff-build-id compiler option. When present, the build id is stored as an ascii string at the beginning of the string table in the loader section of the XCOFF file. Reviewed By: stephenpeckham, daltenty Differential Revision: https://reviews.llvm.org/D146976 | 3 年前 | |
[AIX][PGO] Teach profile runtime to read build-id On AIX, the build-id can be embedded in a binary using the -mxcoff-build-id compiler option. When present, the build id is stored as an ascii string at the beginning of the string table in the loader section of the XCOFF file. Reviewed By: stephenpeckham, daltenty Differential Revision: https://reviews.llvm.org/D146976 | 3 年前 | |
Add a testcase for D136192. Differential Revision: https://reviews.llvm.org/D136192 | 3 年前 | |
[AIX][PGO] Handle atexit functions when dlclose'ing shared libraries (#102940) Problem: On AIX, functions registered by atexit in a shared library are not run when the library is dlclosed, but instead run (and fail because the function pointer is no longer valid) during main program exit. The profile-rt registers some functions with atexit: 1. writeFileWithoutReturn that writes out the profile file 2. llvm_delete_reset_function_list that does some cleanup in the gcov instrumentation library (not sure) And so right now, we get an "Illegal instruction (core dumped)" when an instrumented shared object is dlopen'ed and dlclosed. Solution: When a shared library is dlclose'd, destructors from the library are called. So create a destructor function that iterates over all known functions that profile-rt registers with atexit, and unregister the ones that have been registered and execute them. Scenarios tested: (0) gcov dlopen/dlclose (AIX/gcov-dlopen-dlclose.test) (1) multiple dlopen/dlclose of the same lib and multiple libs (instrprof-dlopen-dlclose.test) (2) dlopen but no dlclose (exists: Posix/instrprof-dlopen.test) (3) a simple fork testcase with dlopen/dlclose (instrprof-dlopen-dlclose.test) (4) dlopen/dlclose by multiple threads. (instrprof-dlopen-dlclose.test) (5) regular dynamic-linking of instrumented shared libs (exists: AIX/shared-bexpall-pgo.c) (6) a simple fork testcase produces correct profile (instrprof-fork.c) --------- Co-authored-by: Hubert Tong <hstong@ca.ibm.com> | 1 年前 | |
[PGO] Initialize GCOV Writeout and Reset Functions in the Runtime on AIX (#108570) This PR registers the writeout and reset functions for gcov for all modules in the PGO runtime, instead of registering them using global constructors in each module. The change is made for AIX only, but the same mechanism works on Linux on Power. When registering such functions using global constructors in each module without -ffunction-sections, the AIX linker cannot garbage collect unused undefined symbols, because such symbols are grouped in the same section as the __sinit symbol. Keeping such undefined symbols causes link errors (see test case https://github.com/llvm/llvm-project/pull/108570/files#diff-500a7e1ba871e1b6b61b523700d5e30987900002add306e1b5e4972cf6d5a4f1R1 for this scenario). This PR implements the initialization in the runtime, hence avoiding introducing __sinit into each module. The implementation adds a new global variable __llvm_covinit_functions to each module. This new global variable contains the function pointers to the Writeout and Reset functions. __llvm_covinit_functions's section is the named section __llvm_covinit. The linker will aggregate all the __llvm_covinit sections from each module to form one single named section in the final binary. The pair of functions const __llvm_gcov_init_func_struct *__llvm_profile_begin_covinit(); const __llvm_gcov_init_func_struct *__llvm_profile_end_covinit(); are implemented to return the start and end address of this named section in the final binary, and they are used in function __llvm_profile_gcov_initialize() (which is a constructor function in the runtime) so the runtime knows the addresses of all the Writeout and Reset functions from all the modules. One noticeable implementation detail relevant to AIX is that to preserve the __llvm_covinit from the linker's garbage collection, a .ref pseudo instruction is inserted into them, referring to the section that contains the __llvm_gcov_ctr variables, which are used in the instrumented code. The __llvm_gcov_ctr variables did not belong to named sections before, but this PR added them to the __llvm_gcov_ctr_section named section, so we can add a .ref pseudo instruction that refers to them in the __llvm_covinit section. | 1 年前 | |
Fix more compiler-rt tests after #149015. | 1 年前 | |
[compiler-rt][profile][tests][NFC] Avoid using a.out from PATH (#136465) Fix use of a.out from the PATH by specifying ./a.out. | 1 年前 | |
[PGO][AIX] Improve dummy var retention and allow -bcdtors:csect linking. 1) Use a static array of pointer to retain the dummy vars. 2) Associate liveness of the array with that of the runtime hook variable __llvm_profile_runtime. 3) Perform the runtime initialization through the runtime hook variable. 4) Preserve the runtime hook variable using the -u linker flag. Reviewed By: hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D136192 | 3 年前 |