Binary File Differences: When Do Differences Matter?

unix

    Next

  • 1. [Sol10] SMSERVER without RPC
    Hi, netstat -a reads like a telephone book after standard installation so I would like to clean up a bit. The main problem is that smserver depends on RPC which I would *love* to disable. How can I secure the system a bit without loosing access to the cdrom? Thanks, Helmut -- Please do not feed my mailbox, Swen still does his job well
  • 2. dbx : Interpreting stack history of core
    Greetings , Can someone help me understanding the following piece of stack dump of a core file ? what's in the First column ? Second column, I think can be interpreted by demanglers - which will turn out to be function names ! And what's the + 11c ? after the function name ? Is it the displacement of the current instruction starting from function beginning ? -------------------------- thread# 35 -------------------- fe3c81ac cond_wait (fa60bd98, 0, 0, fe3ec000, 0, 0) + 11c fe3c8070 pthread_cond_wait (1ef5fe0, 1ef5fc8, 1f48648, 1ed6db0, 2346cdc, 0) + 8 016203f4 __1cS_DBSqlRequestQdDueueKgetRequest6M_rnN_DBSqlRequest__ (1ef5fb0, 0, 0, 0, fa60bc9c, 0) + 4c 0161e684 __1cIDBAccessMDBConnectionEbody6M_v_ (1ef5730, 23, 0, 0, 0, 0) + 1fc 01697840 __1cMWDThreadBaseLstartThread6Fpv_1_ (1ef5730, fdb63d38, 0, 5, 1, fe401000) + 58 fe3db01c _thread_start (1ef5730, 0, 0, 0, 0, 0) + 40 -------------------------- thread# 37 -------------------- fe3c7d88 cond_reltimedwait (0, fa407d98, 0, fe3ec000, 0, 0) + 1dc fe3d9150 sleep (0, fa407cbc, 1ba0161, 1ed6f68, fe3ec000, 0) + 17c 009c7740 __1cQCleanupThreadEbody6M_v_ (1fa8900, 25, 0, 0, 0, 0) + e8 01697840 __1cMWDThreadBaseLstartThread6Fpv_1_ (1fa8900, fdb63d38, 0, 5, 1, fe401000) + 58 fe3db01c _thread_start (1fa8900, 0, 0, 0, 0, 0) + 40 Help appreciated!
  • 3. xstat() in libc.so: sparc vs x86
    Not something most people would care about but it does affect me: why are the stat functions (stat/lstat/fstat) implemented differently within libc on X86 vs sparc? Is there some hardware reason or is this just the new way of doing stat? If I had Solaris 10 I could check but cannot upgrade yet. On Sol 9 X86 there are a set of '*xstat' functions. On Sol 9 sparc no such routines exist. See: % uname -a SunOS xxxxx 5.9 Generic_117172-07 i86pc i386 i86pc % nm -g /lib/libc.so | grep xstat [2636] | 183676| 36|FUNC |GLOB |0 |10 |_fxstat [3605] | 184400| 36|FUNC |GLOB |0 |10 |_lxstat [4025] | 190848| 36|FUNC |GLOB |0 |10 |_xstat % % uname -a SunOS yyyyy 5.9 Generic_117171-13 sun4u sparc SUNW,Ultra-5_10 % nm -g /lib/libc.so | grep xstat % The *xstat stuff seems similar to what glibc does, where the xstat functions do the real work and the {l,f,}stat{64,} functions are just stubs which call their xstat equivalents. The main questions are (a) why is this different on X86 vs sparc and (b) does Solaris 10 standardize on one style or does it retain this split personality? -- Henry Townsend
  • 4. Sol 10 and "ide=nodma"
    I would like to evaluate Solaris 10 and unfortunately there is something wrong with the harddrive. With Linux everything works fine with the boot-option "ide=nodma". What do I need to I need to install Sol 10 on this drive? Al
  • 5. shell prompt
    Sorry for the silly question, I'm really a newbie for Solaris. I've a "fresh" installation of Solaris 10. My command prompt (bash shell) is just "$", I would like to add informations, in a way it should appear like "[myousername@myhostname:currentdir]$". I would also like to color the output of ls (for ex., directories in blue, symbolic links in green, etc.) I think I have to create a file in my $HOME, but can you please explain how? -- "There's nothing like a catholic girl At the C.Y.O. when they're learning to blow All the catholic boys" -- F.Z.

Binary File Differences: When Do Differences Matter?

Postby Robert Halonen » Wed, 08 Feb 2006 04:54:04 GMT

