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

go/build: Recognize `.sx` as equivalent to `.S` #32434

Open
bdarnell opened this issue Jun 4, 2019 · 6 comments

Comments

Projects
None yet
5 participants
@bdarnell
Copy link

commented Jun 4, 2019

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

$ go version
go version go1.12.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/bdarnell/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/bdarnell/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.5/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.5/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qx/.../tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I tried to rename an assembly file from lowercase .s to capital .S (PR) in order to use preprocessor directives in it.

What did you expect to see?

Renaming the file from lowercase .s to capital .S should cause the preprocessor directives to work.

What did you see instead?

Some combination of git and the macos filesystem (case-insensitive but case preserving) made the rename difficult. I had to change the base name of the file to make sure the rename "stuck".

This worked, but it would have been simpler if go recognized the suffix .sx for assembly files that use the preprocessor. This suffix is supported by gcc.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

Seems reasonable to me.

@darkLord19

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

Hi, I am working with Go from past few months and I was thinking about contributing to Go. So if no one is working then I would like to work on this.

@darkLord19

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

After some code reading, I figured that I will need to update src/cmd/go/internal/work/exec.go and src/cmd/go/internal/work/gc.go mainly and some other places in internal/load accordingly. Can anyone explain how the go build works in an abstract way so that I can understand the working of current build toolchains and then add changes necessary for the issues? Thanks.
@ianlancetaylor

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 6, 2019

For general questions like these please reach out to the forums here on the Questions wiki page.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

I understand that you are asking an abstract question, but it's a bit too abstract for me to know what the answer is. go build works by finding all the files in a package and building them.

My first guess, without looking at the code, would be that this could be done entirely in the go/build package by handling ".sx" files like ".S" files.

@darkLord19 darkLord19 referenced a pull request that will close this issue Jun 11, 2019

Open

go/build: recognize '.sx' as equivalent of '.S' #32557

@gopherbot

This comment has been minimized.

Copy link

commented Jun 11, 2019

Change https://golang.org/cl/181699 mentions this issue: go/build: Recognize '.sx' as equivalent of '.S'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.