Skip to content

Commit

Permalink
Fix sidecar_mockgen with alpine/musl
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
  • Loading branch information
bwoebi committed Apr 27, 2023
1 parent dbe217a commit 2ec7a35
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/sidecar_mockgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ pub fn generate_mock_symbols(binary: &Path, objects: &[&Path]) -> Result<String,
if missing_symbols.contains(name) {
_ = match sym.kind() {
SymbolKind::Text => writeln!(generated, "void {}() {{}}", name),
SymbolKind::Data => writeln!(generated, "char {}[{}];", name, sym.size()),
// Ignore symbols of size 0, like _GLOBAL_OFFSET_TABLE_ on alpine
SymbolKind::Data => {
if sym.size() > 0 {
writeln!(generated, "char {}[{}];", name, sym.size())
} else {
Ok(())
}
},
SymbolKind::Tls => {
writeln!(generated, "__thread char {}[{}];", name, sym.size())
}
Expand Down

0 comments on commit 2ec7a35

Please sign in to comment.