public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66219] New: The gcc generated section start/stop pointers become undefined when option -flto is used
@ 2015-05-20 13:12 dscao999 at hotmail dot com
  2015-05-21  8:57 ` [Bug c/66219] " rguenth at gcc dot gnu.org
  2015-05-21 13:25 ` dscao999 at hotmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dscao999 at hotmail dot com @ 2015-05-20 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66219
           Summary: The gcc generated section start/stop pointers become
                    undefined when option -flto is used
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dscao999 at hotmail dot com
  Target Milestone: ---

Created attachment 35577
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35577&action=edit
This tar contains all the information required for a bug

#include <stdio.h>

__attribute__ ((__section__("MAP"))) long flags[] = {1, 2, 3, 4, 5, 6};

extern const long __start_MAP[];
extern const long __stop_MAP[];

int main(int argc, char *argv[])
{
        const long *m;

        m = __start_MAP;
        while (m < __stop_MAP) {
                printf("%d ", *m);
                m++;
        }
        printf("\n");

        return 0;
}

The magic pointers(__start_MAP, __stop_MAP) of sections will become undefined
if option -flto is used.


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

* [Bug c/66219] The gcc generated section start/stop pointers become undefined when option -flto is used
  2015-05-20 13:12 [Bug c/66219] New: The gcc generated section start/stop pointers become undefined when option -flto is used dscao999 at hotmail dot com
@ 2015-05-21  8:57 ` rguenth at gcc dot gnu.org
  2015-05-21 13:25 ` dscao999 at hotmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-05-21  8:57 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well, likely flags[] is optimized away.  If you need the symbol to prevail (for
whatever reason?) you need to add __attribute__((used)) to it.


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

* [Bug c/66219] The gcc generated section start/stop pointers become undefined when option -flto is used
  2015-05-20 13:12 [Bug c/66219] New: The gcc generated section start/stop pointers become undefined when option -flto is used dscao999 at hotmail dot com
  2015-05-21  8:57 ` [Bug c/66219] " rguenth at gcc dot gnu.org
@ 2015-05-21 13:25 ` dscao999 at hotmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dscao999 at hotmail dot com @ 2015-05-21 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Cao Da Shi <dscao999 at hotmail dot com> ---
This issue poped up when cross compiling systemd-219. It is confirmed that the
missed section has the __attribute__((used)) declared. But still the link will
only pass without "-flto", with all other options exactly the same. The files
are too large to be sent. The link command is as follows:
arm-elf-linux-gnueabi-gcc -shared -Wl,-Map=/tmp/mymap.txt -fPIC -DPIC
pam_systemd_la-pam_systemd.o -Wl,--whole-archive libsystemd-internal.a
libsystemd-shared.a -Wl,--no-whole-archive -Wl,-rpath -lrt -lcap -lm
libpam_misc.so libpam.so -ldl -flto -O2 -Wl,--as-needed -Wl,--no-undefined
-Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now
-Wl,--version-script=pam_systemd.sym -pthread -Wl,-soname -Wl,pam_systemd.so -o
/tmp/pam_systemd.so

$ arm-elf-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-elf-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/cxpkg/cxarm/libexec/gcc/arm-elf-linux-gnueabi/4.8.4/lto-wrapper
Target: arm-elf-linux-gnueabi
Configured with: /home/dscao/build/native/gcc/gcc-4.8.4/configure
--prefix=/opt/cxpkg/cxarm --target=arm-elf-linux-gnueabi
--host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu
--with-tune=cortex-a8 --with-arch=armv7-a -with-mode=arm --with-float=hard
--with-fpu=vfp3 --disable-nls --with-system-zlib
--with-sysroot=/var/opt/cxroots/armroot --enable-languages=c,c++
--enable-checking=release --enable-threads=posix --enable-shared
Thread model: posix
gcc version 4.8.4 (GCC)


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

end of thread, other threads:[~2015-05-21 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 13:12 [Bug c/66219] New: The gcc generated section start/stop pointers become undefined when option -flto is used dscao999 at hotmail dot com
2015-05-21  8:57 ` [Bug c/66219] " rguenth at gcc dot gnu.org
2015-05-21 13:25 ` dscao999 at hotmail dot com

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