Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: when building with buildmode=pie the DF_1_PIE flag should be added to the resulting elf #46747

Closed
jawn-smith opened this issue Jun 14, 2021 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@jawn-smith
Copy link

What version of Go are you using (go version)?

1.6.2

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Ubuntu 21.04 amd64

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jawn-smith/.cache/go-build"
GOENV="/home/jawn-smith/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jawn-smith/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jawn-smith/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jawn-smith/jira_issues/fr-1133/golang-rewrite/retry/ubuntu-image/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3996539644=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Built an executable file with go build --buildmode=pie and ran readelf -d to examine it

What did you expect to see?

The flag DF_1_PIE in the section FLAGS_1

What did you see instead?

Nothing in FLAGS_1

This flag is relevant to how the file command determines the difference between shared objects and position independent executable files as documented here: https://cirosantilli.com/elf-hello-world/df-1-pie.

@ianlancetaylor ianlancetaylor changed the title When building with buildmode=pie the DF_1_PIE flag should be added to the resulting elf cmd/link: when building with buildmode=pie the DF_1_PIE flag should be added to the resulting elf Jun 14, 2021
@ianlancetaylor
Copy link
Contributor

CC @cherrymui @thanm

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 14, 2021
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Jun 14, 2021
@thanm thanm self-assigned this Jun 15, 2021
@thanm
Copy link
Contributor

thanm commented Jun 15, 2021

I'll take a look.

@gopherbot
Copy link

Change https://golang.org/cl/328089 mentions this issue: cmd/link: set correct flags in .dynamic for PIE buildmode

@golang golang locked and limited conversation to collaborators Jun 15, 2022
@rsc rsc unassigned thanm Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants