Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 26 Oct 2012 10:04:46 +0800
From: Brian Wang <brian.wang.0721@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Difference between -O2 and -g

On Fri, Oct 26, 2012 at 9:40 AM, Rich Felker <dalias@...ifal.cx> wrote:
> On Fri, Oct 26, 2012 at 09:31:56AM +0800, Brian Wang wrote:
>> Hello all,
>>
>> I am experiencing a rather strange problem...
>>
>> I have an oldish kdrive/Xfbdev that works on my ARM device with
>> CodeSourcery toolchains.
>> Now, I tried it with musl (0.9.6 and the recent git master branch as well).
>> First it failed to find the screen and refused to start.  After some naive
>> attempts with printf without success, I recompiled it with -g and no
>> -Ox with the hope that gdbserver
>> would help pin point the problem.  However, with only -g, it runs!
>
> -g should have absolutely no effect on code behavior, but it sounds
> like your two setups are "-O2" and "-O0 -g" (where the -O0 is the
> default). If that's the case, when code behaves differently with
> different optimization levels, the cause is almost surely undefined
> behavior. Another possibility is a bug in musl (possibly an
> ARM-specific bug), but if you didn't recompile musl with different
> options, I doubt that's the cause.
>
> One very simple way to get a picture of what's going on in a program
> is to run it under strace. Try saving strace logs for both the working
> version and the broken version and comparing them either manually or
> with the diff utility (although the latter may be difficult unless you
> filter out the addresses and other contnets that will naturally
> differ, so it might be easier to visually inspect). If you don't
> already have an strace built for your target, I think Aboriginal Linux
> has static binaries you can use.

I have previously built my static strace.
I could not decipher what went wrong.  Please find the strace logs for
the three binaries in question.
The source code is basically the same, except for the musl ones,
printf calls are sprinkled here and there
as my desperate attempt.

>
> If you're having trouble analyzing the results I'd be happy to help
> you.
>
> Rich

Thank you for your help.


Brian



-- 
brian
------------------

Cool-Karaoke - The smallest recording studio, in your palm, open-sourced
http://cool-idea.com.tw/

iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe

Download attachment "Xfbdev-glibc-O2.log" of type "application/octet-stream" (34094 bytes)

Download attachment "Xfbdev-musl-debug.log" of type "application/octet-stream" (80060 bytes)

Download attachment "Xfbdev-musl-O2.log" of type "application/octet-stream" (14634 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.