When -odir is specified, put the object file of a C-source file into the top level odir directory (#14025)

Authored by RolandSenn on Jul 3 2018, 7:35 AM.



To choose the odir subdirectory to write the object file from Haskell source files, the following rules apply:
If the module has a simple name (eg Foo), then the object file (Foo.o) is stored into the odir top level directory.
If the module has a hierarchical name (eg Foo.Bar.Baz) then the object file (Baz.o) is stored into the directory odir/Foo/Bar.

The same rules should be used for the C-files. In C we don't have any hierarchical module names.
Hence when -odir is set, the object file of a c-file should always be written directly into the top level odir directory.

Test Plan

driver/T14025, driver/T14025a

Diff Detail

rGHC Glasgow Haskell Compiler
Lint ErrorsExcuse: 'Bad Charset' is part of existing test T12971
Errortestsuite/tests/driver/Makefile:661TXT5Bad Charset
Errortestsuite/tests/driver/Makefile:662TXT5Bad Charset
No Unit Test Coverage
Build Status
Buildable 21599
Build 49221: [GHC] Linux/amd64: Continuous Integration
Build 49220: [GHC] OSX/amd64: Continuous Integration
Build 49219: [GHC] Windows/amd64: Continuous Integration
Build 49218: arc lint + arc unit
RolandSenn created this revision.Jul 3 2018, 7:35 AM
RolandSenn edited the summary of this revision. (Show Details)Jul 3 2018, 7:45 AM
RolandSenn edited the test plan for this revision. (Show Details)Jul 3 2018, 7:48 AM
Harbormaster edited this Differential Revision.Jul 4 2018, 4:45 AM
tdammers requested changes to this revision.Jul 5 2018, 2:20 AM
tdammers added a subscriber: tdammers.

Looks like the build fails because it can't find some .o files. Might want to look into that.

This revision now requires changes to proceed.Jul 5 2018, 2:20 AM
RolandSenn abandoned this revision.Jul 6 2018, 9:52 AM

Oops, the failure of testcase cabal01is severe! To fix it, we would need to change Cabal: Cabal should be aware of the new location of the *.o file. However this gives a dependency between the versions of Cabal and GHC. The user of a GHC version with the patch for Trac Trac #14025 must also use a version of Cabal with a patch for Trac #14025 (and vice versa).
Considering, that Trac #14025 solves a very tiny problem, this is a too heavy burden on the user. Therefore I abandon this solution and I'll develop a new solution, just fixing the case with the absolute path.