public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/55379] New: -static -static-libasan doesn't create static binary
@ 2012-11-18 14:51 hjl.tools at gmail dot com
  2012-11-18 14:52 ` [Bug driver/55379] " hjl.tools at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-11-18 14:51 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

             Bug #: 55379
           Summary: -static -static-libasan doesn't create static binary
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com


[hjl@gnu-tools-1 gcc]$ ./xgcc -B./ x.o  -o x  -faddress-sanitizer
-B../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/ -static-libasan 
[hjl@gnu-tools-1 gcc]$ ldd a.out 
    linux-vdso.so.1 =>  (0x00007fffc6991000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x0000003341200000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003338200000)
    libgomp.so.1 => /lib64/libgomp.so.1 (0x0000003343e00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000333aa00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003337a00000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003337200000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003336e00000)
    librt.so.1 => /lib64/librt.so.1 (0x0000003337e00000)
[hjl@gnu-tools-1 gcc]$


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

* [Bug driver/55379] -static -static-libasan doesn't create static binary
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
@ 2012-11-18 14:52 ` hjl.tools at gmail dot com
  2012-11-18 14:56 ` [Bug driver/55379] -static -static-libasan pass -Bdynamic to linker hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-11-18 14:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-11-18 14:52:24 UTC ---
It should be

[hjl@gnu-tools-1 gcc]$ ./xgcc -B./ x.o  -o x  -faddress-sanitizer
-B../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/ -static-libasan -static
[hjl@gnu-tools-1 gcc]$ ldd a.out 
    linux-vdso.so.1 =>  (0x00007fff91699000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x0000003341200000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003338200000)
    libgomp.so.1 => /lib64/libgomp.so.1 (0x0000003343e00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000333aa00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003337a00000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003337200000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003336e00000)
    librt.so.1 => /lib64/librt.so.1 (0x0000003337e00000)
[hjl@gnu-tools-1 gcc]$


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

* [Bug driver/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
  2012-11-18 14:52 ` [Bug driver/55379] " hjl.tools at gmail dot com
@ 2012-11-18 14:56 ` hjl.tools at gmail dot com
  2012-11-18 18:58 ` konstantin.s.serebryany at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-11-18 14:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-static -static-libasan     |-static -static-libasan
                   |doesn't create static       |pass -Bdynamic  to linker
                   |binary                      |

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2012-11-18 14:55:57 UTC ---
[hjl@gnu-tools-1 gcc]$ ./xgcc -B./ x.o  -o x  -faddress-sanitizer
-B../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/ -static-libasan -static 
-v
Reading specs from ./specs
COLLECT_GCC=./xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/sources/gcc/configure
--enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.8.0
--with-local-prefix=/usr/local --enable-gnu-indirect-function --with-fpmath=sse
: (reconfigured) /export/gnu/import/git/sources/gcc/configure
--disable-bootstrap --prefix=/usr/gcc-4.8.0 --with-local-prefix=/usr/local
--enable-gnu-indirect-function --with-fpmath=sse CFLAGS=-g CXXFLAGS=-g
--enable-languages=c,c++,lto --no-create --no-recursion
Thread model: posix
gcc version 4.8.0 20121117 (experimental) (GCC) 
COMPILER_PATH=./:../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/
LIBRARY_PATH=./:../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-B' './' '-o' 'x' '-faddress-sanitizer' '-B'
'../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/' '-static-libasan'
'-static' '-v' '-mtune=generic' '-march=x86-64'
 ./collect2 -m elf_x86_64 -static -o x /lib/../lib64/crt1.o
/lib/../lib64/crti.o ./crtbeginT.o -L.
-L../x86_64-unknown-linux-gnu/libsanitizer/asan/.libs -L/lib/../lib64
-L/usr/lib/../lib64 x.o -Bstatic -lasan -Bdynamic --start-group -lgcc -lgcc_eh
-lc --end-group ./crtend.o /lib/../lib64/crtn.o
[hjl@gnu-tools-1 gcc]$


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