We will soon be building our software system on new hardware (same make/model, 
just new boxes).  I have noticed that even on our existing hardware, building 
the exact same software from the same source will give differing binary files, 
some even with minor file size differences.  So now, when we move over to the 
new hardware, how can we be sure that we are still building the same software 
given that the binaries contain differences even without changing systems?  Of 
course, we will be completely testing the software built on the new system.  Is 
there any way to tell if the differences in the binary files are differences 
that will affect the actual operation of the software, or perhaps the ability to 
update a single dynamic library?  I'd like to be able to do some kind of 
checkout other than the full system test to give me some confidence that the new 
hardware is building the same system as the old hardware.  Any suggestions?

Re: Binary File Differences: When Do Differences Matter?

Postby Dan Foster » Wed, 08 Feb 2006 05:27:11 GMT

In article <xPNFf.1$ XXXX@XXXXX.COM >, Robert Halonen



If sources and makefiles hasn't changed, then it's probably compiler
changes -- usually bugfixes or better optimized code generation.


You could disassemble the binaries and compare to identify differences.

Since you say it's a slight change in file size, the differences are
most likely not that large, and can be read by hand once the diff'd
sections has been identified.

You can also use /usr/ccs/bin/elfdump to compare the functions
enumerated in both sets of binaries. I'm not sure there's a Solaris
utility like GNU's objdump (part of their binutils tools).

(As of Solaris 9/SPARC, elfdump was in the SUNWbtool package.)

With GNU's objdump, if you build the binaries with -g, then you can use
objdump -d -S to show both an assembly language disassembly along with
references to the corresponding source code lines.

E.g., on Linux with GNU binutils installed:

$ vi hello.c

#include <stdio.h>

int main()
{
	int foo=0;

	printf("Hello, world!\n");
	foo=5;
}

$ gcc hello.c -g -o hello
$ objdump -d -S hello
[...]
08048384 <main>:
#include <stdio.h>

int main()
{
 8048384:       55                      push   %ebp
 8048385:       89 e5                   mov    %esp,%ebp
 8048387:       83 ec 08                sub    $0x8,%esp
 804838a:       83 e4 f0                and    $0xfffffff0,%esp
 804838d:       b8 00 00 00 00          mov    $0x0,%eax
 8048392:       29 c4                   sub    %eax,%esp
        int foo=0;
 8048394:       c7 45 fc 00 00 00 00    movl   $0x0,0xfffffffc(%ebp)

        printf("Hello, world!\n");
 804839b:       c7 04 24 a4 84 04 08    movl   $0x80484a4,(%esp)
 80483a2:       e8 01 ff ff ff          call   80482a8 <printf@plt>
        foo=5;
 80483a7:       c7 45 fc 05 00 00 00    movl   $0x5,0xfffffffc(%ebp)
}
 80483ae:       c9                      leave  
 80483af:       c3                      ret    
[...]

I am not sure what the Solaris equivalent to objdump -d -S might be, but
mentioned the GNU version here so that someone may be able to offer the
Solaris equivalent.

-Dan

Re: Binary File Differences: When Do Differences Matter?

Postby Henry Townsend » Wed, 08 Feb 2006 13:37:18 GMT




Actually it's trickier than that. I'm currently struggling with the same 
issue as the OP. I've always thought that Solaris ELF binaries were 
"stable" - i.e. that a file compiled on the same machine twice with the 
same cmdline and environment a few minutes apart would generate 
identical bits each time. But from a test, this seems to be true when 
compilation and linking is done via the gcc toolchain but *not* with Sun 
Studio 11.

I just tracked this a little further. Turns out gcc generates nonvarying 
binaries with or without the -g flag whereas Sun Studio ("cc") generates 
identical output without -g, but when -g is turned on the checksum 
changes from build to build. See below:

% cc -o hello hello.c && cksum hello
123815386       6888    hello
% cc -o hello hello.c && cksum hello
123815386       6888    hello

% cc -g -o hello hello.c && cksum hello
3486775769      7556    hello
% cc -g -o hello hello.c && cksum hello
1243289241      7556    hello

Can anyone tell us the answer? Does Sun Studio insert a date stamp into 
the debug data or what? And is there a way to suppress that?


Presumably one could also just compile the GNU objdump for Solaris. Or 
copy the executable to a Linux machine and objdump it there. ELF is ELF.

HT

Re: Binary File Differences: When Do Differences Matter?

Postby Thomas Dehn » Wed, 08 Feb 2006 15:52:45 GMT




For starters, you must strip the binaries.

See 
80040 When I Recompile my Code, I do not get Identical Object Files.
    http://www.**--****.com/ 
for further details.


Thomas

Re: Binary File Differences: When Do Differences Matter?

Postby Chris Ridd » Wed, 08 Feb 2006 18:27:12 GMT

On 7/2/06 4:37, in article  XXXX@XXXXX.COM , "Henry






Sun includes elfdump and dump in the SUNWbtool package, which do a good job
of analyzing ELF files.

Cheers,

Chris


