From: argante <argante@pm.me>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: static linking problem
Date: Sat, 01 Dec 2018 22:07:53 +0000 [thread overview]
Message-ID: <VC_XxHyIMal7jUmIZZn2L_YcMLtkpyQ6j3C4XdeOZzXy_GF-PMposllHBJMkyLZ21T5W-YLANppIaNGVdjV0YA==@pm.me> (raw)
Hi,
Does anyone have any idea why this is happening? The compiler (7.3.0) doesn't produce a statically linked binaries.
# cat test.c
#include <stdio.h>
int main() { printf("hello..\n"); return 0; }
# gcc -static test.c
# ldd a.out
ldd (0x7f67f767e000)
# readelf -d a.out
Dynamic section at offset 0x1e88 contains 16 entries:
Tag Type Name/Value
0x0000000000000010 (SYMBOLIC) 0x0
0x000000000000000c (INIT) 0x290
0x000000000000000d (FINI) 0x1207
0x0000000000000004 (HASH) 0x158
0x0000000000000005 (STRTAB) 0x180
0x0000000000000006 (SYMTAB) 0x168
0x000000000000000a (STRSZ) 1 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000015 (DEBUG) 0x0
0x0000000000000003 (PLTGOT) 0x202000
0x0000000000000007 (RELA) 0x188
0x0000000000000008 (RELASZ) 264 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffb (FLAGS_1) Flags: PIE
0x000000006ffffff9 (RELACOUNT) 11
0x0000000000000000 (NULL) 0x0
# /usr/local/musl/bin/musl-gcc -static test.c
# ldd a.out
ldd (0x7f5a608f9000)
# gcc -static -specs=/lib/musl-gcc.specs test.c
# ldd a.out
ldd (0x7fb6c936f000)
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-linux-musl/7.3.0/lto-wrapper
Target: x86_64-linux-musl
Configured with: ./configure CFLAGS='-Os -g0' CXXFLAGS= --enable-languages=c,c++ --disable-nls --disable-multilib --disable-werror --disable-libmudflap --disable-libsanitizer --disable-gnu-indirect-function --disable-libmpx --disable-libssp --disable-symver --disable-libgomp --disable-fixed-point --enable-tls --enable-deterministic-archives --enable-__cxa_atexit --enable-default-pie --build=x86_64-linux-musl
Thread model: posix
gcc version 7.3.0 (GCC)
without '-static' everything looks ok
# gcc test.c
# ldd a.out
/lib/ld-musl-x86_64.so.1 (0x7ff0dca25000)
libc.so => /lib/ld-musl-x86_64.so.1 (0x7ff0dca25000)
Best regards
next reply other threads:[~2018-12-01 22:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-01 22:07 argante [this message]
2018-12-02 0:18 ` Rich Felker
2018-12-02 17:20 ` argante
2018-12-02 18:15 ` Szabolcs Nagy
2018-12-02 19:25 ` argante
2018-12-02 21:16 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='VC_XxHyIMal7jUmIZZn2L_YcMLtkpyQ6j3C4XdeOZzXy_GF-PMposllHBJMkyLZ21T5W-YLANppIaNGVdjV0YA==@pm.me' \
--to=argante@pm.me \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).