public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67040] New: gcc-5.2 fails with flat namespaces on the mac os
@ 2015-07-28  5:13 balaji at anl dot gov
  0 siblings, 0 replies; only message in thread
From: balaji at anl dot gov @ 2015-07-28  5:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67040

            Bug ID: 67040
           Summary: gcc-5.2 fails with flat namespaces on the mac os
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: balaji at anl dot gov
  Target Milestone: ---

gcc-5.2 causes bad library builds on the mac os, when built with flat
namespaces, and with no optimizations.

The following simple program reproduces the problem:

{{{
% cat foo.c
#include <stdio.h>
void bar(void) { }
void foo(void *s) { bar(); }
}}}

{{{
% cat test.c
#include <stdio.h>
void foo(void *s);
int main()
{
    foo(NULL);   
    return 0;
}
}}}

{{{
% gcc -dynamiclib foo.c -o libfoo.dylib -Wl,-flat_namespace
% gcc -L. test.c -lfoo
% ./a.out
Segmentation fault: 11
}}}

Either removing the `-Wl,-flat_namespace` option or adding some level of
optimization, such as `-O2` to the library build fixes this issue.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-28  5:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  5:13 [Bug c/67040] New: gcc-5.2 fails with flat namespaces on the mac os balaji at anl dot gov

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).