public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/65248] New: [5 Regression] Copy relocation in PIE against protected symbol
@ 2015-02-28  9:24 hjl.tools at gmail dot com
  2015-02-28 20:11 ` [Bug target/65248] " hjl.tools at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-28  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65248
           Summary: [5 Regression] Copy relocation in PIE against
                    protected symbol
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: tmsriram at google dot com

Copy relocation doesn't work with protected symbol and BFD linker
enforces it.  GCC 5 uses copy relocation in PIE. It either causes
linker error or run-time error:

[hjl@gnu-6 copyreloc-prot]$ cat x.c
extern int a;

extern void bar (void);

int main()
{
  bar ();
  if (a != 30)
    __builtin_abort();
  return 0;
}
[hjl@gnu-6 copyreloc-prot]$ cat bar.c
int a;

__attribute__((visibility("protected"))) int a;

void
bar ()
{
  a = 30;
}
[hjl@gnu-6 copyreloc-prot]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -pie -O3 -fpie    -c -o x.o x.c
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -pie -O3 -fpic    -c -o bar.o
bar.c
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -pie  -shared -o libbar.so
bar.o
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -pie -O3 -o x x.o libbar.so
-Wl,-R,.
/usr/local/bin/ld: copy reloc against protected `a' is invalid
/usr/local/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
make: *** [x] Error 1
[hjl@gnu-6 copyreloc-prot]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -pie -O3 -o x x.o libbar.so
-Wl,-R,. -fuse-ld=gold
[hjl@gnu-6 copyreloc-prot]$ ./x
Aborted
[hjl@gnu-6 copyreloc-prot]$


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

end of thread, other threads:[~2015-03-27 18:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-28  9:24 [Bug target/65248] New: [5 Regression] Copy relocation in PIE against protected symbol hjl.tools at gmail dot com
2015-02-28 20:11 ` [Bug target/65248] " hjl.tools at gmail dot com
2015-03-02  8:43 ` rguenth at gcc dot gnu.org
2015-03-04 14:13 ` [Bug target/65248] " hjl.tools at gmail dot com
2015-03-04 23:34 ` [Bug target/65248] Copy relocation against protected symbol doesn't work hjl.tools at gmail dot com
2015-03-06 13:28 ` hjl.tools at gmail dot com
2015-03-27 18:26 ` hjl at gcc dot gnu.org
2015-03-27 18:31 ` 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).