Skip to content

-odir affects name of .o files generated.

Summary

By default .o files are named after their source files. When using -odir the Main module will instead be named Main.o.

I wasn't able to find documentation for this nor does it seem particularly useful so it should be considered a bug.

Steps to reproduce

Compile a file which is a Main module with and without -odir .

echo "main = return 1" > foo.hs
ghc foo.hs -c
ghc foo.hs -c -odir .
ls

Which will result in foo.o (from the first invocation) and Main.o from the second one.

foo.hi  foo.hs  foo.o  Main.o

Expected behavior

I don't see why -odir should affect the file name of the final file.

Environment

  • GHC version used: 8.10
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information