* [Bug driver/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
  2012-11-18 14:52 ` [Bug driver/55379] " hjl.tools at gmail dot com
  2012-11-18 14:56 ` [Bug driver/55379] -static -static-libasan pass -Bdynamic to linker hjl.tools at gmail dot com
@ 2012-11-18 18:58 ` konstantin.s.serebryany at gmail dot com
  2012-11-18 19:35 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: konstantin.s.serebryany at gmail dot com @ 2012-11-18 18:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

Konstantin Serebryany <konstantin.s.serebryany at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |konstantin.s.serebryany at
                   |                            |gmail dot com

--- Comment #3 from Konstantin Serebryany <konstantin.s.serebryany at gmail dot com> 2012-11-18 18:58:00 UTC ---
Note: fully static linking is not supported by libsanitizer at all and I don't
think it will. 
Reason: on linux asan uses "dlsym(RTLD_NEXT, ...)" and on Mac it uses 
(will soon use) function inerposition. 
Neither works for fully static binaries, afaict.


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

* [Bug driver/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2012-11-18 18:58 ` konstantin.s.serebryany at gmail dot com
@ 2012-11-18 19:35 ` hjl.tools at gmail dot com
  2012-11-22 11:14 ` [Bug sanitizer/55379] " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-11-18 19:35 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2012-11-18 19:35:21 UTC ---
(In reply to comment #3)
> Note: fully static linking is not supported by libsanitizer at all and I don't
> think it will. 
> Reason: on linux asan uses "dlsym(RTLD_NEXT, ...)" and on Mac it uses 
> (will soon use) function inerposition. 
> Neither works for fully static binaries, afaict.

Then we should issue an error if -static is used with -faddress-sanitizer.


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

* [Bug sanitizer/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2012-11-18 19:35 ` hjl.tools at gmail dot com
@ 2012-11-22 11:14 ` jakub at gcc dot gnu.org
  2012-11-22 11:31 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-22 11:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-22 11:14:18 UTC ---
For -static one could perhaps use --wrap ld option to wrap various symbols, but
we'd need special libasan_static.a for that.  Not worth it.


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

* [Bug sanitizer/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2012-11-22 11:14 ` [Bug sanitizer/55379] " jakub at gcc dot gnu.org
@ 2012-11-22 11:31 ` jakub at gcc dot gnu.org
  2012-11-22 15:17 ` hjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-22 11:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-22
     Ever Confirmed|0                           |1

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-22 11:30:55 UTC ---
So we need %{static:%e-fsanitize=address requires dynamic linking} or similar
in LIBASAN_SPEC.


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

* [Bug sanitizer/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2012-11-22 11:31 ` jakub at gcc dot gnu.org
@ 2012-11-22 15:17 ` hjl at gcc dot gnu.org
  2012-11-22 15:18 ` hjl.tools at gmail dot com
  2012-11-22 15:19 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-11-22 15:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

--- Comment #7 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-11-22 15:17:26 UTC ---
Author: hjl
Date: Thu Nov 22 15:17:21 2012
New Revision: 193728

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193728
Log:
Issue an error for -static with fsanitize=address

    PR sanitizer/55379
    * gcc.c (LINK_COMMAND_SPEC): Issue an error for -static with
    -fsanitize=address.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gcc.c


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

* [Bug sanitizer/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2012-11-22 15:17 ` hjl at gcc dot gnu.org
@ 2012-11-22 15:18 ` hjl.tools at gmail dot com
  2012-11-22 15:19 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-11-22 15:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.0

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2012-11-22 15:18:26 UTC ---
Fixed.


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

* [Bug sanitizer/55379] -static -static-libasan pass -Bdynamic  to linker
  2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2012-11-22 15:18 ` hjl.tools at gmail dot com
@ 2012-11-22 15:19 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-11-22 15:19 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55379

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> 2012-11-22 15:19:00 UTC ---
Fixed.


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

end of thread, other threads:[~2012-11-22 15:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-18 14:51 [Bug driver/55379] New: -static -static-libasan doesn't create static binary hjl.tools at gmail dot com
2012-11-18 14:52 ` [Bug driver/55379] " hjl.tools at gmail dot com
2012-11-18 14:56 ` [Bug driver/55379] -static -static-libasan pass -Bdynamic to linker hjl.tools at gmail dot com
2012-11-18 18:58 ` konstantin.s.serebryany at gmail dot com
2012-11-18 19:35 ` hjl.tools at gmail dot com
2012-11-22 11:14 ` [Bug sanitizer/55379] " jakub at gcc dot gnu.org
2012-11-22 11:31 ` jakub at gcc dot gnu.org
2012-11-22 15:17 ` hjl at gcc dot gnu.org
2012-11-22 15:18 ` hjl.tools at gmail dot com
2012-11-22 15:19 ` hjl.tools at gmail 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).