-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"obf name not found, this should never happen" when build with obfuscation enabled #19695
Comments
After I tried debugging, it seems that the g.obf_table is always empty? // vlib/v/gen/c/cgen.v
if g.pref.obfuscate {
mut i := 0
// fns
for key, f in g.table.fns {
println('key: ${key}, f: ${f}')
if f.mod != 'main' && key != 'main' {
continue
}
println('inserting key ${key} into the obf_table?')
g.obf_table[key] = '_f${i}'
i++
}
// ... // vlib/v/gen/c/fn.v
if g.pref.obfuscate && g.cur_mod.name == 'main' && name.starts_with('main__') && !node.is_main
&& node.name != 'str' {
mut key := node.name
if node.is_method {
sym := g.table.sym(node.receiver.typ)
key = sym.name + '.' + node.name
}
g.writeln('/* obf: ${key} */')
name = g.obf_table[key] or {
println('obf_table: ${g.obf_table}')
println('${node}')
panic('cgen: fn_decl: obf name "${key}" not found, this should never happen')
}
}
// ...
Race condition? |
All you need to show the error is |
Thanks! |
Ok more debug information. // vlib/v/gen/c/cgen.v
for key, f in g.table.fns {
println('key: ${key}, f: ${f}')
if f.mod != 'main' && key != 'main' {
continue
}
println('inserting key ${key} into the obf_table?')
g.obf_table[key] = '_f${i}'
println('table after inserting key ${key}: ${g.obf_table}')
i++
}
// ...
|
Good find, looks we are not testing -obf, need to add it to CI. |
Describe the bug
obf name "main.xx" not found, this should never happen
when building with -obf flagsReproduction Steps
test.v:
v -o test -autofree -show-timings -obf -skip-unused -prod -arch x64 -os linux -cc gcc test.v
Edit: minimized the reproduction build step.
v -o test -obf test.v
Expected Behavior
It build
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
0.4.2 00165d1
Environment details (OS name and version, etc.)
V full version: V 0.4.2 714a64d.00165d1
OS: linux, "Gentoo Linux"
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
getwd: /home/rori/code/stuff
vexe: /home/rori/code/v/v
vexe mtime: 2023-10-29 09:53:09
vroot: OK, value: /home/rori/code/v
VMODULES: OK, value: /home/rori/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.41.0
Git vroot status: weekly.2023.43-43-g00165d14
.git/config present: true
CC version: cc (Gentoo 13.2.1_p20230826 p7) 13.2.1 20230826
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: