Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
cross-s390x-binutils.5284
binutils-fix-pr21168.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File binutils-fix-pr21168.diff of Package cross-s390x-binutils.5284
Fixes Oracle installer with 2.26.1, aka bnc #1031508 . commit 749984dd040933589b2a4e954889c61da6301bef Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Feb 15 11:39:30 2017 -0800 i386: Allow "lea foo@GOT, %reg" in PIC "lea foo@GOT, %reg" is OK in PIC since it only loads the GOT offset into register, which can be used later with a GOT base register to get the value in the GOT entry. (cherry picked from commit 2a5684011edabf5804abb9e11253a9747587b284) bfd/ PR ld/21168 * elf32-i386.c (elf_i386_relocate_section): Allow "lea foo@GOT, %reg" in PIC. ld/ PR ld/21168 * testsuite/ld-i386/i386.exp: Run pr21168. * testsuite/ld-i386/pr21168a.c: New file. * testsuite/ld-i386/pr21168b.S: Likewise. Index: binutils-2.26.1/bfd/elf32-i386.c =================================================================== --- binutils-2.26.1.orig/bfd/elf32-i386.c 2016-06-29 09:28:37.000000000 +0200 +++ binutils-2.26.1/bfd/elf32-i386.c 2017-04-18 16:06:01.000000000 +0200 @@ -3956,7 +3956,9 @@ elf_i386_relocate_section (bfd *output_b - gotplt->output_section->vma - gotplt->output_offset); - if ((*(contents + rel->r_offset - 1) & 0xc7) == 0x5) + if (rel->r_offset > 1 + && (*(contents + rel->r_offset - 1) & 0xc7) == 0x5 + && *(contents + rel->r_offset - 2) != 0x8d) { if (bfd_link_pic (info)) goto disallow_got32; @@ -4128,13 +4130,15 @@ r_386_got32: relocation = (htab->elf.sgot->output_section->vma + htab->elf.sgot->output_offset + off); - if ((*(contents + rel->r_offset - 1) & 0xc7) == 0x5) + if (rel->r_offset > 1 + && (*(contents + rel->r_offset - 1) & 0xc7) == 0x5 + && *(contents + rel->r_offset - 2) != 0x8d) { if (bfd_link_pic (info)) { /* For PIC, disallow R_386_GOT32 without a base - register since we don't know what the GOT base - is. */ + register, except for "lea foo@GOT, %reg", since + we don't know what the GOT base is. */ const char *name; disallow_got32: Index: binutils-2.26.1/ld/testsuite/ld-i386/i386.exp =================================================================== --- binutils-2.26.1.orig/ld/testsuite/ld-i386/i386.exp 2016-06-29 09:28:37.000000000 +0200 +++ binutils-2.26.1/ld/testsuite/ld-i386/i386.exp 2017-04-18 16:06:01.000000000 +0200 @@ -690,6 +690,20 @@ if { [isnative] "-fPIC -O2 -g" \ { ifunc-1a.c ifunc-1b.S ifunc-1c.S ifunc-1d.S } \ ] \ + [list \ + "Build pr21168a.o" \ + "" \ + "" \ + { pr21168a.c } \ + ] \ + [list \ + "Build pr21168.so" \ + "-shared" \ + "" \ + { pr21168b.S } \ + "" \ + "pr21168.so" \ + ] \ ] run_ld_link_exec_tests [] [list \ @@ -711,6 +725,14 @@ if { [isnative] "ifunc-1b" \ "pass.out" \ ] \ + [list \ + "Run pr21168" \ + "tmpdir/pr21168a.o tmpdir/pr21168.so" \ + "" \ + { dummy.c } \ + "pr21168" \ + "pass.out" \ + ] \ ] } Index: binutils-2.26.1/ld/testsuite/ld-i386/pr21168a.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils-2.26.1/ld/testsuite/ld-i386/pr21168a.c 2017-04-18 16:06:01.000000000 +0200 @@ -0,0 +1,14 @@ +#include <stdio.h> + +int foo = 1; + +extern int *bar (void); +extern int bar_ifunc (void); + +int +main (void) +{ + if (bar () == &foo && bar_ifunc () == 0xbadbeef) + printf ("PASS\n"); + return 0; +} Index: binutils-2.26.1/ld/testsuite/ld-i386/pr21168b.S =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils-2.26.1/ld/testsuite/ld-i386/pr21168b.S 2017-04-18 16:06:01.000000000 +0200 @@ -0,0 +1,29 @@ + .text + .globl bar + .type bar, @function +bar: + call __x86.get_pc_thunk.ax + addl $_GLOBAL_OFFSET_TABLE_, %eax + lea foo@GOT, %ecx + mov (%eax,%ecx,1), %eax + ret + .globl bar_ifunc + .type bar_ifunc, @function +bar_ifunc: + call __x86.get_pc_thunk.ax + addl $_GLOBAL_OFFSET_TABLE_, %eax + lea ifunc@GOT, %ecx + mov (%eax,%ecx,1), %eax + ret + .type ifunc, @gnu_indirect_function +ifunc: + mov $0xbadbeef, %eax + ret + .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat + .globl __x86.get_pc_thunk.ax + .hidden __x86.get_pc_thunk.ax + .type __x86.get_pc_thunk.ax, @function +__x86.get_pc_thunk.ax: + movl (%esp), %eax + ret + .section .note.GNU-stack,"",@progbits
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor