{"action":"opened","issue":{"url":"https://api.github.com/repos/devkitPro/buildscripts/issues/19","repository_url":"https://api.github.com/repos/devkitPro/buildscripts","labels_url":"https://api.github.com/repos/devkitPro/buildscripts/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/devkitPro/buildscripts/issues/19/comments","events_url":"https://api.github.com/repos/devkitPro/buildscripts/issues/19/events","html_url":"https://github.com/devkitPro/buildscripts/issues/19","id":167166228,"number":19,"title":"Wii U RPXs cannot link to newlib due to lack of relocatability","user":{"login":"shinyquagsire23","id":1224096,"avatar_url":"https://avatars.githubusercontent.com/u/1224096?v=3","gravatar_id":"","url":"https://api.github.com/users/shinyquagsire23","html_url":"https://github.com/shinyquagsire23","followers_url":"https://api.github.com/users/shinyquagsire23/followers","following_url":"https://api.github.com/users/shinyquagsire23/following{/other_user}","gists_url":"https://api.github.com/users/shinyquagsire23/gists{/gist_id}","starred_url":"https://api.github.com/users/shinyquagsire23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinyquagsire23/subscriptions","organizations_url":"https://api.github.com/users/shinyquagsire23/orgs","repos_url":"https://api.github.com/users/shinyquagsire23/repos","events_url":"https://api.github.com/users/shinyquagsire23/events{/privacy}","received_events_url":"https://api.github.com/users/shinyquagsire23/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-23T04:10:19Z","updated_at":"2016-07-23T04:10:19Z","closed_at":null,"body":"While Gamecube and Wii executables are largely static in terms of linking and memory, Wii U's executables are entirely position independent and are required to be. \r\n\r\nIn newlib's existing state, several functions (notably sprintf was tested) use jump tables with entries relative from it's own .rodata offset to the .text offset (ie target_jump_offset - jpt_rodata_offset). This does not work in an RPX since these relative offsets are never adjusted within RELA sections, and simply result in a prefetch abort.\r\n\r\nOne solution is to add *-fno-jump-tables* to [dkppc/patches/newlib-2.0.0.patch](https://github.com/devkitPro/buildscripts/blob/master/dkppc/patches/newlib-2.0.0.patch#L6252), however this may have a performance impact on older systems and the Wii U. Optimally, the jump tables would just contain absolute addresses which are handled in the appropriate RELA sections, however I could not find any flags in GCC to do this.\r\n\r\n-fno-jump-tables has been [tested on hardware](http://i.imgur.com/SYiknef.jpg) ([source](https://gist.github.com/shinyquagsire23/0db32219a50259c3bcdbe6a995b1a5af)) and works through both loadiine and as an independent executable.\r\n"}}
{"actor":{"display_login":"shinyquagsire23"}}