aboutsummaryrefslogtreecommitdiff
path: root/src/debug/elf/elf.go
AgeCommit message (Collapse)Author
2023-02-03debug/elf: add DT_FLAGS_1 constantsFlorin Papa
Add constants for all ELF dynamic flags (pertaining to DT_FLAGS_1). This will help, for example, determining whether an object is a position-independent executable (PIE). The constants are defined according to Table 15-10 in https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/dynamic-section.html. Fixes #56887 Change-Id: I6cd501af50d9dbcc2aa8a9a002e12c6fb6726761 Reviewed-on: https://go-review.googlesource.com/c/go/+/452496 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-14debug/elf: fix inccorrect value in COMPRESS_ZLIB string nameFlorian Zenker
LLVM recently introduced ZSTD compression for ELF sections. The error message when failing to read the compressed section calls this COMPRESS_ZLIB+2 while it should report it as COMPRESS_ZLIB+1. Change-Id: I869aa69baf0c8c86665475b47343c790587cb39b Reviewed-on: https://go-review.googlesource.com/c/go/+/443035 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29debug/elf: fix typo in R_PPC64_TPREL34 and R_PPC64_DTPREL34Paul E. Murphy
The suffix should be 34 not 28. I misread the name because the reloc listed before these two in the ABI is named "R_PC64_PCREL28". Updates #54345 Change-Id: Ie8238f55e441c787d70ead58e0a177c650f8b89e Reviewed-on: https://go-review.googlesource.com/c/go/+/435415 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-08debug/elf: define additional PPC64 ELFv2 relocationsPaul E. Murphy
The PPC64 ELFv2 supplement version 1.5 defines a handful of new relocation types, similarly some were not added. Fixes #54345 Change-Id: Id39b29d404298fca4a10ccf1e96b5964dc452c9e Reviewed-on: https://go-review.googlesource.com/c/go/+/425555 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-27debug/elf: fix reloc number of R_PPC64_SECTOFF_LO_DSPaul E. Murphy
R_PPC64_SECTOFF_LO_DS is defined as reloc 62 on all PPC64 ELF ABIs. Fixes #53356 Change-Id: I5fabf6be32f3310c5aed47d4d654e05fb7bc9de0 Reviewed-on: https://go-review.googlesource.com/c/go/+/411915 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11debug/elf: add new-style LoongArch reloc typesWANG Xuerui
LoongArch ELF psABI spec update: https://github.com/loongson/LoongArch-Documentation/pull/57 Corresponding binutils implementation: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6d13722a97cee3fd397e116bde3bcedbb1e220be https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9801120721c3a702ce3bd50433ef920f92a83502 For #54222 Change-Id: I51e72294205847a69c01d741a3126248f7a7e41c Reviewed-on: https://go-review.googlesource.com/c/go/+/420982 Reviewed-by: Meng Zhuo <mzh@golangcn.org> Run-TryBot: Meng Zhuo <mzh@golangcn.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2022-04-04debug: define ELF relocation for loong64Xiaodong Liu
Contributors to the loong64 port are: Weining Lu <luweining@loongson.cn> Lei Wang <wanglei@loongson.cn> Lingqin Gong <gonglingqin@loongson.cn> Xiaolin Zhao <zhaoxiaolin@loongson.cn> Meidan Li <limeidan@loongson.cn> Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Qiyuan Pu <puqiyuan@loongson.cn> Guoqi Chen <chenguoqi@loongson.cn> This port has been updated to Go 1.15.6: https://github.com/loongson/go For #46229 Change-Id: I0c58305754c20d2a59328adbd82caa527de254ec Reviewed-on: https://go-review.googlesource.com/c/go/+/396735 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cherry Mui <cherryyz@google.com>
2021-11-05cmd/link: enable internal linking of PIE binaries on ppc64lePaul E. Murphy
The amd64/arm64 relocation processing is used as a template and updated for ppc64le. This requires updating the TOC relocation handling code to support linux type TOC relocations too (note, AIX uses TOC-indirect accesses). Noteably, the shared flag of go functions is used as a proxy for the local entry point offset encoded in elf objects. Functions in go ppc64le shared objects always[1] insert 2 instructions to regenerate the TOC pointer. [1] excepting a couple special runtime functions, see preprocess in obj9.go for specific details of this behavior. Change-Id: I3646e6dc8a0a0ffe712771a976983315eae5c418 Reviewed-on: https://go-review.googlesource.com/c/go/+/352829 Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2021-04-13all: simplify the spelling of LinuxBrad Fitzpatrick
The prefix didn't help clarify anything. Change-Id: I897fd4022ce9df42a548b15714e4b592618ca547 Reviewed-on: https://go-review.googlesource.com/c/go/+/309573 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-03-02cmd/link,debug/elf: mips32, add .gnu.attributes and .MIPS.abiflags sectionsYunQiang Su
MIPS32 uses .gnu.attributes and .MIPS.abiflags sections to mark FP ABI the object is using, and the kernel will set the correct FP mode for it. Currrently Go doesn't generate these 2 sections. If we link object without these 2 sections togather FPXX objects, the result will be FPXX, which is wrong: FP32 + FPXX -> FP32 FPXX + FP64 -> FP64 FP32 + FP64 -> reject These 2 sections is also needed to support FPXX and FP64 in future. More details about FP32/FPXX/FP64 are explained in: https://web.archive.org/web/20180828210612/https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking Fixes #39677 Change-Id: Ia34e7461dee38a4f575dd8ace609988744512ac1 Reviewed-on: https://go-review.googlesource.com/c/go/+/239217 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Meng Zhuo <mzh@golangcn.org>
2020-09-18debug/elf: add many PT_ and DT_ constantsIan Lance Taylor
Change-Id: Icbb5a0f0ff4aa0a425aa4a15477da7bd0d58339c Reviewed-on: https://go-review.googlesource.com/c/go/+/255138 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-09-07debug/elf: add R_RISCV_32_PCREL relocationTobias Klauser
This were missed in CL 107339 as it is not documented (yet) in https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md But binutils already uses it. See https://github.com/riscv/riscv-elf-psabi-doc/issues/36 Change-Id: I1b084cbf70eb6ac966136bed1bb654883a97b6a9 Reviewed-on: https://go-review.googlesource.com/134015 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-08debug/elf: add machine and OSABI constantsTobias Klauser
Provide a complete list of EM_* and ELFOSABI_* constants. Compiled from the tables at http://www.sco.com/developers/gabi/latest/ch4.eheader.html and llvm/BinaryFormat/ELF.h from LLVM. Change-Id: Ice1e1476076fafdb8bb8af848caec6d80a82c452 Reviewed-on: https://go-review.googlesource.com/112115 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-18debug/elf: add riscv64 relocationsTobias Klauser
Based on the code from https://github.com/riscv/riscv-go/ originally written by Amol Bhave. Change-Id: I8d5377096d4ff8b198dadb630511f9a0347f9797 Reviewed-on: https://go-review.googlesource.com/107339 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-04-10debug/elf: add missing EM_AARCH64 to machineStringsTobias Klauser
EM_AARCH64 is defined as a constant, but the corresponding entry in machineStrings is missing. Add it. Change-Id: I6506404386efe608877095e635a290bbc0686215 Reviewed-on: https://go-review.googlesource.com/106035 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-11debug/elf: add relocation constantsDavid Crawshaw
Compiled from various tables found around the internet. Some of these are used by cmd/link. Change-Id: I258b25e694dbe91a61d675763f2c47ccc928fd70 Reviewed-on: https://go-review.googlesource.com/69012 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-02all: make copyright headers consistent with one space after periodEmmanuel Odeke
Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-15all: remove unnecessary type conversionsMatthew Dempsky
cmd and runtime were handled separately, and I'm intentionally skipped syscall. This is the rest of the standard library. CL generated mechanically with github.com/mdempsky/unconvert. Change-Id: I9e0eff886974dedc37adb93f602064b83e469122 Reviewed-on: https://go-review.googlesource.com/22104 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-03all: fix spelling mistakesEric Engestrom
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Change-Id: I91873aaebf79bdf1c00d38aacc1a1fb8d79656a7 Reviewed-on: https://go-review.googlesource.com/21433 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-29debug/elf: add s390x relocationsMichael Munday
Change-Id: I8440f69c7f99d65b2f69035c26b4a62104f22bd3 Reviewed-on: https://go-review.googlesource.com/20874 Reviewed-by: Minux Ma <minux@golang.org>
2016-03-02all: single space after period.Brad Fitzpatrick
The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-12-18debug/elf: rename Chdr64.Reserved to _Austin Clements
This future-proofs the Chdr64 structure against later versions of ELF defining this field and declutters the documentation without changing the layout of the struct. This structure does not exist in the current release, so this change is safe. Change-Id: I239aad7243ddaf063a1f8cd521d8a50b30413281 Reviewed-on: https://go-review.googlesource.com/18028 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-12-03debug/elf: transparently decompress compressed sectionsAustin Clements
This adds support for compressed ELF sections. This compression is treated as a framing issue and hence the package APIs all transparently decompress compressed sections. This requires some subtlety for (*Section).Open, which returns an io.ReadSeeker: since the decompressed data comes from an io.Reader, this commit introduces a Reader-to-ReadSeeker adapter that is efficient for common uses of Seek and does what it can otherwise. Fixes #11773. Change-Id: Ic0cb7255a85cadf4c1d15fb563d5a2e89dbd3c36 Reviewed-on: https://go-review.googlesource.com/17341 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Austin Clements <austin@google.com>
2015-11-12debug/elf: added MIPS ELF relocationsYao Zhang
Change-Id: I05352749a852095baae2f67fd71ffcf5f727538d Reviewed-on: https://go-review.googlesource.com/14453 Reviewed-by: Minux Ma <minux@golang.org>
2015-07-28all: cleanup usage of dashes in package documentationMatthew Dempsky
Change-Id: I58453f7ed71eaca15dd3f501e4ae88d1fab19908 Reviewed-on: https://go-review.googlesource.com/12683 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Rob Pike <r@golang.org>
2014-12-05all: power64 is now ppc64Russ Cox
Fixes #8654. LGTM=austin R=austin CC=golang-codereviews https://golang.org/cl/180600043
2014-10-22build: merge the great pkg/ rename into dev.power64Austin Clements
This also removes pkg/runtime/traceback_lr.c, which was ported to Go in an earlier commit and then moved to runtime/traceback.go. Reviewer: rsc@golang.org rsc: LGTM
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.