Skip to content

Commit b2601e7

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

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
@@ -87,8 +87,8 @@ Flags:
8787
instead of $GOROOT/pkg/$GOOS_$GOARCH.
8888
-k symbol
8989
Set field tracking symbol. Use this flag when GOEXPERIMENT=fieldtrack is set.
90-
-l
91-
Disable Full RELRO.
90+
-relro
91+
Enable RELRO (default true).
9292
-libgcc file
9393
Set name of compiler support library.
9494
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
@@ -1408,7 +1408,7 @@ func (ctxt *Link) hostlink() {
14081408
addRELROargs := func(argv []string) []string {
14091409
relro := "-Wl,-z,relro"
14101410
// Enable Full RELRO
1411-
if !*FlagL {
1411+
if *FlagRelro {
14121412
relro += ",-z,now"
14131413
}
14141414
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
@@ -89,13 +89,13 @@ var (
8989
flagN = flag.Bool("n", false, "dump symbol table")
9090
FlagS = flag.Bool("s", false, "disable symbol table")
9191
FlagW = flag.Bool("w", false, "disable DWARF generation")
92-
FlagL = flag.Bool("l", false, "disable full RELRO")
9392
flag8 bool // use 64-bit addresses in symbol table
9493
flagInterpreter = flag.String("I", "", "use `linker` as ELF dynamic linker")
9594
FlagDebugTramp = flag.Int("debugtramp", 0, "debug trampolines")
9695
FlagDebugTextSize = flag.Int("debugtextsize", 0, "debug text section max size")
9796
flagDebugNosplit = flag.Bool("debugnosplit", false, "dump nosplit call graph")
9897
FlagStrictDups = flag.Int("strictdups", 0, "sanity check duplicate symbol contents during object file reading (1=warn 2=err).")
98+
FlagRelro = flag.Bool("relro", true, "enable RELRO for buildmode=pie")
9999
FlagRound = flag.Int("R", -1, "set address rounding `quantum`")
100100
FlagTextAddr = flag.Int64("T", -1, "set text segment `address`")
101101
flagEntrySymbol = flag.String("E", "", "set `entry` symbol name")

0 commit comments

Comments
 (0)