Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

kk2

Name: Anonymous 2024-10-12 2:54

Good God KK, put on your big boy pants. Do you really think the boys in JP will give Faulkner the boot? Maybe you have visions of a three guitar band (AKA Iron Maiden)? Not gonna happen. You sound like a little girl complaining that she can't participate in a tea party. Someone take your Barbie?
0
allen_pagent 10 · Oct 18, 2021 04:36 PM · report · ↑reply


https://www.ultimate-guitar.com/news/general_music_news/kk_downing_says_its_absolutely_unbelievable_hes_not_allowed_back_in_judas_priest_after_how_rob_halford__glenn_tipton_behaved.html

Name: Anonymous 2024-12-10 14:40

@damienmg this is caused by gcc 6 on debian which enable -pie by default (whether you pass -pie or not). This is different then gcc-5 behavior. To fix this we need to pass -no-pie explicitly or stop using -r.


I believe I figured it out. As part of the GCC 6 release notes, they mention a new gcc compile time option --enable-default-pie which enables pie by default. Apparently it's a more secure default.

https://gcc.gnu.org/gcc-6/changes.html

Passing -no-pie to the failing GCC command fixes this issue so I suspect the gcc binary shipped with stretch was compiled with --enable-default-pie.

Name: Anonymous 2024-12-10 14:45

gcc main.c -o main -no-pie

Name: Anonymous 2024-12-10 14:45

Difference between "-fno-pie" and "-no-pie"
Asked 2 years, 1 month ago
Modified 1 year, 7 months ago
Viewed 4k times
6

I don't find any useful information on the differences between "-fno-pie" and "-no-pie". Are they gcc flags or ld flags? Are they both necessary or not?

I found a piece of makefile that uses these lines:

CC = @gcc -fno-pie -no-pie
LD = @gcc -fno-pie -no-pie

So it uses gcc for linking instead of a direct call to ld but I don't understand the differences between the flags and if they are both necessary to compiling and linking stage

gccldcompiler-flagslinker-flags

Share
Improve this question
Follow
asked Nov 3, 2022 at 8:42
Francesco's user avatar
Francesco
64066 silver badges2929 bronze badges
Add a comment
1 Answer
Sorted by:
5

TLDR; -fno-pie is a "code generation option" while -no-pie is a "linker option". You need both.

-fno-pie tell GCC that you don't want to make a PIE. If you are not making a PIE you are making either a shared object (using -shared) or an ordinary executable.
Ordinary executables are loaded below the 4GiB and at a fixed address, furthermore their symbols cannot be interposed so -fno-pie tell GCC that can translate an expression like &foo in something like mov eax, OFFSET FLAT foo.
It doesn't have to use the GOT since the symbols are not interposed and it doesn't have to use RIP-relative addressing since a 32-bit address fits in the 32-bit immediate/displacement of x86-64 instructions.

Check out what -fpie/-fno-pie do in terms of assembly instructions.

An instruction like mov eax, OFFSET FLAT foo creates a R_X86_64_32 relocation, this relocation is used in 64-bit programs when the compiler is sure that an address will always fit 32 bits (i.e. is below 4GiB).
However -fno-pie doesn't stop GCC from passing -pie to the linker.
So the linker sees a R_X86_64_32 relocation and is still instructed to make a PIE executable. The relocation promises that the address will be below 4GiB but the -pie flag promises that the executable is meant to be loaded anywhere, including above 4GiB.
These contrast each other and the linker is required to check this stalemate and produce an error.

To tell the linker that indeed you did not want to link a PIE executable, you need to pass -no-pie to GCC.

You can pass -v to GCC while compiling a file to see what options are passed to collect2 (a wrapper to the linker).
Regardless of the presence of -fno-pie, -pie is still passed to collect2.
Adding -no-pie to GCC will suppress -pie in the collect2 command line.

Note: Older distributions built GCC without defaulting to -fpie -pie.
Share
Improve this answer
Follow
edited May 6, 2023 at 15:33
answered Apr 13, 2023 at 18:39
Margaret Bloom's user avatar
Margaret Bloom
43.9k55 gold badges8787 silver badges128128 bronze badges

It might be more clear to say that -fpie is a "code generation option" (like most -f options are), and -pie is a "linking option" (does not affect generated assembly, just passed through by the compiler driver to the linker). –
amonakov
Commented May 5, 2023 at 13:02
Based on TLDR; what I need is CC = @gcc -fno-pie and LD = @gcc -no-pie, isn't it? So I don't need both in the 2 script lines –
Francesco
Commented Aug 30, 2023 at 6:34

Name: Anonymous 2024-12-10 14:50

didnt work

POSTINSTALL=cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;

CFLAGS=-g -O -I../include -DNOTPARMDECL
CFLAGS+=-DDLB
CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
CFLAGS+=-DTIMED_DELAY
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
CFLAGS+=-DDUMPLOG
CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
CFLAGS+=-DCURSES_GRAPHICS
#CFLAGS+=-DEXTRA_SANITY_CHECKS
#CFLAGS+=-DEDIT_GETLIN
#CFLAGS+=-DSCORE_ON_BOTL
#CFLAGS+=-DMSGHANDLER
#CFLAGS+=-DTTY_TILES_ESCCODES
CFLAGS+=-fno-pie -no-pie

LINK=$(CC)
# Only needed for GLIBC stack trace:
LFLAGS=-rdynamic
LFLAGS+=-fno-pie -no-pie

Name: Anonymous 2024-12-10 15:05

cd sys/unix

sh setup.sh hints/linux

cd ../..

make all

Name: Anonymous 2024-12-10 15:14

