[GHC] #10974: Fix SysTools.readElfSection on platforms where "readelf" have different name

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: driver/recomp011 | Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Some linux systems may use target-prefixed names for `binutils`. For example on my Exherbo Linux readelf is named as `x86_64-pc-linux-gnu- readelf`. This leads to errors like:
readelf: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
To fix this GHC needs to give ability to configure name of this tool (like `SysTools.runSplit` and `SysTools.runCc`) or use `libelf`-like library. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ony): * status: new => patch Comment: See arc diff for this: https://phabricator.haskell.org/D1326 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * differential: => Phab:D1326 * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | -------------------------------------+------------------------------------- Comment (by ony): Replying to [comment:2 thomie]: As I understand I'll cherry-pick this change to branch `ghc-7.10` it will go into GHC 7.10.3 (or whatever will come out after change will be accepted). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 7.10.3 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * milestone: 8.0.1 => 7.10.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 7.10.3 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 -------------------------------------+------------------------------------- Changes (by ony): * differential: Phab:D1326 => Phab:D1326 Phab:D1335 Comment: Adapted change https://phabricator.haskell.org/D1335 for `ghc-7.10` branch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 7.10.3 => 8.0.1 Comment: Merged Phab:D1335 (updated for consistency with existing tools autoconf usage) to 7.10.3. Still need to merge to `master`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 -------------------------------------+------------------------------------- Comment (by hsyl20): Is there a way to use Data.Binary.Get in Systools? We could totally avoid using readelf and it should be faster too (no fork, no parsing, no need to use String). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 -------------------------------------+------------------------------------- Comment (by thomie): Add `binary` to `Build-Depends` in `compiler/ghc.cabal.in` (and `compiler/ghc.cabal`, so you don't have to rerun configure). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 -------------------------------------+------------------------------------- Comment (by ony): Replying to [comment:7 hsyl20]:
Is there a way to use Data.Binary.Get in Systools? We could totally avoid using readelf and it should be faster too (no fork, no parsing, no need to use String). `Data.Binary.Get` is also monad parser library but for bytestrings. Writing yet another ELF-file parser but pure sounds interesting, but ineffective (better to spend that effort on something else). I do agree that using `libelf` might be faster. But I also like idea that `ghc` requires only `binutils`. Adding more dependency on something while we can get the same functionality with existing dependency looks bad for me.
Replying to [comment:8 thomie]:
Add `binary` to `Build-Depends` in `compiler/ghc.cabal.in` (and `compiler/ghc.cabal`, so you don't have to rerun configure). This might be true for release tar-balls, but not for source code repository which should always go through `autoreconf` (`perl boot`) and `configure` to generate from files from their `.in`. And that's described in both `README.md` and `HACKING.md`. Note that `compiler/ghc.cabal` is in ignores where it should be. Though file is committed into repo - which is wrong. Probably some-one did that by mistake and/or when .gitignore entry were added no-one removed it.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 -------------------------------------+------------------------------------- Comment (by hsyl20): I have recently written my own ELF parser (https://github.com/hsyl20/ViperVM/tree/master/src/lib/ViperVM/Format/Elf) so it is still fresh in my head. I have adapted it to GHC by removing intermediate data structures and everything that is not strictly required to extract a section. https://phabricator.haskell.org/D1381 I'm not an expert of lazy IO, so reviews are welcome. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 Phab:D1381 -------------------------------------+------------------------------------- Changes (by hsyl20): * differential: Phab:D1326 Phab:D1335 => Phab:D1326 Phab:D1335 Phab:D1381 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different
name
-------------------------------------+-------------------------------------
Reporter: ony | Owner:
Type: bug | Status: patch
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Other | Test Case:
| driver/recomp011
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1326
Wiki Page: | Phab:D1335 Phab:D1381
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10974: Fix SysTools.readElfSection on platforms where "readelf" have different name -------------------------------------+------------------------------------- Reporter: ony | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: | driver/recomp011 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1326 Wiki Page: | Phab:D1335 Phab:D1381 -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10974#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC