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

General code issues #11

Closed
ahkok opened this issue May 20, 2019 · 4 comments
Closed

General code issues #11

ahkok opened this issue May 20, 2019 · 4 comments
Labels

Comments

@ahkok
Copy link

ahkok commented May 20, 2019

Some basic default compiler warnings are thrown. You will want to fix these (fairly trivial)

gcc -DHAVE_CONFIG_H -I. -fPIC -O2 -g -Wall -W -Wformat-security -D_FORTIFY_SOURCE=2 -fno-common -std=gnu99 -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-signed-zeros -fno-trapping-math -fassociative-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake -MT libwhich.lo -MD -MP -MF .deps/libwhich.Tpo -c libwhich.c  -fPIC -DPIC -o .libs/libwhich.o
libwhich.c:197:22: warning: ‘struct dl_phdr_info’ declared inside parameter list will not be visible outside of this definition or declaration
  197 | int get_names(struct dl_phdr_info *info, size_t size, void *data)
      |                      ^~~~~~~~~~~~
libwhich.c: In function ‘get_names’:
libwhich.c:200:13: error: dereferencing pointer to incomplete type ‘struct dl_phdr_info’
  200 |     if (info->dlpi_name[0]) {
      |             ^~
libwhich.c:197:49: warning: unused parameter ‘size’ [-Wunused-parameter]
  197 | int get_names(struct dl_phdr_info *info, size_t size, void *data)
      |                                          ~~~~~~~^~~~
libwhich.c: In function ‘dllist’:
libwhich.c:210:5: warning: implicit declaration of function ‘dl_iterate_phdr’ [-Wimplicit-function-declaration]
  210 |     dl_iterate_phdr(get_names, (void*)&dynamic_libraries);
      |     ^~~~~~~~~~~~~~~
libwhich.c: In function ‘dlpath’:
libwhich.c:217:5: warning: implicit declaration of function ‘dlinfo’ [-Wimplicit-function-declaration]
  217 |     dlinfo(handle, RTLD_DI_LINKMAP, &map);
      |     ^~~~~~
libwhich.c:217:20: error: ‘RTLD_DI_LINKMAP’ undeclared (first use in this function)
  217 |     dlinfo(handle, RTLD_DI_LINKMAP, &map);
      |                    ^~~~~~~~~~~~~~~
libwhich.c:217:20: note: each undeclared identifier is reported only once for each function it appears in
libwhich.c:214:50: warning: unused parameter ‘name’ [-Wunused-parameter]
  214 | const char *dlpath(void *handle, struct vector_t name)
      |                                  ~~~~~~~~~~~~~~~~^~~~
@ahkok
Copy link
Author

ahkok commented May 20, 2019

#define _GNU_SOURCE
#include <link.h>
#include <dlfcn.h>

are needed for dlinfo()

@vtjnash
Copy link
Owner

vtjnash commented Jun 4, 2019

It seems like you aren't using the provided makefile, as these are already part of it.

@vtjnash vtjnash added the invalid label Jun 4, 2019
@ahkok
Copy link
Author

ahkok commented Jun 4, 2019

Can you please consider doing the sensible thing and autoscan the project and not have hand coded build scripts? Set an SOVER, use autotools to properly install, add a pkg-config file, etc...?

@ahkok ahkok closed this as completed Jun 4, 2019
@vtjnash
Copy link
Owner

vtjnash commented Jun 4, 2019

There's no shared libraries, just a single binary file

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

No branches or pull requests

2 participants