[all-commits] [llvm/llvm-project] 70a19a: [profile] Change __llvm_profile_counter_bias etc. ...

Rainer Orth via All-commits all-commits at lists.llvm.org
Tue Sep 3 05:30:10 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70a19adbc60c738903bbbb8e6d5ef2d41b681089
      https://github.com/llvm/llvm-project/commit/70a19adbc60c738903bbbb8e6d5ef2d41b681089
  Author: Rainer Orth <ro at gcc.gnu.org>
  Date:   2024-09-03 (Tue, 03 Sep 2024)

  Changed paths:
    M compiler-rt/lib/profile/InstrProfilingFile.c
    M compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
    M compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c
    M compiler-rt/test/profile/ContinuousSyncMode/set-file-object.c

  Log Message:
  -----------
  [profile] Change __llvm_profile_counter_bias etc. types to match llvm (#102747)

As detailed in Issue #101667, two `profile` tests `FAIL` on 32-bit
SPARC, both Linux/sparc64 and Solaris/sparcv9 (where the tests work when
enabled):
```
  Profile-sparc :: ContinuousSyncMode/runtime-counter-relocation.c
  Profile-sparc :: ContinuousSyncMode/set-file-object.c
```
The Solaris linker provides the crucial clue as to what's wrong:
```
ld: warning: symbol '__llvm_profile_counter_bias' has differing sizes:
	(file runtime-counter-relocation-17ff25.o value=0x8; file libclang_rt.profile-sparc.a(InstrProfilingFile.c.o) value=0x4);
	runtime-counter-relocation-17ff25.o definition taken
```
In fact, the types in `llvm` and `compiler-rt` differ:
- `__llvm_profile_counter_bias`/`INSTR_PROF_PROFILE_COUNTER_BIAS_VAR` is
created in `llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp`
(`InstrLowerer::getCounterAddress`) as `int64_t`, while
`compiler-rt/lib/profile/InstrProfilingFile.c` uses `intptr_t`. While
this doesn't matter in the 64-bit case, the type sizes differ for
32-bit.
- `__llvm_profile_bitmap_bias`/`INSTR_PROF_PROFILE_BITMAP_BIAS_VAR` has
the same issue: created in `InstrProfiling.cpp`
(`InstrLowerer::getBitmapAddress`) as `int64_t`, while
`InstrProfilingFile.c` again uses `intptr_t`.

This patch changes the `compiler-rt` types to match `llvm`. At the same
time, the affected testcases are enabled on Solaris, too, where they now
just `PASS`.

Tested on `sparc64-unknown-linux-gnu`, `sparcv9-sun-solaris2.11`,
`x86_64-pc-linux-gnu`, and `amd64-pc-solaris2.11.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list