Want to use --emit-relocs in the linker step

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Want to use --emit-relocs in the linker step

Mahmood Naderan
Hi,
I want to add '--emit-relocs' at the linker stage while building nginx, I have edited the objs/Makefile to be like this:

        $(LINK) -o objs/nginx \
        objs/src/core/nginx.o \
         ....
        objs/ngx_modules.o \
        -ldl -lpthread -lcrypt -lpcre -lz --emit-relocs \
        -Wl,-E


However, I get this error

cc: error: unrecognized command line option '--emit-relocs'

Any idea to fix that?


Regards,
Mahmood




_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Want to use --emit-relocs in the linker step

Andrei Belov

> On 27 Apr 2020, at 16:53, Mahmood Naderan <[hidden email]> wrote:
>
> Hi,
> I want to add '--emit-relocs' at the linker stage while building nginx, I have edited the objs/Makefile to be like this:
>
>         $(LINK) -o objs/nginx \
>         objs/src/core/nginx.o \
>          ....
>         objs/ngx_modules.o \
>         -ldl -lpthread -lcrypt -lpcre -lz --emit-relocs \
>         -Wl,-E
>
>
> However, I get this error
>
> cc: error: unrecognized command line option '--emit-relocs'
>
> Any idea to fix that?

As it is linker option, you should use -Wl,--emit-relocs instead.

Also, the better way is to specify linker options via "--with-ld-opt" nginx configure option, e.g.:

./configure --with-ld-opt="-Wl,--emit-relocs"


HTH,

-- Andrei
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Want to use --emit-relocs in the linker step

Mahmood Naderan
Thank you. That is right.
Regards,
Mahmood





On Mon, Apr 27, 2020 at 6:28 PM Andrei Belov <[hidden email]> wrote:

> On 27 Apr 2020, at 16:53, Mahmood Naderan <[hidden email]> wrote:
>
> Hi,
> I want to add '--emit-relocs' at the linker stage while building nginx, I have edited the objs/Makefile to be like this:
>
>         $(LINK) -o objs/nginx \
>         objs/src/core/nginx.o \
>          ....
>         objs/ngx_modules.o \
>         -ldl -lpthread -lcrypt -lpcre -lz --emit-relocs \
>         -Wl,-E
>
>
> However, I get this error
>
> cc: error: unrecognized command line option '--emit-relocs'
>
> Any idea to fix that?

As it is linker option, you should use -Wl,--emit-relocs instead.

Also, the better way is to specify linker options via "--with-ld-opt" nginx configure option, e.g.:

./configure --with-ld-opt="-Wl,--emit-relocs"


HTH,

-- Andrei
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Want to use --emit-relocs in the linker step

Maxim Dounin
In reply to this post by Mahmood Naderan
Hello!

On Mon, Apr 27, 2020 at 06:23:59PM +0430, Mahmood Naderan wrote:

> Hi,
> I want to add '--emit-relocs' at the linker stage while building nginx, I
> have edited the objs/Makefile to be like this:
>
>         $(LINK) -o objs/nginx \
>         objs/src/core/nginx.o \
>          ....
>         objs/ngx_modules.o \
>         -ldl -lpthread -lcrypt -lpcre -lz --emit-relocs \
>         -Wl,-E
>
>
> However, I get this error
>
> cc: error: unrecognized command line option '--emit-relocs'
>
> Any idea to fix that?

Likely you have to use -Wl,--emit-relocs instead, since by nginx
does not use linker directly, but rather calls it via compiler
instead.

Note well that there is no need to edit objs/Makefile manually,
there is the "--with-ld-opt" configure option, see
http://nginx.org/en/docs/configure.html and/or output of the
"./configure --help" command.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx