[llvm] [DebugInfo] (Always) include the dwo name in the hash (PR #100375)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 01:42:36 PDT 2024


labath wrote:

My reproducer is basically this:
```
==> a.cc <==
#include "enum.h"

__attribute__((visibility("hidden"))) void FFF(E e) {}

==> b.sh <==
#!/bin/bash

set -e -x

clang++ -flto=thin -O2 -c -o a.obc ../a.cc -g -gsplit-dwarf -DFFF=fa
clang++ -flto=thin -O2 -c -o b.obc ../a.cc -g -gsplit-dwarf -DFFF=fb
clang++ -flto=thin -O2 -c -o main.obc ../main.cc -g -gsplit-dwarf

clang++ -fuse-ld=lld -flto=thin -O2 -g -gsplit-dwarf {a,b,main}.obc -Wl,--thinlto-index-only,--thinlto-emit-imports-files

for i in a b main; do
  clang++ -flto=thin -O2 -c -fthinlto-index=$i.obc.thinlto.bc -o $i.l.bc $i.obc -g -gsplit-dwarf
  clang++ $i.l.bc -g -gsplit-dwarf -c -o $i.l.o
done

clang++ {a,b,main}.l.o -o a.out

==> enum.h <==
#ifndef LTO_ENUM_H_
#define LTO_ENUM_H_

enum E { ea, eb, ec };

#endif  // LTO_ENUM_H_

==> main.cc <==
#include "enum.h"

void fa(E e);
void fb(E e);

int main() {
//  fa(E());
//  fb(E());
}
```

The only thing that's left in the compile units is the enum definition. In the original bugreport, the compile unit contains a bunch of enums plus one pointer type definition (`uint8_t (*)[4]`) and the things referenced by it. I guess the enums are there because there's no way to home them. I'm not sure what caused the other type to appear.

https://github.com/llvm/llvm-project/pull/100375


More information about the llvm-commits mailing list