.eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar

how to do this and what the hell it is used at all?
i found somewhere it is some debugging info but i do not put -g option to 
compiler while compiling and still get substantial amount of this trash.


trying strip -R .eh_frame -R .eh_frame_hdr results in working but 
LARGER binary, padded with lots of binary zeros.


as the resulting program is working fine it proves that it is not needed 
at all, but i have no idea why this zero padding



___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Joerg Sonnenberger
On Thu, Oct 20, 2011 at 09:41:24AM +0200, Wojciech Puchar wrote:
> how to do this and what the hell it is used at all?

It is used to allow unwinding stack frames. That is required for
exception handling with C++ and also to allow debugging in the presence
of -fomit-frame-pointer, e.g. as used by default on AMD64.

Joerg
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar
i both don't use C++ and don't want to debug when i am linking final 
binary.


how to turn this off?

On Thu, 20 Oct 2011, Joerg Sonnenberger wrote:


On Thu, Oct 20, 2011 at 09:41:24AM +0200, Wojciech Puchar wrote:

how to do this and what the hell it is used at all?


It is used to allow unwinding stack frames. That is required for
exception handling with C++ and also to allow debugging in the presence
of -fomit-frame-pointer, e.g. as used by default on AMD64.

Joerg
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"



___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Andriy Gapon
on 20/10/2011 13:44 Wojciech Puchar said the following:
> i both don't use C++ and don't want to debug when i am linking final binary.
> 
> how to turn this off?

Which compiler do you use?

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Dimitry Andric

On 2011-10-20 12:44, Wojciech Puchar wrote:

i both don't use C++ and don't want to debug when i am linking final
binary.

how to turn this off?


objcopy --remove-section .eh_frame_hdr --remove-section .eh_frame 
--remove-section .rel.eh_frame --remove-section .rela.eh_frame $your_executable

No warranty for any blown-off extremities, though.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Zhihao Yuan
On Thu, Oct 20, 2011 at 7:13 AM, Dimitry Andric  wrote:

> On 2011-10-20 12:44, Wojciech Puchar wrote:
>
>> i both don't use C++ and don't want to debug when i am linking final
>> binary.
>>
>> how to turn this off?
>>
>
> objcopy --remove-section .eh_frame_hdr --remove-section .eh_frame
> --remove-section .rel.eh_frame --remove-section .rela.eh_frame
> $your_executable
>

After I done this, the binary size *increased* a lot, while objdump shows
that the content is less. I don't understand.


>
> No warranty for any blown-off extremities, though.
>
> __**_
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/**mailman/listinfo/freebsd-**hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@**
> freebsd.org "
>



-- 
Zhihao Yuan, nickname lichray
The best way to predict the future is to invent it.
___
4BSD -- http://4bsd.biz/
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Measuring memory footprint in C/C++ code on FreeBSD

2011-10-20 Thread Razmig K

Hello

I'd like to measure the memory footprint in C/C++ code for a 
program running under FreeBSD and Linux in terms of total process size 
including heap objects. Due to execution length, I'd like to avoid the 
use of valgrind.
I think that it would be difficult to achieve the task in a 
platform-transparent manner, that's why I'll be using /proc//status 
on Linux, and do something else on FreeBSD.
I was adviced to have a look on getrusage, which I did, but I found 
descriptions of certain fields of struct rusage in the manpage too 
cryptic to make a proper use of the call.

Could someone please point me in the right direction?
Thanks very much.

~Razmig
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar

i both don't use C++ and don't want to debug when i am linking final binary.

how to turn this off?


Which compiler do you use?


supplied with FreeBSD 8.2
[wojtek@wojtek ~]$ cc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.2 20070831 prerelease [FreeBSD]




--
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"



___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar
this do the same that strip -R  what i already tried and as i already 
wrote - the same results.


program is working and sections are stripped but i am getting ca 1MB of 
binary zero paddings.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar



After I done this, the binary size *increased* a lot, while objdump shows that 
the content is less. I don't understand.


same for me

strip -R .eh_frame -R .eh_frame_hdr do the same.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Measuring memory footprint in C/C++ code on FreeBSD

2011-10-20 Thread Daniel O'Connor

On 21/10/2011, at 4:27, Razmig K wrote:
>I think that it would be difficult to achieve the task in a 
> platform-transparent manner, that's why I'll be using /proc//status on 
> Linux, and do something else on FreeBSD.
>I was adviced to have a look on getrusage, which I did, but I found 
> descriptions of certain fields of struct rusage in the manpage too cryptic to 
> make a proper use of the call.
>Could someone please point me in the right direction?

getrusage should be portable and the man page (at least on FreeBSD) explains 
each of the fields.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar

--remove-section .rel.eh_frame --remove-section .rela.eh_frame
$your_executable



After I done this, the binary size *increased* a lot, while objdump shows
that the content is less. I don't understand.

add -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables 
-fno-unwind-tables when compiling with gcc and this trash is not produced 
at first place.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Wojciech Puchar


-fno-asynchronous-unwind-tables should get rid of unwind information,
a.k.a. 'crap'.

and this worked. found it just before getting your mail ;)

yes and this is crap... possibly it is needed for some cases and some 
languages and i would not call it crap if it would not be included by 
default!



___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Alexander Kabaev
On Fri, 21 Oct 2011 01:13:59 +0200 (CEST)
Wojciech Puchar  wrote:

> >
> > -fno-asynchronous-unwind-tables should get rid of unwind
> > information, a.k.a. 'crap'.
> and this worked. found it just before getting your mail ;)
> 
> yes and this is crap... possibly it is needed for some cases and some 
> languages and i would not call it crap if it would not be included by 
> default!
> 

It is part of the amd64 ABI, which defaults to not pushing stack frames
on entry into each function, which is different from usual x86
convention.
Asynchronous unwind info (yeah, same stuff you keep referring to as
crap), is the only way you can debug your program or get anything
remotely close to usable backtrace, by default. 

-- 
Alexander Kabaev


signature.asc
Description: PGP signature


Re: .eh_frame, .eh_frame_hdr - how to remove that trash

2011-10-20 Thread Alexander Kabaev
On Fri, 21 Oct 2011 00:20:52 +0200 (CEST)
Wojciech Puchar  wrote:

> >> i both don't use C++ and don't want to debug when i am linking
> >> final binary.
> >>
> >> how to turn this off?
> >
> > Which compiler do you use?
> 
> supplied with FreeBSD 8.2
> [wojtek@wojtek ~]$ cc -v
> Using built-in specs.
> Target: amd64-undermydesk-freebsd
> Configured with: FreeBSD/amd64 system compiler
> Thread model: posix
> gcc version 4.2.2 20070831 prerelease [FreeBSD]
> 

-fno-asynchronous-unwind-tables should get rid of unwind information,
a.k.a. 'crap'.

-- 
Alexander Kabaev


signature.asc
Description: PGP signature