Where is links__node__node() defined?
The "links__node__node" theme function is not defined from any Drupal module. If a module defines a theme function matching that name, then Drupal will use it; otherwise, the function that is going to be used is theme_links().

In your theme, you can define both the theme functions. The difference is that theme_links() is generally used, while the other theme function is used just in a specific case.

function themename_links__node__node(&amp;$variables) {
  $links = $variables['links'];
  $attributes = $variables['attributes'];
  // …
}




function themename_links(&amp;$variables) {
  $links = $variables['links'];
  $attributes = $variables['attributes'];
  $heading = $variables['heading'];
  // …
}