Bug 1247050 - glibc should support static PIE binaries
Summary: glibc should support static PIE binaries
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1239796 (view as bug list)
Depends On:
Blocks: F23FTBFS 1239796
TreeView+ depends on / blocked
 
Reported: 2015-07-27 08:40 UTC by Dominik 'Rathann' Mierzejewski
Modified: 2018-01-19 16:36 UTC (History)
10 users (show)

Fixed In Version: glibc-2.26.9000-44.fc28
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-05 15:19:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 19574 0 P3 RESOLVED glibc should support building static PIE binaries 2020-06-28 10:28:59 UTC

Description Dominik 'Rathann' Mierzejewski 2015-07-27 08:40:55 UTC
Description of problem:
libpthread.a is compiled without -fPIC, causing linking errors in other packages, for example prelink.

Version-Release number of selected component (if applicable):
glibc-static-2.21.90-18.fc24.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. checkout prelink f22 branch
2. try to build it in rawhide mock

Actual results:
/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/libpthread.a(libpthread.o): relocation R_X86_64_32S against `__stack_user' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/libpthread.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Expected results:
prelink builds normally.

Comment 1 Jakub Jelinek 2015-07-27 08:44:21 UTC
IMNSHO this is not a bug.  If you link against these libraries statically, you should link them statically too.

Comment 2 Carlos O'Donell 2015-07-28 02:29:56 UTC
(In reply to Jakub Jelinek from comment #1)
> IMNSHO this is not a bug.  If you link against these libraries statically,
> you should link them statically too.

Agreed.

(In reply to Dominik 'Rathann' Mierzejewski from comment #0)
> Description of problem:
> libpthread.a is compiled without -fPIC, causing linking errors in other
> packages, for example prelink.

Why are you linking in a static libpthread to create a shared object?

Comment 3 Dominik 'Rathann' Mierzejewski 2015-07-31 13:37:59 UTC
(In reply to Carlos O'Donell from comment #2)
> (In reply to Dominik 'Rathann' Mierzejewski from comment #0)
> > Description of problem:
> > libpthread.a is compiled without -fPIC, causing linking errors in other
> > packages, for example prelink.
> 
> Why are you linking in a static libpthread to create a shared object?

That's actually a question for Jakub, as prelink is his code. However, since execstack is being packaged separately (bug 1247795), this will become moot unless someone wants to unretire prelink.

Comment 4 Florian Weimer 2016-02-05 15:20:01 UTC
*** Bug 1239796 has been marked as a duplicate of this bug. ***

Comment 5 Florian Weimer 2018-01-19 16:36:59 UTC
glibc-2.26.9000-44.fc28 provides static PIE support on aarch64, i686, x86-64.

GCC 8 will simplify matters by including the -static-pie option.


Note You need to log in before you can comment on or make changes to this bug.