Skip to content
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

gumcmodule-runtime.h:3414:70: error: dlclose undeclared #719

Closed
milahu opened this issue Feb 11, 2023 · 1 comment · Fixed by #720
Closed

gumcmodule-runtime.h:3414:70: error: dlclose undeclared #719

milahu opened this issue Feb 11, 2023 · 1 comment · Fixed by #720

Comments

@milahu
Copy link
Contributor

milahu commented Feb 11, 2023

fails to compile with vanilla tinycc

[99/181] Compiling C object bindings/gumjs/libfrida-gumjs-1.0.so.p/gumcmodule.c.o
FAILED: bindings/gumjs/libfrida-gumjs-1.0.so.p/gumcmodule.c.o 
gcc ... -o bindings/gumjs/libfrida-gumjs-1.0.so.p/gumcmodule.c.o -c ../bindings/gumjs/gumcmodule.c
In file included from /nix/store/i4dqcpppyyq5yqcvw95mv5s11yfyy8pf-glib-2.74.3/lib/glib-2.0/include/glibconfig.h:9,
                 from /nix/store/7gp6sgjxwr4bzvy4r29a0rmb476pxww0-glib-2.74.3-dev/include/glib-2.0/glib/gtypes.h:34,
                 from /nix/store/7gp6sgjxwr4bzvy4r29a0rmb476pxww0-glib-2.74.3-dev/include/glib-2.0/glib/galloca.h:34,
                 from /nix/store/7gp6sgjxwr4bzvy4r29a0rmb476pxww0-glib-2.74.3-dev/include/glib-2.0/glib.h:32,
                 from ../gum/gumdefs.h:10,
                 from ../gum/gummemory.h:11,
                 from ../bindings/gumjs/gumcmodule.h:10,
                 from ../bindings/gumjs/gumcmodule.c:7:
bindings/gumjs/gumcmodule-runtime.h: In function ‘gum_cmodule_get_symbols’:
bindings/gumjs/gumcmodule-runtime.h:3414:70: error: ‘dlclose’ undeclared (first use in this function); did you mean ‘pclose’?
 3414 |     g_hash_table_insert (symbols, "dlclose", GUM_FUNCPTR_TO_POINTER (dlclose));
      |                                                                      ^~~~~~~

fix: generate-runtime.py should ignore tcclib.h

dlclose comes from tcclib.h

generate-runtime.py with debug prints
        for header_dir, header_reldir, header_filter, header_transform, header_kind in inputs:
            print(f"generate-runtime.py: header_dir={header_dir}", file=sys.stderr)
            print(f"generate-runtime.py: header_reldir={header_reldir}", file=sys.stderr)
            print(f"generate-runtime.py: header_filter={header_filter}", file=sys.stderr)
            for header_name, header_source in find_headers(header_dir, header_reldir, header_filter, header_transform):
                print(f"generate-runtime.py: header_name={header_name}", file=sys.stderr)
                input_identifier = "gum_cmodule_{0}".format(identifier(header_name))

                for pattern in (cmodule_function_pattern, cmodule_variable_pattern):
                    for m in pattern.finditer(header_source):
                        name = m.group(2)
                        symbols.append(name)
                        print(f"generate-runtime.py: symbol={name}", file=sys.stderr)
generate-runtime.py: header_dir=/nix/store/6baj0zbk91jmf88qiggnhghr7w9w1il1-frida-tinycc-unstable-2022-04-01/lib/tcc/include
generate-runtime.py: header_reldir=None
generate-runtime.py: header_filter=<function is_header at 0x7ffff73f7d00>
generate-runtime.py: header_name=stdbool.h
generate-runtime.py: header_name=varargs.h
generate-runtime.py: header_name=stddef.h
generate-runtime.py: header_name=tcclib.h
generate-runtime.py: symbol=free
generate-runtime.py: symbol=atoi
generate-runtime.py: symbol=exit
...
generate-runtime.py: symbol=perror
generate-runtime.py: symbol=strlen
generate-runtime.py: symbol=dlclose

also mentioned in #713

see also frida/tinycc#6

@milahu
Copy link
Contributor Author

milahu commented Feb 11, 2023

fails to compile with vanilla tinycc

with #720 it compiles with vanilla tinycc

what is the difference to frida/tinycc?
should we require frida/tinycc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant