|
Message-ID: <CAMw0szL+m=t0ztBcCXZwquR7gkFUB4_SzKEpOy62yxzc-xXYmw@mail.gmail.com>
Date: Thu, 30 Jan 2020 02:10:24 +0300
From: Андрей Аладьев <aladjev.andrew@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Static linking is broken after creation of DT_TEXTREL segment
I've tested and both "-fno-pie" and "-static" are not compatible with some
gcc and clang sanitizers, so these solutions are bad.
Found right solution in gmp source. It was hidden in configure:
"--with-pic" option. I've enabled it and now both glibc and musl works
perfect. Created gentoo bug https://bugs.gentoo.org/707332. For everyone
who will read this thread - you need to enable "--with-pic" option for gmp.
You don't need to disable assembly completely.
So on this week I will try to create small user friendly patch for musl
about readonly relocations.
чт, 30 янв. 2020 г. в 00:46, Rich Felker <dalias@...c.org>:
> On Thu, Jan 30, 2020 at 12:35:52AM +0300, Андрей Аладьев wrote:
> > "readelf -d main | grep TEXTREL" returns the same text on both musl and
> > glibc containers:
> >
> > 0x0000000000000016 (TEXTREL) 0x0
> > 0x000000000000001e (FLAGS) TEXTREL
> >
> > "gcc -no-pie" is another workaround for musl container like Rich said.
> But
> > I think that 'set(CMAKE_EXE_LINKER_FLAGS "-static")' will be best cross
> > platform solution. As I know "-static" implies "no-pie".
>
> -static normally does not imply -no-pie with musl target. musl was the
> first to introduce static pie, and it was not treated as something
> special/weird you have to request, just what you get with -static +
> -pie or -static and default-pie toolchain.
>
> When GCC upstreamed static pie with glibc support, they made it so
> -static overrides -pie and so you need the new -static-pie to get
> static pie. musl patches for gcc revert this change since it's a
> regression to the original behavior, treats static-pie a second-class,
> and does not work with environments where pie is mandatory (like nommu
> targets) where default-pie *must* be honored.
>
> Rich
>
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.