[Bug gold/17448] New: gold doesn't work with --dynamic-list=<(echo '...') construct (non-seekable pipe input)

2014-09-30 Thread martinrb at google dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17448

Bug ID: 17448
   Summary: gold doesn't work with --dynamic-list=<(echo '...')
construct (non-seekable pipe input)
   Product: binutils
   Version: 2.24
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at google dot com
  Reporter: martinrb at google dot com
CC: ian at airs dot com

The self-explanatory bash snippet below shows that --dynamic-list must be a
"real" file and that gold's error message is misleading and contains
implementation details of the file parser (what's $end?; what do you mean, you
were looking for '{' in column 1??  It's right there!).  Whereas bfd ld works
correctly.

$ for ld in bfd gold; do echo -- $ld --; gcc --use-ld=$ld
-Wl,--dynamic-list=<(echo '{ main; };') main.c && nm -D a.out; done
-- bfd --
 w __gmon_start__
 U __libc_start_main
0040054d T main
 U puts
-- gold --
/usr/bin/ld.gold: error: /proc/self/fd/11:1:1: syntax error, unexpected $end,
expecting '{'
/usr/bin/ld.gold: fatal error: unable to parse dynamic-list script file
/proc/self/fd/11

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/17449] New: Exporting dynamic symbols from the main program is too difficult

2014-09-30 Thread martinrb at google dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17449

Bug ID: 17449
   Summary: Exporting dynamic symbols from the main program is too
difficult
   Product: binutils
   Version: 2.24
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at google dot com
  Reporter: martinrb at google dot com
CC: ian at airs dot com

(This bug also affects gcc the compiler itself; is there a better category?)

If I have some symbols defined by the main executable that I wish to be
accessed by dlopen'ed libraries (via dlopen(NULL) and dlsym), it seems too
difficult to discover and maintain the required steps.  In the past we have
done all of these:

- Annotate the symbols via __attribute__((visibility("default")))
- Ensure the symbols are referenced by main() to prevent -ffunction-sections
together with -Wl,--gc-sections from removing them
- List the symbols in the global section of a version script with an anonymous
version
- Add -Wl,--export-dynamic to the link.

What I really want is a single annotation I can place in the source file that
will ensure all of the above.  The microsoftish __dclspec(dllexport) seems to
have a name with the right connotations, but I haven't tried using it.

We can make incremental progress, e.g. by having the presence of a version
script imply --export-dynamic, or having the presence of default visibility
prevent gc-sections from collecting the symbols.

If compatibility is too hard to overcome, at least document these steps
somewhere in the ld or gcc docs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils