{-# LINE 1 "src/Bindings/Bfd/Relocation.hsc" #-}
-- This file is part of Bindings-bfd.
{-# LINE 2 "src/Bindings/Bfd/Relocation.hsc" #-}
--
-- Copyright (C) 2010 Michael Nelson
--
-- Bindings-bfd is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- Bindings-bfd is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU Lesser General Public License for more details.

-- You should have received a copy of the GNU Lesser General Public License
-- along with Bindings-bfd.  If not, see <http://www.gnu.org/licenses/>.

module Bindings.Bfd.Relocation where

import Foreign.Ptr
import Foreign.Storable

import Bindings.Bfd.Symbol


{-# LINE 26 "src/Bindings/Bfd/Relocation.hsc" #-}


data Relocation = Relocation {
                       ptrSymbol :: Ptr Symbol
                     , address   :: Int
                     , addend    :: Int
--                   , howto     :: ?
                  }
     deriving Show

instance Storable Relocation where
   sizeOf _ = (24)
{-# LINE 38 "src/Bindings/Bfd/Relocation.hsc" #-}
   alignment = sizeOf
   peek buf =
      do
         psym <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) buf
{-# LINE 42 "src/Bindings/Bfd/Relocation.hsc" #-}
         addr <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) buf
{-# LINE 43 "src/Bindings/Bfd/Relocation.hsc" #-}
         adde <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) buf
{-# LINE 44 "src/Bindings/Bfd/Relocation.hsc" #-}
         return $ Relocation psym addr adde

getSymbol
   :: Relocation
   -> IO Symbol
getSymbol (Relocation ps _ _) = peek ps