public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Possible to compress debug symbols in a PE exe? (ld final link failed: bad value)
@ 2022-03-01 20:17 Hans L
  2022-03-01 20:50 ` Hannes Domani
  0 siblings, 1 reply; 2+ messages in thread
From: Hans L @ 2022-03-01 20:17 UTC (permalink / raw)
  To: binutils

I am cross compiling an application from Linux to Windows, where the build
uses MXE ( https://mxe.cc/ ) to bootstrap the GCC / Mingw-w64 based
cross-toolchain, as well as build various library dependencies which get
statically linked with the final executable.

The application builds successfully under normal conditions, but debug
builds are much larger than I would like them to be.  (About 1GB in size,
as opposed to 44MB without debug)
So I wanted to see if compression could help get the filesize down to
something more reasonable by adding gcc flag "-gz" in my CMakeLists.txt

This results in the build failing on the final step with the message:
  /mxe/usr/bin/x86_64-w64-mingw32.static.posix-ld: final link failed: bad
value

What is the meaning of this supremely unhelpful error message?
Is there something about PE format that is not capable of supporting
compressed DWARF symbols?
Have I run into a possible bug in ld?
Or something else entirely is going on? (random guess: must the statically
linked libraries themselves be built with the same "-gz" flag ?)

Thanks for any help,
Hans Loeblich

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Possible to compress debug symbols in a PE exe? (ld final link failed: bad value)
  2022-03-01 20:17 Possible to compress debug symbols in a PE exe? (ld final link failed: bad value) Hans L
@ 2022-03-01 20:50 ` Hannes Domani
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Domani @ 2022-03-01 20:50 UTC (permalink / raw)
  To: binutils, Hans L

 Am Dienstag, 1. März 2022, 21:17:57 MEZ hat Hans L via Binutils <binutils@sourceware.org> Folgendes geschrieben:

> I am cross compiling an application from Linux to Windows, where the build
> uses MXE ( https://mxe.cc/ ) to bootstrap the GCC / Mingw-w64 based
> cross-toolchain, as well as build various library dependencies which get
> statically linked with the final executable.
>
> The application builds successfully under normal conditions, but debug
> builds are much larger than I would like them to be.  (About 1GB in size,
> as opposed to 44MB without debug)
> So I wanted to see if compression could help get the filesize down to
> something more reasonable by adding gcc flag "-gz" in my CMakeLists.txt
>
> This results in the build failing on the final step with the message:
>   /mxe/usr/bin/x86_64-w64-mingw32.static.posix-ld: final link failed: bad
> value
>
> What is the meaning of this supremely unhelpful error message?
> Is there something about PE format that is not capable of supporting
> compressed DWARF symbols?
> Have I run into a possible bug in ld?
> Or something else entirely is going on? (random guess: must the statically
> linked libraries themselves be built with the same "-gz" flag ?)


I'm not sure why compression while linking isn't working for PE files,
but I am able to compress the final executable with
`objcopy --compress-debug-sections SOME.EXE`, maybe you can use this as well.


Regards
Hannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-01 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 20:17 Possible to compress debug symbols in a PE exe? (ld final link failed: bad value) Hans L
2022-03-01 20:50 ` Hannes Domani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).