Re: Binary File Differences: When Do Differences Matter?

Postby Seongbae Park » Thu, 09 Feb 2006 01:49:53 GMT






This probably is due to the globalization prefix. 
No documented and supported way to suppress that. 
An undocumented and unsupported -W0,-noglobal will prevent this 
but doing so will break dbx's break-and-continue (for -g case) and -xipo.


There's no exact equivalence, 
though er_src (part of Performance Analyzer in Studio) can do objdump -S
but most of other objdump functionality can be found in elfdump.
-- 
#pragma ident "Seongbae Park, compiler,  http://www.**--****.com/ "

Re: Binary File Differences: When Do Differences Matter?

Postby Henry Townsend » Thu, 09 Feb 2006 05:34:00 GMT



Thanks! May be useful for the bag-of-tricks even if not supported.


I assume you mean edit-and-continue? I can (and do) live without that, 
but being unable to continue after a break would be quite troublesome :-)

HT

Re: Binary File Differences: When Do Differences Matter?

Postby Seongbae Park » Thu, 09 Feb 2006 06:54:51 GMT





Ah, sorry. I meant fix-and-continue. 
-- 
#pragma ident "Seongbae Park, compiler,  http://www.**--****.com/ "

Re: Binary File Differences: When Do Differences Matter?

Postby Robert Halonen » Thu, 09 Feb 2006 09:07:49 GMT





Thank you; that is very useful!  One question that is not explicitly stated:  Is 
it true that he strip command does not alter the actual execution of the library 
or executable; i.e. it does not affect the functionality?

Re: Binary File Differences: When Do Differences Matter?

Postby Ceri Davies » Fri, 10 Feb 2006 01:58:16 GMT







That is true.

Ceri
-- 
That must be wonderful!  I don't understand it at all.
                                                  -- Moliere

Re: Binary File Differences: When Do Differences Matter?

Postby Robert Halonen » Wed, 15 Feb 2006 04:27:47 GMT

When I do the strip and compare on object files and executables, the diff will 
come back identical.  Executable files still show differences though.  Any 
reasons why?









Re: Binary File Differences: When Do Differences Matter?

Postby Henry Townsend » Wed, 15 Feb 2006 11:15:35 GMT



You haven't made your situation clear. In the first sentence you say 
that stripped executables show no differences. In the second sentence 
you say the opposite. Which thing did you mean? Are you saying that 
*stripped* executables or *unstripped* executables show differences?

HT

Re: Binary File Differences: When Do Differences Matter?

Postby Robert Halonen » Wed, 15 Feb 2006 15:59:30 GMT

Oops, I meant "object files and shared libraries."  Sorry for not 
proofreading before posting.







Re: Binary File Differences: When Do Differences Matter?

Postby Henry Townsend » Wed, 15 Feb 2006 21:29:51 GMT



I was able to reproduce this but the -W0,-noglobal flag suggested by 
Seongbae solves it. Remember that this is undocumented and unsupported.

HT

Re: Binary File Differences: When Do Differences Matter?

Postby halork » Thu, 16 Feb 2006 01:44:41 GMT

Thanks Henry.  Unfortunately we can't re-build our existing executables
with those options; perhaps doing a parallel build as a proof will be
sufficient.


Similar Threads:

1.the difference between binary file and ASCII file

hello,

if I have a unix shell script with permission ---x--x--x,
how can a unix shell detect that it is not an execuable binary 
application and gives an error message  "permission denied"?

Thanks,

Peter

2.what is the difference between binary and rom files

i found somewhere a line mentioning that the user has a choice between
rpm and binary files

what is the difference between the two  ( some rpm packege for the
mysql server  software )
-Parag

3.difference between normal file and named pipe file

HI,
        will anyone let me know the differences between the normal unix
file and named pipe file?

Regards

4.all files show differences with Unix files

We are trying to use SourceSafe to manage changes for Unix code. The SourceSafe Database is hosted on a Windows server, if we show the differences for a file that was just checked in it displays the last line as being different but no difference is seen. If I copy the file to a Windows system no difference is shown. I suspect the End-Of-File character is causing the difference. Is there any way to correct or work around this?

5.File size difference when nulling a file

I'm currently using the > /myfile.log command to reset the file size
to 0 byte. However, this > command does not necessary work for all
logs. Sometimes the file size is not set to 0 instead lots of empty
spaces are pipe into the file instead. When this happen, the file size
show using "ls -l /myfile.log" and "du -sk" show dispute size. Anyone
has any idea why the diff in file size using the 2 different command?

6. Differences between Apache 1.3 and 2.0 protecting jsp files with .htaccess

7. difference in file.join between Linux, win32?

8. Why is there no difference between buffered and unbuffered file IO



Return to unix

 

Who is online

Users browsing this forum: No registered users and 47 guest