Anyone know why the fuck ld would fail with undefined references on a file it's told to include by wildcard? Do I have to manually order all these fucking .o files?

  • 1
    Any chance you have spaces in file names? "make" can cause problems with that if the makefile isn't absolutely water tight.
  • 1
    @Fast-Nop it worked with a lower toolchain version and it's got one file with caps and that's the weirdest the names get. Funnily enough that's the file with the most forgotten references.

    fuck c i swear
  • 1
    @Parzi caps are OK. Usually, ld itself doesn't get the wildcard because the shell should expand that before it gets to ld. Is there some path expansion issue on the CLI?

    In makefiles, there's usually just *.c, *.cpp, *.h and *.o mentioned.
  • 1
    @Fast-Nop it's got *.d files defined but unused and massive *_rules files imported from the chain that just alias commands ("make_elf" for example, which is where linking happens and just runs ld with already-defined args and such from the user makefile)

    There's no known path expansion issue, it's literally just "build/*.o" which seems pretty standard.
  • 1
    @Parzi I only learned today that although % matches slashes, * doesn't.
  • 1
    Update: Apparently, the issue was the original codebase had latching header files, and the linker was confused by .c files that did literally nothing but expand functions defined in the matching header files. Now to solve what a few functions from the code are that have no match in any file, toolchain or otherwise, and we'll be good, probably.
Add Comment