/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture
g++ -Wall -g -I /opt/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL_SYSCALLS -g3 -Wall -DVULTURE_NETHACK -DVULTURE_NETHACK_3_6_0 -I ../../include/ -I . -I build_nethack_3_6_0/ -c build_nethack_3_6_0/vulture_tileconfig.parser.cpp -o build_nethack_3_6_0/vulture_tileconfig.parser.o
generating parser
compiling build_nethack_3_6_0/vulture_tileconfig.lexer.cpp
echo `pwd`
/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture
g++ -Wall -g -I /opt/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL_SYSCALLS -g3 -Wall -DVULTURE_NETHACK -DVULTURE_NETHACK_3_6_0 -I ../../include/ -I . -I build_nethack_3_6_0/ -c build_nethack_3_6_0/vulture_tileconfig.lexer.cpp -o build_nethack_3_6_0/vulture_tileconfig.lexer.o
combining objects to build_nethack_3_6_0/vulture.o
/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status
make[2]: *** [GNUmakefile:62: build_nethack_3_6_0/vulture.o] Error 1
make[2]: Leaving directory '/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture'
make[1]: *** [Makefile:696: ../win/vulture/build_nethack_3_6_0/vulture.o] Error 2
make[1]: Leaving directory '/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/src'
make: *** [Makefile:197: vulture-nethack-3.6.6] Error 2

Name: Anonymous 2024-12-10 15:14

$(OUTPUT_OBJ): $(VOBJ)
@echo combining objects to $@
@$(CXX) -nostdlib -Xlinker -r $(VOBJ) -L /tmp/libstdcxx/lib64 -lstdc++ -o $(OUTPUT_OBJ) -fno-pie -no-pie

Name: Anonymous 2024-12-10 15:17

/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture
g++ -Wall -g -I /opt/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL_SYSCALLS -g3 -Wall -DVULTURE_NETHACK -DVULTURE_NETHACK_3_6_0 -I ../../include/ -I . -I build_nethack_3_6_0/ -c winclass/toolbar.cpp -o build_nethack_3_6_0/winclass/toolbar.o
compiling winclass/window.cpp
echo `pwd`
/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture
g++ -Wall -g -I /opt/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL_SYSCALLS -g3 -Wall -DVULTURE_NETHACK -DVULTURE_NETHACK_3_6_0 -I ../../include/ -I . -I build_nethack_3_6_0/ -c winclass/window.cpp -o build_nethack_3_6_0/winclass/window.o
compiling build_nethack_3_6_0/vulture_tileconfig.parser.cpp
echo `pwd`
/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture
g++ -Wall -g -I /opt/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL_SYSCALLS -g3 -Wall -DVULTURE_NETHACK -DVULTURE_NETHACK_3_6_0 -I ../../include/ -I . -I build_nethack_3_6_0/ -c build_nethack_3_6_0/vulture_tileconfig.parser.cpp -o build_nethack_3_6_0/vulture_tileconfig.parser.o
generating parser
compiling build_nethack_3_6_0/vulture_tileconfig.lexer.cpp
echo `pwd`
/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture
g++ -Wall -g -I /opt/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL_SYSCALLS -g3 -Wall -DVULTURE_NETHACK -DVULTURE_NETHACK_3_6_0 -I ../../include/ -I . -I build_nethack_3_6_0/ -c build_nethack_3_6_0/vulture_tileconfig.lexer.cpp -o build_nethack_3_6_0/vulture_tileconfig.lexer.o
combining objects to build_nethack_3_6_0/vulture.o
finished building the files for the vulture interface
make[2]: Leaving directory '/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/win/vulture'
../win/vulture/vendor/theoraplay/theoraplay.c:32:10: fatal error: theora/theoradec.h: No such file or directory
32 | #include "theora/theoradec.h"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:699: ../win/vulture/build_nethack_3_6_0/theoraplay.o] Error 1
make[1]: Leaving directory '/home/r00t/Downloads/CMPLEATTMPT/Vulture-NetHack-3.6.6-vultures-3.6.6/src'
make: *** [Makefile:197: vulture-nethack-3.6.6] Error 2

Name: Anonymous 2024-12-10 19:41

Name: Anonymous 2024-12-10 22:30

Name: Anonymous 2024-12-10 22:42

Name: Anonymous 2024-12-10 22:48

Name: Anonymous 2024-12-10 22:59

Name: Anonymous 2024-12-10 23:16

Name: Anonymous 2024-12-11 17:48

Name: Anonymous 2024-12-11 23:35

Name: Anonymous 2024-12-11 23:39

Name: Anonymous 2024-12-11 23:44

Name: Anonymous 2024-12-11 23:53

Name: Anonymous 2024-12-11 23:54

Name: Anonymous 2024-12-11 23:56

Name: Anonymous 2024-12-12 0:02

Name: Anonymous 2024-12-12 0:13

Name: Anonymous 2024-12-12 0:14

Name: Anonymous 2024-12-12 0:16

Name: Anonymous 2024-12-12 0:19

Name: Anonymous 2024-12-12 0:19

Name: Anonymous 2024-12-12 0:20

Name: Anonymous 2024-12-12 0:22

Name: Anonymous 2024-12-12 1:05

Name: Anonymous 2024-12-12 2:07

Name: Anonymous 2024-12-12 2:12

Name: Anonymous 2024-12-12 2:21

Name: Anonymous 2024-12-12 2:34

Name: Anonymous 2024-12-12 2:41

Name: Anonymous 2024-12-12 11:37

Name: Anonymous 2024-12-12 11:45

Name: Anonymous 2024-12-12 15:00

Name: Anonymous 2024-12-12 15:45

17.44

Name: Anonymous 2024-12-12 16:31

27:37

Newer Posts