Skip to content

Commit b80f284

Browse files
committed
cmd/link: change flag from -l to -relro={true,false}
Signed-off-by: Morten Linderud <[email protected]>
1 parent 5c8a81c commit b80f284

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/cmd/link/doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ Flags:
8585
instead of $GOROOT/pkg/$GOOS_$GOARCH.
8686
-k symbol
8787
Set field tracking symbol. Use this flag when GOEXPERIMENT=fieldtrack is set.
88-
-l
89-
Disable Full RELRO.
88+
-relro
89+
Enable RELRO (default true).
9090
-libgcc file
9191
Set name of compiler support library.
9292
This is only used in internal link mode.

src/cmd/link/internal/ld/lib.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ func (ctxt *Link) hostlink() {
13031303
addRELROargs := func(argv []string) []string {
13041304
relro := "-Wl,-z,relro"
13051305
// Enable Full RELRO
1306-
if !*FlagL {
1306+
if *FlagRelro {
13071307
relro += ",-z,now"
13081308
}
13091309
argv = append(argv, relro)

src/cmd/link/internal/ld/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ var (
8585
flagN = flag.Bool("n", false, "dump symbol table")
8686
FlagS = flag.Bool("s", false, "disable symbol table")
8787
FlagW = flag.Bool("w", false, "disable DWARF generation")
88-
FlagL = flag.Bool("l", false, "disable full RELRO")
8988
flag8 bool // use 64-bit addresses in symbol table
9089
flagInterpreter = flag.String("I", "", "use `linker` as ELF dynamic linker")
9190
FlagDebugTramp = flag.Int("debugtramp", 0, "debug trampolines")
9291
FlagDebugTextSize = flag.Int("debugppc64textsize", 0, "debug PPC64 text section max")
9392
FlagStrictDups = flag.Int("strictdups", 0, "sanity check duplicate symbol contents during object file reading (1=warn 2=err).")
93+
FlagRelro = flag.Bool("relro", true, "enable RELRO for buildmode=pie")
9494
FlagRound = flag.Int("R", -1, "set address rounding `quantum`")
9595
FlagTextAddr = flag.Int64("T", -1, "set text segment `address`")
9696
flagEntrySymbol = flag.String("E", "", "set `entry` symbol name")

0 commit comments

Comments
 (0)