[Bug ld/27171] R_AMD64_DIR64/R_AMD64_DIR32 static address relocation

2021-01-12 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27171

H.J. Lu  changed:

   What|Removed |Added

   Target Milestone|--- |2.37
 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #6 from H.J. Lu  ---
Fixed for 2.37.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/27171] R_AMD64_DIR64/R_AMD64_DIR32 static address relocation

2021-01-12 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=27171

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c2e9a4a3ed1efcbdec68372e7e889470870d6d48

commit c2e9a4a3ed1efcbdec68372e7e889470870d6d48
Author: H.J. Lu 
Date:   Tue Jan 12 05:10:58 2021 -0800

elf/x86-64: Adjust R_AMD64_DIR64/R_AMD64_DIR32 for PE/x86-64 inputs

Subtract the value of the section contents for R_AMD64_DIR64 and
R_AMD64_DIR32 relocations when generating ELF output from PE/x86-64
inputs.

bfd/

PR ld/27171
* reloc.c (bfd_perform_relocation): Adjust R_AMD64_DIR64 and
R_AMD64_DIR32 relocations for PE/x86-64 inputs.

ld/

PR ld/27171
* testsuite/ld-x86-64/pe-x86-64-5.obj.bz2: New file.
* testsuite/ld-x86-64/pe-x86-64-5.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-5.rd: Likewise.
* testsuite/ld-x86-64/pe-x86-64.exp: Run PR ld/27171 test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/26792] Makefiles don't support GNU make job server

2021-01-12 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=26792

--- Comment #2 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d546b61084cec687e0063b2e0e169b4690341c23

commit d546b61084cec687e0063b2e0e169b4690341c23
Author: H.J. Lu 
Date:   Tue Jan 12 05:45:28 2021 -0800

Implement a workaround for GNU mak jobserver

Compiling binutils using -flto=jobserver with GCC 11 leads to

libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2
-fprofile-generate -flto=jobserver -o as-new app.o as.o atof-generic.o
compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o
flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o
input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o
remap.o sb.o stabs.o subsegs.o symbols.o write.o config/tc-i386.o
config/obj-elf.o config/atof-ieee.o  ../opcodes/.libs/libopcodes.a
../bfd/.libs/libbfd.a -L/tmp/binutils-gdb/objdir/zlib -lz
../libiberty/libiberty.a -ldl
lto-wrapper: warning: jobserver is not available: '--jobserver-auth=' is
not present in 'MAKEFLAGS'

since the '+' is missing on the recipe line in Makefiles generated by
automake.  Add the '+' to the recipe line by hand.

bfd/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

binutils/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

config/

PR binutils/26792
* jobserver.m4: New file.

gas/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

gprof/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

ld/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

libctf/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

opcodes/

PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/26792] Makefiles don't support GNU make job server

2021-01-12 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26792

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Target Milestone|--- |2.37
 Resolution|--- |FIXED

--- Comment #3 from H.J. Lu  ---
Fixed for 2.37.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/27171] R_AMD64_DIR64/R_AMD64_DIR32 static address relocation

2021-01-12 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=27171

--- Comment #7 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_36-branch branch has been updated by H.J. Lu
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c4d095332bd9fbc2ddb51ea0f3508bd1345b6c01

commit c4d095332bd9fbc2ddb51ea0f3508bd1345b6c01
Author: H.J. Lu 
Date:   Tue Jan 12 05:10:58 2021 -0800

elf/x86-64: Adjust R_AMD64_DIR64/R_AMD64_DIR32 for PE/x86-64 inputs

Subtract the value of the section contents for R_AMD64_DIR64 and
R_AMD64_DIR32 relocations when generating ELF output from PE/x86-64
inputs.

bfd/

PR ld/27171
* reloc.c (bfd_perform_relocation): Adjust R_AMD64_DIR64 and
R_AMD64_DIR32 relocations for PE/x86-64 inputs.

ld/

PR ld/27171
* testsuite/ld-x86-64/pe-x86-64-5.obj.bz2: New file.
* testsuite/ld-x86-64/pe-x86-64-5.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-5.rd: Likewise.
* testsuite/ld-x86-64/pe-x86-64.exp: Run PR ld/27171 test.

