I don't know if this will work for Gentoo, but it might if you are using xmodmap. I found a fix that worked on Fedora 14 for me from the Ubuntu community wiki:
https://help.ubuntu.com/community/AppleKeyboard
To fix the fn key thing, I did:
$ sudo bash
# echo 2 > /sys/module/hid_apple/parameters/fnmode
# exit
I added the following to ~/.Xmodmap to switch the alt and command keys:
! Swap Alt and Cmd keys.
keycode 37 = Control_L
keycode 133 = Alt_L Meta_L
keycode 64 = Super_L
keycode 108 = Super_R
keycode 134 = ISO_Level3_Shift Multi_key
keycode 105 = Control_R Multi_key
clear Shift
clear Lock
clear Control
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5
add Shift = Shift_L Shift_R
add Lock = Caps_Lock
add Control = Control_L Control_R
add Mod1 = Alt_L 0x007D
add Mod2 = Num_Lock
add Mod4 = Super_L Super_R
add Mod5 = Mode_switch ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift
! Configure '=' key on numpad as '='.
keycode 0x7D = equal