Skip to content

Commit

Permalink
ecs-gpu-init: clean up linker flags
Browse files Browse the repository at this point in the history
`--export-dynamic` is a separate option, independent of `-z`, so pass
it as its own `-Wl` flag.

For consistency, pass the same flags to the external linker.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
(cherry picked from commit 182a188)
  • Loading branch information
bcressey authored and yeazelm committed Apr 26, 2024
1 parent f8f6b23 commit 35c2432
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ecs-gpu-init/ecs-gpu-init.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ cp -r %{_builddir}/sources/%{workspace_name}/* .
%set_cross_go_flags
# We don't set `-Wl,-z,now`, because the binary uses lazy loading
# to load the NVIDIA libraries in the host
export CGO_LDFLAGS="-Wl,-z,relro,-export-dynamic"
go build -buildmode=pie -ldflags="${GOLDFLAGS}" -o ecs-gpu-init ./cmd/ecs-gpu-init
export CGO_LDFLAGS="-Wl,-z,relro -Wl,--export-dynamic"
export GOLDFLAGS="-compressdwarf=false -linkmode=external -extldflags '${CGO_LDFLAGS}'"
go build -ldflags="${GOLDFLAGS}" -o ecs-gpu-init ./cmd/ecs-gpu-init

%install
install -d %{buildroot}%{_cross_bindir}
Expand Down

0 comments on commit 35c2432

Please sign in to comment.