(cherry picked from commit c2e9a4a3ed1efcbdec68372e7e889470870d6d48)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/27171] R_AMD64_DIR64/R_AMD64_DIR32 static address relocation

2021-01-12 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27171

H.J. Lu  changed:

   What|Removed |Added

   Target Milestone|2.37|2.36

--- Comment #8 from H.J. Lu  ---
Also fixed for 2.36.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`

2021-01-12 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27169

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |NOTABUG

--- Comment #9 from H.J. Lu  ---
ld uses R_386_PC32 to tell if call site supports PIC PLT.  Calling an IFUNC
function in static PIE requires PLT. If call site doesn't support PIC PLT,
linker will issue an error:

https://sourceware.org/bugzilla/show_bug.cgi?id=20515

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`

2021-01-12 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=27169

--- Comment #10 from Fangrui Song  ---
(In reply to H.J. Lu from comment #9)
> ld uses R_386_PC32 to tell if call site supports PIC PLT.  Calling an IFUNC
> function in static PIE requires PLT. If call site doesn't support PIC PLT,
> linker will issue an error:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=20515

Let me rephrase what PR20515 is about:

For a call to a hidden function declaration, the compiler produces an
R_386_PC32 relocation. The relocation is an indicator that EBX may not be set
up.

If the declaration refers to an ifunc definition, the linker will resolve the
R_386_PC32 to an IPLT entry. For -pie and -shared links, the IPLT entry
references EBX. If the call site does not set up EBX, the IPLT entry call will
be incorrect.

The resolution to PR20515 has implemented the diagnostic. If we change the
compiler/assembler to use R_386_PLT32 for non-default visibility function
declarations, this diagnostic will be lost.

So unfortunately we cannot find a satisfactory relocation type for branches to
undefined symbols:

* R_386_PC32: canonical PLT entries (similar to copy relocations) which may
break -Bsymbolic or --dynamic-list usage.
* R_386_PLT32: lose a diagnostic for non-default ifunc in -pie/-shared modules.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`

2021-01-12 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=27169

--- Comment #11 from Fangrui Song  ---
I agree that the assembler needs a notation to differentiate
R_386_PC32/R_386_PLT32 branches. So perhaps this should be implemented in GCC
instead: for a default visibility function declaration, emit `call/jmp foo@plt`
instead of `call/jmp foo`.

This does not degrade the ld diagnostics for non-default visibility ifunc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/27178] New: x86-64: Omit _GLOBAL_OFFSET_TABLE_ for call foo@PLT

2021-01-12 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=27178

Bug ID: 27178
   Summary: x86-64: Omit _GLOBAL_OFFSET_TABLE_ for call foo@PLT
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

echo 'call foo' > ./a.s
echo 'call foo@PLT' > ./b.s

gcc -c a.s b.s
% readelf -Ws a.o b.o

File: a.o

Symbol table '.symtab' contains 5 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1:  0 SECTION LOCAL  DEFAULT1 
 2:  0 SECTION LOCAL  DEFAULT3 
 3:  0 SECTION LOCAL  DEFAULT4 
 4:  0 NOTYPE  GLOBAL DEFAULT  UND foo

File: b.o

Symbol table '.symtab' contains 6 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1:  0 SECTION LOCAL  DEFAULT1 
 2:  0 SECTION LOCAL  DEFAULT3 
 3:  0 SECTION LOCAL  DEFAULT4 
 4:  0 NOTYPE  GLOBAL DEFAULT  UND
_GLOBAL_OFFSET_TABLE_
 5:  0 NOTYPE  GLOBAL DEFAULT  UND foo


_GLOBAL_OFFSET_TABLE_ is not needed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/27178] x86-64: Omit _GLOBAL_OFFSET_TABLE_ for call foo@PLT

2021-01-12 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=27178

Fangrui Song  changed:

   What|Removed |Added

 Target||x86_64-*

-- 
You are receiving this mail because:
You are on the CC list for the bug.