bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/28348] ld generates corrupted binaries with -lc


From: hjl.tools at gmail dot com
Subject: [Bug ld/28348] ld generates corrupted binaries with -lc
Date: Sat, 18 Sep 2021 03:37:25 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28348

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com
            Summary|ld generates corrupted      |ld generates corrupted
                   |binaries with clang         |binaries with -lc
                   |-fsanitize=address -lc      |

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-gram-1 longjmp]$ cat x.c
#include <setjmp.h>

jmp_buf buf;

int
main ()
{
  longjmp (buf,1);
  return 0;
}
[hjl@gnu-gram-1 longjmp]$ cat y.c
#include <setjmp.h>

__attribute__ ((weak))
void
longjmp(jmp_buf env, int val)
{
}
[hjl@gnu-gram-1 longjmp]$ make
gcc    -c -o x.o x.c
gcc    -c -o y.o y.c
/usr/include/setjmp.h: In function ‘longjmp’:
y.c:7:1: warning: ‘noreturn’ function does return
    7 | }
      | ^
gcc -o x x.o y.o -lc -pthread
readelf --wide --dyn-syms x | grep longjmp
     3: 0000000000401119    15 FUNC    WEAK   DEFAULT   12 longjmp@@<corrupt>
[hjl@gnu-gram-1 longjmp]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]