build-nasm.sh (1670B)
1 #!/bin/bash 2 set -x -e -v 3 4 COMPRESS_EXT=zst 5 6 cd $MOZ_FETCHES_DIR/nasm-* 7 8 case $(cat version) in 9 2.14.02) 10 # Fix for .debug_loc section containing garbage on elf32 11 # https://bugzilla.nasm.us/show_bug.cgi?id=3392631 12 patch -p1 <<'EOF' 13 diff --git a/output/outelf.c b/output/outelf.c 14 index de99d076..47031e12 100644 15 --- a/output/outelf.c 16 +++ b/output/outelf.c 17 @@ -3275,7 +3275,7 @@ static void dwarf_generate(void) 18 WRITELONG(pbuf,framelen-4); /* initial length */ 19 20 /* build loc section */ 21 - loclen = 16; 22 + loclen = is_elf64() ? 16 : 8; 23 locbuf = pbuf = nasm_malloc(loclen); 24 if (is_elf32()) { 25 WRITELONG(pbuf,0); /* null beginning offset */ 26 EOF 27 ;; 28 esac 29 30 export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH" 31 32 case "$1" in 33 win64) 34 TARGET=x86_64-w64-mingw32 35 CC=x86_64-w64-mingw32-clang 36 EXE=.exe 37 ;; 38 macosx64) 39 export MACOSX_DEPLOYMENT_TARGET=10.15 40 TARGET=x86_64-apple-darwin 41 CC="clang -fuse-ld=lld --target=$TARGET -isysroot $MOZ_FETCHES_DIR/MacOSX26.2.sdk" 42 EXE= 43 ;; 44 macosx64-aarch64) 45 export MACOSX_DEPLOYMENT_TARGET=11.0 46 TARGET=aarch64-apple-darwin 47 CC="clang -fuse-ld=lld --target=$TARGET -isysroot $MOZ_FETCHES_DIR/MacOSX26.2.sdk" 48 EXE= 49 ;; 50 *) 51 CC="clang --sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu" 52 EXE= 53 ;; 54 esac 55 ./configure CC="$CC" AR=llvm-ar RANLIB=llvm-ranlib LDFLAGS=-fuse-ld=lld ${TARGET:+--host=$TARGET} 56 make -j$(nproc) 57 58 mv nasm$EXE nasm-tmp 59 mkdir nasm 60 mv nasm-tmp nasm/nasm$EXE 61 tar -acf nasm.tar.$COMPRESS_EXT nasm 62 mkdir -p "$UPLOAD_DIR" 63 cp nasm.tar.$COMPRESS_EXT "$UPLOAD_DIR"