Re: HELP: MIPS PC Relative Addressing

2021-02-27 Thread Maciej W. Rozycki
On Thu, 25 Feb 2021, Jiaxun Yang wrote:

> >   You may want to use composed relocations to refer to .LA1 (R_MIPS_32) and
> > .LA0 (R_MIPS_SUB).  There may or may not be linker updates needed; unlike
> > the RISC-V one the MIPS BFD backend already supports composed relocations
> > with the usual ELF gABI semantics.  It would be good to switch to RELA at
> > this point universally too; none of new stuff will work with old linkers
> > anyway.
> 
> Thanks for your hint;-)
> 
> I'm unsure about how should we express composed relocations in assembly :-/

 Just like we already do; R_MIPS_SUB could be easily produced directly 
from the `-' operator.

 I note too that $pc is effectively used twice in the calculation, 
cancelling itself, so I think we can do better, though it seems to me the 
original semantics of %pcrel_hi/%pcrel_lo pseudo-ops wasn't thought well 
(I guess it was just blindly copied from %hi/%lo by adding PC-relative 
interpretation with no further thinking as to whether it is usable in 
reality).  It seems to me that we could overload the semantics of these 
pseudo-ops in a compatible manner though.

 Also are you concerned about linker relaxation you're possibly working on 
here?  I'm asking because a calculation like (.LA1 - .LA0) works out as an 
assembly constant normally, so it's not a concern really.  And as I recall 
existing MIPS linker relaxation does not rely on label symbols anyway (and 
is probably not defined for plain R6 anyway as I reckon there is nothing 
to relax at the link stage for that ISA).

 Where it might start to matter is the microMIPS ISA however; offhand I 
don't remember what exactly it looks like at R6 though.

> MIPS N32/N64 ABI is already using RELA, do you mean switch to RELA for o32
> as well?

 Yes, with "universally" I meant: "across all the ABIs".

  Maciej


gcc-10-20210227 is now available

2021-02-27 Thread GCC Administrator via Gcc
Snapshot gcc-10-20210227 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/10-20210227/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 10 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-10 revision f6b1c08e3783bbc3420d95a0357935250d61a29d

You'll find:

 gcc-10-20210227.tar.xz   Complete GCC

  SHA256=715d223d27a2eb9633d2bc1833b6b6622603e3469302cd16c38d27da15442837
  SHA1=1cea6661533de45587d3449a51a848e070294a21

Diffs from 10-20210220 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-10
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


boostrap failure with newlib

2021-02-27 Thread sotrdg sotrdg via Gcc
../../../gcc/libssp/ssp.c: In function '__guard_setup':
../../../gcc/libssp/memcpy-chk.c:45:15: error: unknown type name 'size_t'
   45 |   size_t len, size_t slen)
  |   ^~
../../../gcc/libssp/ssp.c:93:12: warning: implicit declaration of function 
'open' [-Wimplicit-function-declaration]
   93 |   int fd = open ("/dev/urandom", O_RDONLY);
  |^~~~
../../../gcc/libssp/memcpy-chk.c:37:1: note: 'size_t' is defined in header 
''; did you forget to '#include '?
   36 | #include 
  +++ |+#include 
   37 | #ifdef HAVE_STRING_H
../../../gcc/libssp/memcpy-chk.c:45:27: error: unknown type name 'size_t'
   45 |   size_t len, size_t slen)
  |   ^~
../../../gcc/libssp/memcpy-chk.c:45:27: note: 'size_t' is defined in header 
''; did you forget to '#include '?
../../../gcc/libssp/gets-chk.c:62:22: error: unknown type name 'size_t'
   62 | __gets_chk (char *s, size_t slen)
  |  ^~
../../../gcc/libssp/ssp.c:93:34: error: 'O_RDONLY' undeclared (first use in 
this function)
   93 |   int fd = open ("/dev/urandom", O_RDONLY);
  |  ^~~~
../../../gcc/libssp/ssp.c:93:34: note: each undeclared identifier is reported 
only once for each function it appears in
../../../gcc/libssp/gets-chk.c:38:1: note: 'size_t' is defined in header 
''; did you forget to '#include '?
   37 | #include 
  +++ |+#include 
   38 | #ifdef HAVE_STDLIB_H
../../../gcc/libssp/ssp.c:96:7: error: unknown type name 'ssize_t'
   96 |   ssize_t size = read (fd, &__stack_chk_guard,
  |   ^~~
../../../gcc/libssp/ssp.c:96:22: warning: implicit declaration of function 
'read' [-Wimplicit-function-declaration]
   96 |   ssize_t size = read (fd, &__stack_chk_guard,
  |  ^~~~
../../../gcc/libssp/ssp.c:98:7: warning: implicit declaration of function 
'close' [-Wimplicit-function-declaration]
   98 |   close (fd);
  |   ^
../../../gcc/libssp/ssp.c: At top level:
../../../gcc/libssp/ssp.c:113:25: error: unknown type name 'size_t'
  113 | fail (const char *msg1, size_t msg1len, const char *msg3)
  | ^~
../../../gcc/libssp/ssp.c:36:1: note: 'size_t' is defined in header 
''; did you forget to '#include '?
   35 | #include "config.h"
  +++ |+#include 
   36 | #ifdef HAVE_ALLOCA_H
../../../gcc/libssp/ssp.c: In function '__stack_chk_fail':
../../../gcc/libssp/ssp.c:185:3: warning: implicit declaration of function 
'fail' [-Wimplicit-function-declaration]
  185 |   fail (msg, strlen (msg), "stack smashing detected: terminated");
  |   ^~~~
../../../gcc/libssp/ssp.c:185:14: warning: implicit declaration of function 
'strlen' [-Wimplicit-function-declaration]
  185 |   fail (msg, strlen (msg), "stack smashing detected: terminated");
  |  ^~
../../../gcc/libssp/ssp.c:36:1: note: include '' or provide a 
declaration of 'strlen'
   35 | #include "config.h"
  +++ |+#include 
   36 | #ifdef HAVE_ALLOCA_H
../../../gcc/libssp/ssp.c:185:14: warning: incompatible implicit declaration of 
built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
  185 |   fail (msg, strlen (msg), "stack smashing detected: terminated");
  |  ^~
../../../gcc/libssp/ssp.c:185:14: note: include '' or provide a 
declaration of 'strlen'
../../../gcc/libssp/ssp.c: In function '__chk_fail':
../../../gcc/libssp/ssp.c:192:14: warning: incompatible implicit declaration of 
built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
  192 |   fail (msg, strlen (msg), "buffer overflow detected: terminated");
  |  ^~
../../../gcc/libssp/ssp.c:192:14: note: include '' or provide a 
declaration of 'strlen'
../../../gcc/libssp/memset-chk.c:44:36: error: unknown type name 'size_t'
   44 | __memset_chk (void *dest, int val, size_t len, size_t slen)
  |^~
../../../gcc/libssp/memset-chk.c:37:1: note: 'size_t' is defined in header 
''; did you forget to '#include '?
   36 | #include 
  +++ |+#include 
   37 | #ifdef HAVE_STRING_H
../../../gcc/libssp/memset-chk.c:44:48: error: unknown type name 'size_t'
   44 | __memset_chk (void *dest, int val, size_t len, size_t slen)
  |^~
../../../gcc/libssp/memset-chk.c:44:48: note: 'size_t' is defined in header 
''; did you forget to '#include '?
../../../gcc/libssp/stpcpy-chk.c:45:15: error: unknown type name 'size_t'
   45 |   size_t slen)
  |   ^~
../../../gcc/libssp/stpcpy-chk.c:37:1: note: 'size_t' is defined in header 
''; did you forget to '#include '?
   36 | #include 
  +++ |+#include 
   37 | #ifdef HAVE_STRING_H
make[3]: *** [Makefile:576: memcpy-chk.lo] Error 1
make[3]: *** Waiting for unfinished jobs
../../../gcc/libssp/strcat-chk.c:45:15: error: unknown type name 'size_t'
   45 |   size_t slen)
  |   ^

Re: GCC generates non-compliant MIPS relocation data? Obscure GNU extension?

2021-02-27 Thread Maciej W. Rozycki
On Fri, 19 Feb 2021, Maciej W. Rozycki wrote:

>  It looks to me however that you actually have control over the relocation 
> processing code you have referred, so how about improving it to handle the 
> GNU R_MIPS_HI16 extension as well?

 FWIW note that the extension has been around for ~25 years now (which I 
forgot to mention previously).

  Maciej