Community
Participate
Working Groups
Build Identifier: cdt_8_0 and HEAD org.eclipse.cdt.utils.elf.Elf.ELFhdr.makeShort() returns an incorrect value when the less significant input byte is greater than 0x7f. This prevents correct calculation of the CPU name string when the ELF machine ID is in the range 0x80-0xff. The implementations of makeInt() and makeLong() may also be buggy. Issue discovered when adding EM_RX and EM_RL78 machine IDs. Reproducible: Always Steps to Reproduce: 1. Build an ELF object file with an ELF machine ID which is known to CDT and in the range 0x80-0xff. 2. Observe that the CPU name is calculated to be "none".
Created attachment 202637 [details] Fix for makeShort() plus RX and RL78 machine IDs The patch avoids treating individual input bytes as negative numbers. It should apply to the cdt_8_0 branch and HEAD.
Created attachment 211599 [details] Updated patch Did some refactoring and added tests. Also optimized contributed solution (avoid unnecessary &0xff operations).
Pushed to master (CDT 8.1)
Created attachment 211602 [details] Updated patch Previous patch lacked new files
(In reply to comment #3) > Pushed to master (CDT 8.1) Thank you, John.
(In reply to comment #5) > Thank you, John. Sure thing. Please validate the patch in your environment, if you can.
*** cdt git genie on behalf of John Cortell *** Bug 356519 - ELF header reader makeShort() bug [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=b4da3bb8f027a1c99a7e99e14d0136becf291c81 *** cdt git genie on behalf of John Cortell *** Bug 356519 - ELF header reader makeShort() bug [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=b4da3bb8f027a1c99a7e99e14d0136becf291c81
*** cdt git genie on behalf of John Cortell *** Bug 356519 - ELF header reader makeShort() bug [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=45c5f16e074987ea3e883f148927f24a51ae8716