• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » TI C/C++ Compiler » TI C/C++ Compiler - Forum » Binary Comparison using objdiff.pl
Share
TI C/C++ Compiler
  • Forum
Options
  • Subscribe via RSS

Binary Comparison using objdiff.pl

Binary Comparison using objdiff.pl

  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Dec 20 2010 09:10 AM
    Prodigy90 points

    Hi,

    I have rebuild a release package twice using "TMS470 C/C++ CODE GENERATION TOOLS 4.6.3", when i compare the binaries using objdiff.pl, instead of showing it as identical i get following result:

    ======================================================================
    Comparing Sections : section = .const
    ======================================================================
     Raw data is different
    ======================================================================
    Comparing Sections : section = .strtab
    ======================================================================
     Raw data is different
    ======================================================================
    Comparing Sections : section = ti.sdo.ipc.SharedRegion_0
    ======================================================================
     Raw data is different

    Files are different

    Following is the command i am using for comparison:

    perl objdiff.pl binary1 binary1 ofd470.exe

    Would like to know why difference is coming even though same tools are used and build is done on same machine.

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on Dec 20 2010 16:52 PM
    Guru51565 points

    I saw a case very similar to this one recently.  I'll tell you what we saw in that case.  You likely have the same issues.

    The objdiff utility is comparing some sections that should not be compared.  One example is .strtab.  A bug has been opened against objdiff for this issue.

    The ti.sdo.ipc.SharedRegion_0 section is not being handled properly in the linker and objdiff.  I filed ClearQuest entry SDSCM00038860.  You can track it with the SDOWP link in my sig below. 

    The difference in the .const section is almost certainly a true difference.  In the other similar case, Codec Engine was being rebuilt each time.  And Codec Engine source code places a string in target memory with a time stamp of when it was built.  

    There is nothing that can done at the tool level about the .const difference.  But for the other differences, tell objdiff to skip sections in the comparison.  Write a configuration file, and supply it on the command line with --config_file=file.  Yours would look like this:

        # Comments look like this
        SKIP_BY_NAME = .strtab
        SKIP_BY_NAME = ti.sdo.ipc.SharedRegion_0
    

    Add other section names as needed.  In general, if sectti (another cg_xml script) doesn't show anything about the section, then you don't need to compare it.  You can read more about it in the cg_xml documentation.  There is a file named index.htm in the root directory of the cg_xml installation.  Load it into your favorite web browser.  Navigate to a address similar to: file:///C:/Program%20Files/Texas%20Instruments/cg_xml/docs/ofd/objdiff.htm#using_the_configuration_file_to_skip_sections .

    Thanks and regards,

    -George 


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Dec 20 2010 21:40 PM
    Prodigy90 points

    Thanks George, will follow the steps as told by you.

    Regards,

    Ravinder 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Dec 21 2010 10:20 AM
    Prodigy90 points

    Hi George,

    I have printed the verbose of .const difference between two binary files ( after skipping .strtab and ti.sdo.ipc.SharedRegion_0 sections ), it is something like this

    ======================================================================
    Comparing Sections : section = .const
    ======================================================================
    Raw data is different
       Byte 628726 is different
          vs2_m3video_whole_program_debug1.xem3: 0x31
          vs2_m3video_whole_program_debug2.xem3: 0x32
       Byte 628727 is different
          vs2_m3video_whole_program_debug1.xem3: 0x39
          vs2_m3video_whole_program_debug2.xem3: 0x30
      

    My question is the byte offset which is printed onto console "628726" (0x997f6) for the difference encountered is correct ?

    I compared it with Hex compare utility and found there are no difference at offset 0x 997F6, where as the timstamp difference is at "0xFCEE3" , the values of bytes which differ are correct.

    Regards,
    Ravinder

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Archaeologist
    Posted by Archaeologist
    on Dec 21 2010 10:52 AM
    Mastermind40900 points

    In ASCII, the two bytes 628726-7 are "19" in debug1, "20" in debug2.  Most likely this is a string representation of time, ultimately from using __TIME__ somewhere in the source code.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Dec 21 2010 11:55 AM
    Prodigy90 points

    Hi,

    I know its time representation, my question was why the byte offset shown using objdiff is not correct, i am assuming this offset is from the start of file.

    Regards,

    Ravinder 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Archaeologist
    Posted by Archaeologist
    on Dec 21 2010 13:10 PM
    Mastermind40900 points

    The offset is probably the offset from the start of the section, which cannot be computed directly from the file position.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on Dec 21 2010 13:43 PM
    Guru51565 points

    The byte offset reported by objdiff is from the start of the section.

    -George


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Jan 12 2011 08:39 AM
    Prodigy90 points

    Hi George,

    The above method of binary comparison works fine if we compare the binaries built on same PC. But if i compare the pre-build binaries which comes as part of release and rebuild binaries build at  my end, i am seeing difference in many sections. Same set of tools are used to build the release at my end and functionality is same.

    Have attached difference and also the binaries which i have compared.

    4454.PreBuild_Rebuild.txt

    4375.Binaries.zip

    Would like to know why the difference is coming when set of tools used are same.

    Thanks and Regards,

    Ravinder

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Archaeologist
    Posted by Archaeologist
    on Jan 12 2011 09:50 AM
    Mastermind40900 points

    There are a lot of small differences, ultimately coming from a string $C$SL41 at target address 0x8ff8a184 in .const.

    In vs2_m3video.xem3, this string is:

    '    package ti.sdo.ipc.family (D:/AVME4_Tools/ipc_1_22_00_13_eng/packages/ti/sdo/ipc/family/) [1, 0, 0, 0]'

    In vs2_m3video_whole_program_debug.xem3, this string is:

    '    package ti.sdo.ipc.family (F:/Tools/sdk_5008/ipc_1_22_00_13_eng/packages/ti/sdo/ipc/family/) [1, 0, 0, 0]'

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Jan 12 2011 11:22 AM
    Prodigy90 points

    There are few difference in other sections, can you let me know what is the reason behind them.

    My idea of using this utility was to do Automation. We have to build a release under Linux and Windows. In total we get 8 rebuild binaries, goal  was to execute only pre-build binary and do binary comparison for rest using this utility. Let me know if there is any other utility available which can do this.

     

    Thanks and Regards,

    Ravinder

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Archaeologist
    Posted by Archaeologist
    on Jan 12 2011 12:06 PM
    Mastermind40900 points

    A lot of those differences are caused by the change in size of .const due to this string.  Because the size of .const has changed, the starting addresses of .data,  .stack, and .sysmem are moved, and so any pointer into any of those sections will change, which for ARM means the .text section will change.  Section "xdc.meta" is not allocated in target memory and should be ignored for binary comparison.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chris Ring
    Posted by Chris Ring
    on Jan 12 2011 15:38 PM
    Genius16230 points

    Archaeologist

    In vs2_m3video.xem3, this string is:

    '    package ti.sdo.ipc.family (D:/AVME4_Tools/ipc_1_22_00_13_eng/packages/ti/sdo/ipc/family/) [1, 0, 0, 0]'

    In vs2_m3video_whole_program_debug.xem3, this string is:

    '    package ti.sdo.ipc.family (F:/Tools/sdk_5008/ipc_1_22_00_13_eng/packages/ti/sdo/ipc/family/) [1, 0, 0, 0]'

    This difference is likely b/c Codec Engine [by default] adds a full list of all packages and their original locations into the final executable.  The end user can emit this very valuable information via the popular CE_DEBUG feature, and it greatly helps with support as debug logs automatically provide details about what's in the system.

    This particular feature can be disabled, a description for doing so is in this FAQ.  Please think twice before doing this, as the benefit of enabling this automation test may not outweigh the increase in support burden.

    Chris

    Codec Engine
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ravinder Singh61136
    Posted by Ravinder Singh61136
    on Jan 13 2011 09:19 AM
    Prodigy90 points

    Hi,

    In one of my early queries it was communicated that the utility doesn't work on relative address of section's. But it takes the start address for comparison from start of each section.

    Does it mean i can't use this utility for binary comparison for binaries generated on different PC's with tools placed under different directories.

    Regards,
    Ravinder 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on Jan 13 2011 16:05 PM
    Guru51565 points

    Ravinder Singh
    Does it mean i can't use this utility for binary comparison for binaries generated on different PC's with tools placed under different directories.

    That is a limitation at present, unless you remove the CE_DEBUG information as described by the FAQ referenced in the post from Chris.  We are considering solutions to this problem.  But any such solution will not be released for quite some time.

    Thanks and regards,

    -George


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use